* 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>
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.
Linking directly to a Docs item like so `http://localhost:3000/docs?topic=16` would result in a generic inline onebox link. This adds logic to the Rails view so a proper title is rendered when the `InlineOneboxer` in core queries the route.
After internal discussion, the team decided to rename this plugin to `discourse-docs`. No substantial changes made here aside from a settings migration.
When trying to onebox topics, the canonical URL overrides the generated
OpenGraph tags, causing a less than ideal onebox for a linked KE
article.
This commit uses the existing options for the `crawlable_meta_data`
method to generate the `og:ignore_canonical` tag.
1504fe7231/app/helpers/application_helper.rb (L267-L269)
Logic was not properly checking if there was a topic selected or not. As a result, the template for onebox data was still being loaded, causing an error. Also changed the order around TopicView to avoid unwanted effects.
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.
* Create custom query lib file
* Get topic list by category
* Get topic list with both categories and tags
* Count tags and pass back to controller in object
* Filter topic list by param-passed tag list
* FIX: Correctly serialize topic list data
* Filter results by search term (title only
* Debug commit
* Working multi-tag filtering
* FIX: case insensitive search terms
* Begin refactor of front end for new api changes
* REFACTOR: Use model for refreshing data
Instead of just using a route, which introduces full page refreshes, use
the route to pull the data initially, then update it using a model as to
refresh only the relevant parts of the page.
* Working topic load
* FIX: Visual alignment
* Refactor tests to follow new patterns
* Fixes suggested by eviltrout
* FEATURE: Load more topics
* FIX: Paginate records on return to the front end in a better fashion
* FIX: Prevent loadMore while loading more
* Fix pagination of topics to truncate list properly
* Inherit rubocop from discourse
* Make rubocop happynated
* Set list to unordered
Add category/tag settings
Rename to knowledge explorer
Missed rename
Render a deduplicated list of topics from all selected tags and categories
Exclude category topic ids from rendered list