A platform for community discussion. Free, open, simple.
FEATURE: Always show tag dropdown when tagging is enabled (#12209)
Kris83519e7f3ac4
diff --git a/app/assets/javascripts/discourse/app/controllers/tag-show.js b/app/assets/javascripts/discourse/app/controllers/tag-show.jsindex bb2997e20e2..bde05d5718b 100644--- a/app/assets/javascripts/discourse/app/controllers/tag-show.js+++ b/app/assets/javascripts/discourse/app/controllers/tag-show.js@@ -69,7 +69,7 @@ export default Controller.extend(BulkTopicSelection, FilterModeMixin, {@discourseComputed("category")showTagFilter() {- return this.siteSettings.show_filter_by_tag;+ return true;},loadMoreTopics() {diff --git a/app/assets/javascripts/discourse/app/templates/components/bread-crumbs.hbs b/app/assets/javascripts/discourse/app/templates/components/bread-crumbs.hbsindex 8236b9448a7..354e4de4ecb 100644--- a/app/assets/javascripts/discourse/app/templates/components/bread-crumbs.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/bread-crumbs.hbs@@ -15,23 +15,21 @@{{/each}}{{#if siteSettings.tagging_enabled}}- {{#if siteSettings.show_filter_by_tag}}- {{#if additionalTags}}- {{tags-intersection-chooser- currentCategory=category- mainTag=tag.id- additionalTags=additionalTags- options=(hash- categoryId=category.id- )- }}- {{else}}- {{tag-drop- currentCategory=category- noSubcategories=noSubcategories- tagId=tag.id- }}- {{/if}}+ {{#if additionalTags}}+ {{tags-intersection-chooser+ currentCategory=category+ mainTag=tag.id+ additionalTags=additionalTags+ options=(hash+ categoryId=category.id+ )+ }}+ {{else}}+ {{tag-drop+ currentCategory=category+ noSubcategories=noSubcategories+ tagId=tag.id+ }}{{/if}}{{/if}}diff --git a/app/assets/javascripts/discourse/app/templates/tags/show.hbs b/app/assets/javascripts/discourse/app/templates/tags/show.hbsindex b8f396ddba6..54da57e02a7 100644--- a/app/assets/javascripts/discourse/app/templates/tags/show.hbs+++ b/app/assets/javascripts/discourse/app/templates/tags/show.hbs@@ -1,4 +1,4 @@-{{#d-section tagName="" pageClass="tags" bodyClass=(concat "tag-" tag.id (if category.slug (concat " category-" category.slug)) "")}}+{{#d-section tagName="" pageClass="tags" bodyClass=(concat "tag-" tag.id (if category.slug (concat " category-" category.slug)) "" (if additionalTags " tags-intersection"))}}<div class="container">{{discourse-banner user=currentUser banner=site.banner}}</div>diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.jsindex e2747520a16..fe9be3e3724 100644--- a/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js@@ -36,7 +36,7 @@ acceptance("Tags intersection", function (needs) {assert.ok(exists(".mini-tag-chooser"), "The tag selector appears");assert.equal(- $(".mini-tag-chooser").text().trim(),+ $(".composer-fields .mini-tag-chooser").text().trim(),"first, second","populates the tags when clicking 'New topic'");diff --git a/app/assets/javascripts/select-kit/addon/components/tag-drop.js b/app/assets/javascripts/select-kit/addon/components/tag-drop.jsindex 13e746d6af6..e28079a9423 100644--- a/app/assets/javascripts/select-kit/addon/components/tag-drop.js+++ b/app/assets/javascripts/select-kit/addon/components/tag-drop.js@@ -4,7 +4,6 @@ import ComboBoxComponent from "select-kit/components/combo-box";import DiscourseURL, { getCategoryAndTagUrl } from "discourse/lib/url";import TagsMixin from "select-kit/mixins/tags";import { computed } from "@ember/object";-import { isEmpty } from "@ember/utils";import { makeArray } from "discourse-common/lib/helpers";export const NO_TAG_ID = "no-tags";@@ -13,21 +12,13 @@ export const NONE_TAG_ID = "none";export default ComboBoxComponent.extend(TagsMixin, {pluginApiIdentifiers: ["tag-drop"],- classNameBindings: ["categoryStyle", "tagClass", "shouldHide:hidden"],+ classNameBindings: ["categoryStyle", "tagClass"],classNames: ["tag-drop"],value: readOnly("tagId"),tagName: "li",- showFilterByTag: setting("show_filter_by_tag"),categoryStyle: setting("category_style"),maxTagSearchResults: setting("max_tag_search_results"),sortTagsAlphabetically: setting("tags_sort_alphabetically"),- shouldHide: computed("showFilterByTag", "content.[]", function () {- if (this.showFilterByTag && !isEmpty(this.content)) {- return false;- }-- return true;- }),selectKitOptions: {allowAny: false,diff --git a/app/assets/stylesheets/common/base/tagging.scss b/app/assets/stylesheets/common/base/tagging.scssindex 577197ed845..8b27a5f0d5f 100644--- a/app/assets/stylesheets/common/base/tagging.scss+++ b/app/assets/stylesheets/common/base/tagging.scss@@ -308,3 +308,9 @@ section.tag-info {margin: 0 0.5em 0 0;}}++body.tags-intersection {+ .category-breadcrumb {+ margin-right: auto;+ }+}diff --git a/app/models/tag.rb b/app/models/tag.rbindex 73af70faf1c..5245843e493 100644--- a/app/models/tag.rb+++ b/app/models/tag.rb@@ -148,7 +148,7 @@ class Tag < ActiveRecord::Baseenddef self.include_tags?- SiteSetting.tagging_enabled && SiteSetting.show_filter_by_tag+ SiteSetting.tagging_enabledenddef full_urldiff --git a/app/models/topic_tracking_state.rb b/app/models/topic_tracking_state.rbindex 045ad34cece..75c2e9d9745 100644--- a/app/models/topic_tracking_state.rb+++ b/app/models/topic_tracking_state.rb@@ -240,7 +240,7 @@ class TopicTrackingStateenddef self.include_tags_in_report?- SiteSetting.tagging_enabled && (@include_tags_in_report || SiteSetting.show_filter_by_tag)+ SiteSetting.tagging_enabled && @include_tags_in_reportenddef self.include_tags_in_report=(v)diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex a4502d33cc4..28344bb5df3 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -2249,7 +2249,6 @@ en:max_tags_per_topic: "The maximum tags that can be applied to a topic."max_tag_length: "The maximum amount of characters that can be used in a tag."max_tag_search_results: "When searching for tags, the maximum number of results to show."- show_filter_by_tag: "Show a dropdown to filter a topic list by tag."max_tags_in_filter_list: "Maximum number of tags to show in the filter dropdown. The most used tags will be shown."tags_sort_alphabetically: "Show tags in alphabetical order. Default is to show in order of popularity."tags_listed_by_group: "List tags by tag group on the <a href='%{base_path}/tags' target='_blank'>Tags page</a>."diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 53c19ee4276..300bb24fdec 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -2379,10 +2379,6 @@ tags:client: truedefault: 5min: 1- show_filter_by_tag:- client: true- default: false- refresh: truemax_tags_in_filter_list:client: truedefault: 30diff --git a/spec/models/topic_tracking_state_spec.rb b/spec/models/topic_tracking_state_spec.rbindex b0c119419af..f87eb2cbff4 100644--- a/spec/models/topic_tracking_state_spec.rb+++ b/spec/models/topic_tracking_state_spec.rb@@ -636,14 +636,6 @@ describe TopicTrackingState doexpect(row.tags).to contain_exactly("apples", "bananas")TopicTrackingState.include_tags_in_report = false- SiteSetting.show_filter_by_tag = true-- report = TopicTrackingState.report(user)- expect(report.length).to eq(1)- row = report[0]- expect(row.tags).to contain_exactly("apples", "bananas")-- SiteSetting.show_filter_by_tag = falsereport = TopicTrackingState.report(user)expect(report.length).to eq(1)