diff --git a/app/assets/javascripts/discourse/components/edit-category-tags.js.es6 b/app/assets/javascripts/discourse/components/edit-category-tags.js.es6 new file mode 100644 index 00000000000..22bf364e968 --- /dev/null +++ b/app/assets/javascripts/discourse/components/edit-category-tags.js.es6 @@ -0,0 +1,4 @@ +import { buildCategoryPanel } from 'discourse/components/edit-category-panel'; + +export default buildCategoryPanel('tags', { +}); diff --git a/app/assets/javascripts/discourse/components/tag-chooser.js.es6 b/app/assets/javascripts/discourse/components/tag-chooser.js.es6 index 88e7577d1e2..e69ba2df5cf 100644 --- a/app/assets/javascripts/discourse/components/tag-chooser.js.es6 +++ b/app/assets/javascripts/discourse/components/tag-chooser.js.es6 @@ -6,7 +6,7 @@ function formatTag(t) { export default Ember.TextField.extend({ classNameBindings: [':tag-chooser'], - attributeBindings: ['tabIndex'], + attributeBindings: ['tabIndex', 'placeholderKey', 'categoryId'], _setupTags: function() { const tags = this.get('tags') || []; @@ -25,7 +25,7 @@ export default Ember.TextField.extend({ this.$().select2({ tags: true, - placeholder: I18n.t('tagging.choose_for_topic'), + placeholder: I18n.t(this.get('placeholderKey') || 'tagging.choose_for_topic'), maximumInputLength: this.siteSettings.max_tag_length, maximumSelectionSize: this.siteSettings.max_tags_per_topic, initSelection(element, callback) { @@ -78,7 +78,7 @@ export default Ember.TextField.extend({ url: Discourse.getURL("/tags/filter/search"), dataType: 'json', data: function (term) { - return { q: term, limit: self.siteSettings.max_tag_search_results, filterForInput: true }; + return { q: term, limit: self.siteSettings.max_tag_search_results, filterForInput: true, categoryId: self.get('categoryId') }; }, results: function (data) { if (self.siteSettings.tags_sort_alphabetically) { diff --git a/app/assets/javascripts/discourse/models/category.js.es6 b/app/assets/javascripts/discourse/models/category.js.es6 index 37cfd9f2977..0e013cf8337 100644 --- a/app/assets/javascripts/discourse/models/category.js.es6 +++ b/app/assets/javascripts/discourse/models/category.js.es6 @@ -86,7 +86,8 @@ const Category = RestModel.extend({ allow_badges: this.get('allow_badges'), custom_fields: this.get('custom_fields'), topic_template: this.get('topic_template'), - suppress_from_homepage: this.get('suppress_from_homepage') + suppress_from_homepage: this.get('suppress_from_homepage'), + allowed_tags: this.get('allowed_tags') }, type: this.get('id') ? 'PUT' : 'POST' }); diff --git a/app/assets/javascripts/discourse/templates/components/edit-category-tags.hbs b/app/assets/javascripts/discourse/templates/components/edit-category-tags.hbs new file mode 100644 index 00000000000..632690bedc2 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/edit-category-tags.hbs @@ -0,0 +1,4 @@ +
+

{{i18n 'category.tags_allowed_tags'}}

+ {{tag-chooser placeholderKey="category.tags_placeholder" tags=category.allowed_tags}} +
diff --git a/app/assets/javascripts/discourse/templates/composer.hbs b/app/assets/javascripts/discourse/templates/composer.hbs index 44c91b570c7..eb72ca673b3 100644 --- a/app/assets/javascripts/discourse/templates/composer.hbs +++ b/app/assets/javascripts/discourse/templates/composer.hbs @@ -98,7 +98,7 @@
{{plugin-outlet "composer-fields-below"}} {{#if canEditTags}} - {{tag-chooser tags=model.tags tabIndex="4"}} + {{tag-chooser tags=model.tags tabIndex="4" categoryId=model.categoryId}} {{/if}} {{i18n 'cancel'}} diff --git a/app/assets/javascripts/discourse/templates/modal/edit-category.hbs b/app/assets/javascripts/discourse/templates/modal/edit-category.hbs index 6cde3451daf..10282704c8f 100644 --- a/app/assets/javascripts/discourse/templates/modal/edit-category.hbs +++ b/app/assets/javascripts/discourse/templates/modal/edit-category.hbs @@ -7,6 +7,9 @@ {{edit-category-tab panels=panels selectedTab=selectedTab tab="settings"}} {{edit-category-tab panels=panels selectedTab=selectedTab tab="images"}} {{edit-category-tab panels=panels selectedTab=selectedTab tab="topic-template"}} + {{#if siteSettings.tagging_enabled}} + {{edit-category-tab panels=panels selectedTab=selectedTab tab="tags"}} + {{/if}}