Commit Graph

113 Commits

Author SHA1 Message Date
Penar Musaraj c2f27d1e3b
FIX: Toggling categories was requiring two clicks (#134) 2023-05-24 16:06:09 -04:00
Keegan George 3f412f3666
FIX: Icons not appearing (#132) 2023-05-10 12:53:12 -07:00
Isaac Janzen e00946e200
DEV: Use angle bracket syntax (#130) 2023-05-02 09:26:06 -05:00
Ted Johansson 002dd91a05
FIX: Fix an issue where deselecting a filter tag would cause no results (#126)
In some cases, when having multiple tag filters selected and results in the list, deselecting one of the filters would cause no results. This is clearly incorrect behavior, as fewer filters should lead to more (or at least the same number of) results.

This happens when you have a list of selected filters, e.g. `foo|bar|baz`, and you deselect the "middle" one. This will result in the following filter: `foo||baz`, which causes the back-end to try and filter on empty string as well, and in turn leads to no results.

The order of the filter list depends on the order they were selected, which caused this to seem a bit erratic.

In the code, there's a regular expression that tries to remove consecutive `|` characters, but this is anchored to the beginning of the string, so it doesn't work for this case.

Instead of relying on a regular expression, this change splits the string into an array, filters out the deselected tag, and joins it back together into the filter string. This avoids the issues that regular expressions have.

The PR also includes unit tests for the three code paths of the filter selection.
2023-04-03 13:56:41 +08:00
Andrei Prigorshnev a5823e3a05
FEATURE: Make user status on mentions on docs live (#117)
This makes status on mentions in docs receive live updates 
from the server.
2023-03-24 21:11:50 +04:00
Jarek Radosz f4c8e72293
FIX: Make `docsCategories` ignore invalid ids (#125) 2023-03-24 11:07:18 +01:00
David Taylor 1bb737feb0
DEV: Update eslint-config-discourse, use prettier for hbs (#119) 2023-01-04 13:36:19 +01:00
Alan Guo Xiang Tan b2404797f2
DEV: Update experimental sidebar site setitng to follow core (#115) 2022-12-08 09:44:03 +08:00
Penar Musaraj b23790e85d
UX: Expand category filters even when already filtered (#112) 2022-11-28 15:16:24 -05:00
Frank 6b3f2576c3
FEATURE: add a global setting to support custom docs url path (#107)
* FEATURE: add a global setting to support custom docs url path

This commit adds a GlobalSetting `docs_path` to support custom docs url
path for sites that do not want docs page to live at `/docs` and have a
customized path.

* Fixed the route declaration

* Test and linting

* Update server.en.yml

* Fixed doc test

* Fixed linting.

* Testing qunit test fix

* Fixed tests

* Prettified tests

* Changed the implementation from SiteSetting to GlobalSetting instead.

* Fixed tests

* Cleanup

* Using Site instead of .js.erb to pass GlobalSetting.docs_url to the front end.

Also fixed front end tests

* Remove references to obsolete site setting

* remove unused fixture file

* Rename `docs_url` to `docs_path` and use camelCase in JavaScript

* Add serializer tests

Co-authored-by: Arpit Jalan <er.ajalan@gmail.com>
2022-11-17 11:33:38 +05:30
Alan Guo Xiang Tan 13bab928c7
DEV: Update plugin API after core changes (#104) 2022-08-01 14:56:27 +08:00
Alan Guo Xiang Tan fc2750e1d1
DEV: Update tests to use new site settings (#102) 2022-07-27 12:55:45 +08:00
Isaac Janzen 834d22d868
DEV: Remove 'htmlSafe' string prototype extensions (#97)
## Ember Upgrade

Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
2022-06-01 10:16:17 -05:00
Alan Guo Xiang Tan 2b6a1f468d
FEATURE: Register docs link under sidebar topics section. (#95) 2022-05-26 09:24:30 +08:00
Isaac Janzen 679fee9def
DEV: update routing to allow for open_in_new_tab (#93)
We can rip out the `click` handler completely and just lean on the _logic_ we have in `docs-index`. 

0cef82aec0/assets/javascripts/discourse/routes/docs-index.js (L12)

It will always refresh the `selectedTopic` so there will be no need to update it within the click handler. Which then nullifies the need for `setSelectedTopic`.
2022-05-05 11:22:16 -05:00
Kris 700008b792
DEV: add plugin outlet to enable custom checkbox css (#86) 2022-03-18 13:28:11 -04:00
Kris e7c8217570
DEV: add plugin outlets for custom controls (#87) 2022-03-18 13:27:14 -04:00
Bianca Nenciu 4c0f58d982
FIX: Remove reference to share-popup (#85) 2022-03-15 21:27:01 +02:00
Jarek Radosz 650b10ef42
DEV: Lose the es6 suffix (#84) 2022-03-05 17:23:56 +01:00
Krzysztof Kotlarek 7c54952414
FIX: TopicViewItem and TopicUser for doc topics (#80)
When a documentation topic is viewed, corresponding TopicViewItem and TopicUser should be created.

A method from a TopicController is called, however, specs should warn us if ever that core method would change.
2022-02-01 16:38:54 +11:00
Andrei Prigorshnev 6bad85b1ef
FEATURE: improve blank page syndrome (#79) 2022-01-28 20:10:53 +04:00
Penar Musaraj 39f956fa13
DEV: Add outlet + scroll event to support DiscoTOC (#75) 2022-01-19 12:43:00 -05:00
David Taylor 841a814bfb
DEV: Update plugin-outlet arguments (#73)
Core's defaults are changing in https://github.com/discourse/discourse/pull/13685. This commit ensures the behaviour of this plugin will not change.
2022-01-06 20:33:34 +00:00
Jordan Vidrine 0aef9946b4
SYNTAX: Add classes in prep for Topic list refactor (#69)
* DEV: Prep for topic-list refactor
2021-11-16 13:56:12 -06:00
Kris 4631ccb8b1
DEV: add plugin outlet, li class (#68) 2021-11-05 15:09:24 -04:00
Jordan Vidrine d8c48e6218
FEATURE: Add filter + alpha & numeric sort to categories and tags in docs sidebar (#62)
* UX: Docs sidebar changes

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2021-10-19 10:04:36 -05:00
Penar Musaraj bfed4ba324
UX: Add in:docs quick tip in search widget (#61) 2021-10-12 10:11:29 -04:00
Penar Musaraj 17a21cad4d
UX: Add `in:docs` filter to search (#56) 2021-07-21 15:53:40 -04:00
Jarek Radosz 378f8d24f4
FIX: Correctly trigger actions (#45)
Fixes a regression introduced in #32. Reported in https://meta.discourse.org/t/meta-discourse-org-docs-sidebar-filter-doesnt-work/188350/2

Included:
* DEV: Use `query` helper
* DEV: Simplify the Docs model
* DEV: Add a test
* FIX: Correctly trigger actions
* DEV: Use `count` instead of `queryAll`
2021-04-29 16:36:14 +02:00
discoursebot f75c9d5e32
DEV: Update CI workflows, fix linting issues (#32)
Included:

* DEV: Update CI workflows
* DEV: Update the plugin URL
* DEV: Update Gemfile.lock
* DEV: Remove an old rubocop artifact
* DEV: Add .prettierrc
* DEV: Clean up .gitignore
* DEV: Add license
* DEV: Update package.json
* DEV: Fix template issues
* DEV: Re-format code
* DEV: Use `@action`
* DEV: `inject as controller`
* DEV: Use `@computed`
* DEV: Avoid naming collision and extra indirection
* DEV: Use `discourse-common/utils/decorators`
* DEV: Use `role="button"`

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: jjaffeux <j.jaffeux@gmail.com>
2021-04-27 20:49:34 +02:00
Jordan Vidrine a5bd6954c0
FEATURE: Add `selectTag`, `tags`, and `categories` to plugin outlet. (#38) 2021-03-23 08:50:44 -05:00
Justin DiRose f61de2d871
DEV: Add parameter to plugin outlet (#37)
This adds a parameters to the args hash of the before-docs-search plugin outlet so we can access tags via theme components using this outlet.
2021-03-15 11:23:37 -05:00
Justin DiRose 2ee446b1fa
FEATURE: Add link to Docs in top menu (#34)
Added a plugin setting so admins have the choice of including a link to Docs in the top menu.
2021-02-18 15:24:52 -06:00
Joffrey JAFFEUX ce005939c1
DEV: prettier 2.2.1 (#30) 2021-01-27 10:37:03 +01:00
Justin DiRose b13abb992c
FIX: Compute topic title correctly (#29)
Was using `unicode_title` but not all topics return a unicode_title
attribute. So need to instead do this.
2021-01-19 12:16:20 -06:00
Justin DiRose 68a7243a66
FIX: Account for not having a unicode_title (#28)
Mistakenly forgot to check for presence of unicode title and use the appropriate one.
2021-01-18 12:17:29 -06:00
Justin DiRose f32aebdba0
FEATURE: Rename from Knowledge Explorer to Docs (#27)
After internal discussion, the team decided to rename this plugin to `discourse-docs`. No substantial changes made here aside from a settings migration.
2021-01-18 10:38:09 -06:00
Justin DiRose cb7c12defe
FIX: Show unicode title in topic view (#26) 2021-01-13 13:27:10 -06:00
Justin DiRose a82db01108
FEATURE: Show topic title and category in site title (#25) 2021-01-13 13:26:52 -06:00
Osama Sayegh 25d3fbdfed
FIX: debounce search correctly (#24)
Signed-off-by: OsamaSayegh <asooomaasoooma90@gmail.com>
2021-01-05 15:16:44 +03:00
Roman Rizzi 3da00ddaa1
DEV: Use the new discourseDebounce function wrapper. (#22)
We recently merged a Discourse core's PR to replace usages of Ember's debounce and discourseDebounce with a new debounce wrapper. The new wrapper works exactly like Ember's debounce but internally calls "run" when called in test mode.

This PR replaces all usages of other debounce functions with the new wrapper and fallbacks to Ember's debounce for backward-compatibility.
2020-12-22 14:45:33 -03:00
Justin DiRose 63a8181fa4
FIX: Results count not always properly shown (#21)
There was a weird case where when filtering topics by solved status did not properly show the count of filtered topics. I took this opportunity to lightly refactor the backend. There was a duplicate size operation when we searched and when calculating pagination. I've eliminated the second size call and refactored the front end to be a little bit simpler while solving the bug.
2020-12-01 13:51:42 -06:00
Jarek Radosz 019591c995
FIX: Don't overwrite Topic.category computed prop (#18)
Pre-loading/pre-assigning isn't necessary. `Topic.category` uses `Category.findById` which in turn uses an identity map, so there are no N+1 calls to the backend.
2020-11-11 22:14:38 +01:00
Mark VanLandingham 23ed78cc87
DEV: Use html-safe for no_topics translation (#17) 2020-11-11 09:01:59 -06:00
Justin DiRose dd55d165cd
FIX: Filters did not reset when visiting route (#14)
When using a single Ember route, the query param filters did not
properly reset when, for example, clicking the Knowledge Explorer link
in the hamburger menu.

This commit introduces a subroute where most of the logic takes place.
We needed a subroute so that refresh doesn't take out the entire UI part.
This allows us to use the `refreshModel` option for query params on the
route and remove the refresh controller action. Doing so also retains
state of the search field instead of fully reloading the parent route.
2020-11-04 12:02:05 -06:00
Justin DiRose aac4af9d96
DEV: Fix deprecated object creation methods (#13)
This commit makes sure we're using the up to date methods to create Ember classes and objects.
2020-10-27 11:31:09 -05:00
Justin DiRose e6e302782b
DEV: Add new plugin outlet 2020-10-06 12:13:31 -05:00
Justin DiRose e3be3fbb77
FEATURE: Add clear button to search bar
Previously you had to clear the search results out by deleting them.
This introduces a friendlier way to clear the search UX, especially if
you didn't find what you're looking for.
2020-10-06 12:08:28 -05:00
Justin DiRose 30aa6230c5
DEV: Add args to plugin outlet 2020-10-05 15:16:14 -05:00
Justin DiRose 0e1c7c7216
FEATURE: Add onebox metadata (#10)
Currently linking directly to Knowledge Explorer topics shows a generic onebox, which isn't super helpful in some cases.

This commit mimics how the theme creator plugin handles adding metadata to special occurrences. However, to get this to work, how the plugin handles showing topic contents needed to be refactored. Instead of hitting the existing topic route, the plugin implements its own version of this, including adding restrictions for topics that are not in a selected Knowledge Explorer category or tag.
2020-10-01 09:32:28 -05:00