Add Site Setting allow_uncategorized_topics. Uncheck it to force people to choose a category for all new topics.
This commit is contained in:
parent
1313c0f094
commit
d26b87bd3c
|
@ -42,6 +42,7 @@ Discourse.ComposerController = Discourse.Controller.extend({
|
||||||
|
|
||||||
if( composer.get('cantSubmitPost') ) {
|
if( composer.get('cantSubmitPost') ) {
|
||||||
this.set('view.showTitleTip', true);
|
this.set('view.showTitleTip', true);
|
||||||
|
this.set('view.showCategoryTip', true);
|
||||||
this.set('view.showReplyTip', true);
|
this.set('view.showReplyTip', true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -336,6 +337,7 @@ Discourse.ComposerController = Discourse.Controller.extend({
|
||||||
this.set('content', null);
|
this.set('content', null);
|
||||||
this.set('view.content', null);
|
this.set('view.content', null);
|
||||||
this.set('view.showTitleTip', false);
|
this.set('view.showTitleTip', false);
|
||||||
|
this.set('view.showCategoryTip', false);
|
||||||
this.set('view.showReplyTip', false);
|
this.set('view.showReplyTip', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -172,8 +172,10 @@ Discourse.Composer = Discourse.Model.extend({
|
||||||
// reply is always required
|
// reply is always required
|
||||||
if (this.get('replyLength') < Discourse.SiteSettings.min_post_length) return true;
|
if (this.get('replyLength') < Discourse.SiteSettings.min_post_length) return true;
|
||||||
|
|
||||||
|
if (!Discourse.SiteSettings.allow_uncategorized_topics && !this.get('categoryName')) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}.property('loading', 'editTitle', 'titleLength', 'targetUsernames', 'replyLength'),
|
}.property('loading', 'editTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryName'),
|
||||||
|
|
||||||
// The text for the save button
|
// The text for the save button
|
||||||
saveText: function() {
|
saveText: function() {
|
||||||
|
|
|
@ -39,7 +39,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#unless content.creatingPrivateMessage}}
|
{{#unless content.creatingPrivateMessage}}
|
||||||
{{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" valueBinding="content.categoryName"}}
|
<div class="category-input">
|
||||||
|
{{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" valueBinding="content.categoryName" showUncategorized="true"}}
|
||||||
|
{{popupInputTip validation=view.categoryValidation show=view.showCategoryTip}}
|
||||||
|
</div>
|
||||||
{{#if content.archetype.hasOptions}}
|
{{#if content.archetype.hasOptions}}
|
||||||
<button class='btn' {{action showOptions}}>{{i18n topic.options}}</button>
|
<button class='btn' {{action showOptions}}>{{i18n topic.options}}</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -7,12 +7,15 @@
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({
|
Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({
|
||||||
none: 'category.none',
|
|
||||||
classNames: ['combobox category-combobox'],
|
classNames: ['combobox category-combobox'],
|
||||||
overrideWidths: true,
|
overrideWidths: true,
|
||||||
dataAttributes: ['name', 'color', 'text_color', 'description', 'topic_count'],
|
dataAttributes: ['name', 'color', 'text_color', 'description', 'topic_count'],
|
||||||
valueBinding: Ember.Binding.oneWay('source'),
|
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) {
|
template: function(text, templateData) {
|
||||||
if (!templateData.color) return text;
|
if (!templateData.color) return text;
|
||||||
var result = "<span class='badge-category' style='background-color: #" + templateData.color + '; color: #' +
|
var result = "<span class='badge-category' style='background-color: #" + templateData.color + '; color: #' +
|
||||||
|
|
|
@ -384,6 +384,12 @@ Discourse.ComposerView = Discourse.View.extend({
|
||||||
}
|
}
|
||||||
}.property('content.title'),
|
}.property('content.title'),
|
||||||
|
|
||||||
|
categoryValidation: function() {
|
||||||
|
if( !Discourse.SiteSettings.allow_uncategorized_topics && !this.get('content.categoryName')) {
|
||||||
|
return Discourse.InputValidation.create({ failed: true, reason: Em.String.i18n('composer.error.category_missing') });
|
||||||
|
}
|
||||||
|
}.property('content.categoryName'),
|
||||||
|
|
||||||
replyValidation: function() {
|
replyValidation: function() {
|
||||||
var reply = this.get('content.reply'), reason;
|
var reply = this.get('content.reply'), reason;
|
||||||
if( !reply || reply.length < 1 ){
|
if( !reply || reply.length < 1 ){
|
||||||
|
|
|
@ -322,14 +322,19 @@
|
||||||
bottom: 8px;
|
bottom: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.title-input {
|
.title-input, .category-input {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline;
|
display: inline;
|
||||||
.popup-tip {
|
}
|
||||||
width: 300px;
|
.title-input .popup-tip {
|
||||||
left: -8px;
|
width: 300px;
|
||||||
margin-top: 8px;
|
left: -8px;
|
||||||
}
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.category-input .popup-tip {
|
||||||
|
width: 240px;
|
||||||
|
left: 432px;
|
||||||
|
top: -7px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ class SiteSetting < ActiveRecord::Base
|
||||||
client_setting(:max_post_length, 16000)
|
client_setting(:max_post_length, 16000)
|
||||||
client_setting(:min_topic_title_length, 15)
|
client_setting(:min_topic_title_length, 15)
|
||||||
client_setting(:max_topic_title_length, 255)
|
client_setting(:max_topic_title_length, 255)
|
||||||
|
client_setting(:allow_uncategorized_topics, true)
|
||||||
client_setting(:min_search_term_length, 3)
|
client_setting(:min_search_term_length, 3)
|
||||||
client_setting(:flush_timings_secs, 5)
|
client_setting(:flush_timings_secs, 5)
|
||||||
client_setting(:supress_reply_directly_below, true)
|
client_setting(:supress_reply_directly_below, true)
|
||||||
|
|
|
@ -343,6 +343,7 @@ en:
|
||||||
title_length: "Title needs between {{min}} and {{max}} characters."
|
title_length: "Title needs between {{min}} and {{max}} characters."
|
||||||
post_missing: "Post can't be empty."
|
post_missing: "Post can't be empty."
|
||||||
post_length: "Post must be at least {{min}} characters long."
|
post_length: "Post must be at least {{min}} characters long."
|
||||||
|
category_missing: "You must choose a category."
|
||||||
|
|
||||||
save_edit: "Save Edit"
|
save_edit: "Save Edit"
|
||||||
reply_original: "Reply on Original Topic"
|
reply_original: "Reply on Original Topic"
|
||||||
|
|
|
@ -417,6 +417,7 @@ en:
|
||||||
min_topic_title_length: "Minimum topic title length in characters"
|
min_topic_title_length: "Minimum topic title length in characters"
|
||||||
max_topic_title_length: "Maximum topic title length in characters"
|
max_topic_title_length: "Maximum topic title length in characters"
|
||||||
min_search_term_length: "Minimum search term length in characters"
|
min_search_term_length: "Minimum search term length in characters"
|
||||||
|
allow_uncategorized_topics: "Allow topics to be created without a category"
|
||||||
allow_duplicate_topic_titles: "Allow topics with identical titles"
|
allow_duplicate_topic_titles: "Allow topics with identical titles"
|
||||||
unique_posts_mins: "How many minutes before a user can make a post with the same content again"
|
unique_posts_mins: "How many minutes before a user can make a post with the same content again"
|
||||||
enforce_global_nicknames: "Enforce global nickname uniqueness (WARNING: only change this during initial setup)"
|
enforce_global_nicknames: "Enforce global nickname uniqueness (WARNING: only change this during initial setup)"
|
||||||
|
|
Loading…
Reference in New Issue