diff --git a/app/assets/javascripts/discourse/controllers/composer_controller.js b/app/assets/javascripts/discourse/controllers/composer_controller.js index b0940bea272..6b62f5bb670 100644 --- a/app/assets/javascripts/discourse/controllers/composer_controller.js +++ b/app/assets/javascripts/discourse/controllers/composer_controller.js @@ -42,6 +42,7 @@ Discourse.ComposerController = Discourse.Controller.extend({ if( composer.get('cantSubmitPost') ) { this.set('view.showTitleTip', true); + this.set('view.showCategoryTip', true); this.set('view.showReplyTip', true); return; } @@ -336,6 +337,7 @@ Discourse.ComposerController = Discourse.Controller.extend({ this.set('content', null); this.set('view.content', null); this.set('view.showTitleTip', false); + this.set('view.showCategoryTip', false); this.set('view.showReplyTip', false); }, diff --git a/app/assets/javascripts/discourse/models/composer.js b/app/assets/javascripts/discourse/models/composer.js index 68ceff6f64b..860c31ef2de 100644 --- a/app/assets/javascripts/discourse/models/composer.js +++ b/app/assets/javascripts/discourse/models/composer.js @@ -172,8 +172,10 @@ Discourse.Composer = Discourse.Model.extend({ // reply is always required if (this.get('replyLength') < Discourse.SiteSettings.min_post_length) return true; + if (!Discourse.SiteSettings.allow_uncategorized_topics && !this.get('categoryName')) return true; + return false; - }.property('loading', 'editTitle', 'titleLength', 'targetUsernames', 'replyLength'), + }.property('loading', 'editTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryName'), // The text for the save button saveText: function() { diff --git a/app/assets/javascripts/discourse/templates/composer.js.handlebars b/app/assets/javascripts/discourse/templates/composer.js.handlebars index aab1e64fed9..d96650b23d8 100644 --- a/app/assets/javascripts/discourse/templates/composer.js.handlebars +++ b/app/assets/javascripts/discourse/templates/composer.js.handlebars @@ -39,7 +39,10 @@ {{#unless content.creatingPrivateMessage}} - {{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" valueBinding="content.categoryName"}} +
+ {{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" valueBinding="content.categoryName" showUncategorized="true"}} + {{popupInputTip validation=view.categoryValidation show=view.showCategoryTip}} +
{{#if content.archetype.hasOptions}} {{/if}} diff --git a/app/assets/javascripts/discourse/views/combobox_view_category.js b/app/assets/javascripts/discourse/views/combobox_view_category.js index eea7101a886..d2ddfdeb08f 100644 --- a/app/assets/javascripts/discourse/views/combobox_view_category.js +++ b/app/assets/javascripts/discourse/views/combobox_view_category.js @@ -7,12 +7,15 @@ @module Discourse **/ Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({ - none: 'category.none', classNames: ['combobox category-combobox'], overrideWidths: true, dataAttributes: ['name', 'color', 'text_color', 'description', 'topic_count'], valueBinding: Ember.Binding.oneWay('source'), + none: function() { + if (Discourse.SiteSettings.allow_uncategorized_topics || this.get('showUncategorized')) return 'category.none'; + }.property('showUncategorized'), + template: function(text, templateData) { if (!templateData.color) return text; var result = "