Commit Graph

133 Commits

Author SHA1 Message Date
Sérgio Saquetim 9fcfac6d76
DEV: Use `transformedPost` as args to the Post widget (#202)
The post widgets expect to receive a transformed post as argument and use the spread operator to pass attributes to the inner widget, however the Docs plugin was providing a post model instance as argument instead.

This used to work fine, but as we introduce tracked properties in the post model, the spread operator doesn't copy their values, which causes issues.

This PR changes the `DocsTopic` Component to provide a `transformedPost` as argument to the post widget instead.

The change is necessary due to upcoming changes in the post model for the Glimmer post stream.
2025-03-18 14:37:56 -03:00
David Taylor ec328ed3d8
DEV: Bump dependencies and fix linting (#194) 2025-02-06 17:45:14 +01:00
Kelv 4e42539cda
DEV: update deprecated icon names times-circle (#192) 2025-01-10 12:59:44 +08:00
David Taylor ee5111a628
DEV: Update for glimmer topic list (#189)
This switches docs to use the core `<BasicTopicList` component, with some customizations made via the DAG API.
2025-01-07 11:52:34 +00:00
David Taylor 0897548b5d
DEV: Colocate component templates (#191) 2025-01-06 18:54:54 +00:00
David Taylor c8b4e742dd
DEV: Update more fa6 icon names (#190) 2025-01-06 18:54:40 +00:00
Kelv d30f2d44dc
DEV: Update deprecated Font Awesome icon names (#188) 2024-12-04 02:44:01 +01:00
David Taylor 12dfb332bf
DEV: Convert to native class syntax (#187) 2024-12-02 14:30:16 +01:00
David Taylor c74323869f
DEV: Update linting (#184) 2024-11-20 15:46:07 +01:00
Bianca Nenciu e90a3193df
FIX: Load complete category objects (#167)
Not all categories are preloaded when lazy_load_categories is enabled.
In this case, the category objects that are loaded through /docs.json
must be complete.
2024-04-04 10:23:42 +03:00
Jarek Radosz 75646d121e
DEV: Update linting (#163) 2024-01-15 11:17:26 +00:00
Kris 1fe484e1dc
DEV: pass topic arg to below-docs-topic (#162) 2024-01-04 14:47:11 -05:00
Osama Sayegh 1d110f4b60
DEV: Remove decoration for legacy hamburger menu (#160)
The `legacy` option has been removed from the `navigation_menu` site setting, so we can remove all the logic that's related to the `legacy` option from this plugin.

Internal topic: t/113137.
2023-12-11 13:05:41 +03:00
David Taylor 30e32fa59a
UX: Only perform search when enter key is pressed (#159)
This makes docs search behavior consistent with the rest of Discourse. It also resolves a UX issue where the live search would cause the input to lose focus while typing.
2023-12-04 14:19:45 +00:00
Jarek Radosz ca8501aaf5
DEV: Fix deprecations (getOwner and router:main) (#157) 2023-11-24 11:33:19 +01:00
Jarek Radosz bef115d760
DEV: Update linting setup (#156) 2023-11-19 22:43:42 +01:00
Jordan Vidrine 06f6d00ba1
FEATURE: Use the same structure as core topic-list-item and add topic excerpts to docs index (#140)
* FEATURE: Optionally show topic excerpts in docs index

This commit adds a new docs_show_topic_excerpts site setting
which, when enabled and used in conjunction either with the
always_include_topic_excerpts site setting or the
serialize_topic_excerpts theme modifier.

For the theme modifier, this commit also fixes an issue
with the Docs::Query class. Since we were re-initializing
Guardian within the class (rather than using the guardian
passed down from the controller), we did not have the request
information needed to determine theme_id, which meant that
the theme modifier had no effect. We now pass down guardian
from the controller instead. In general guardian is almost
always better than a user object, since we can always just
call guardian.user.

Adds a simple system spec as well.

---

We now check both the serialize_topic_excerpts theme modifier
and the always_include_topic_excerpts site setting server-side
within Docs::Query, and use that on the client to determine
whether or not to show the excerpts for docs. This is because if
someone sets one of those values it's logical to think it will
apply everywhere there is a topic list.

Also include a system spec to test whether the theme modifier
works to show the excerpts.

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2023-06-15 12:44:44 -05:00
Jean d4ab4080db
FEATURE: add setting to show tags by group (#138)
* FEATURE: add setting to show tags by group
2023-06-09 11:02:17 -04:00
Mark VanLandingham 5a8bbc3f87
FEATURE: Site setting to control search menu tip addition (#136) 2023-06-05 09:39:31 -05:00
Isaac Janzen 04af2c4d33
DEV: Use angle bracket syntax (#135) 2023-05-26 16:16:08 -05:00
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