Skip to content

A platform for community discussion. Free, open, simple.

UX: Make Uncategorized category less confusing

Gerhard Schlagerccb48bef7554
diff --git a/app/assets/javascripts/discourse/components/edit-category-general.js.es6 b/app/assets/javascripts/discourse/components/edit-category-general.js.es6
index 79f0d9c092d..aa4b442e76d 100644
--- a/app/assets/javascripts/discourse/components/edit-category-general.js.es6
+++ b/app/assets/javascripts/discourse/components/edit-category-general.js.es6
@@ -9,6 +9,11 @@ export default buildCategoryPanel("general", {
canSelectParentCategory: Ember.computed.not(
"category.isUncategorizedCategory"
),
+ uncategorizedSiteSettingLink:
+ Discourse.BaseUri +
+ "/admin/site_settings/category/all_results?filter=allow_uncategorized_topics",
+ customizeTextContentLink:
+ Discourse.BaseUri + "/admin/customize/site_texts?q=uncategorized",
// background colors are available as a pipe-separated string
@computed
diff --git a/app/assets/javascripts/discourse/controllers/edit-category.js.es6 b/app/assets/javascripts/discourse/controllers/edit-category.js.es6
index cb0db1da427..d474c9b6e51 100644
--- a/app/assets/javascripts/discourse/controllers/edit-category.js.es6
+++ b/app/assets/javascripts/discourse/controllers/edit-category.js.es6
@@ -59,7 +59,6 @@ export default Ember.Controller.extend(ModalFunctionality, {
saveLabel: function() {
if (this.get("saving")) return "saving";
- if (this.get("model.isUncategorizedCategory")) return "save";
return this.get("model.id") ? "category.save" : "category.create";
}.property("saving", "model.id"),
diff --git a/app/assets/javascripts/discourse/templates/components/category-name-fields.hbs b/app/assets/javascripts/discourse/templates/components/category-name-fields.hbs
index e0766f48284..d6449d31362 100644
--- a/app/assets/javascripts/discourse/templates/components/category-name-fields.hbs
+++ b/app/assets/javascripts/discourse/templates/components/category-name-fields.hbs
@@ -1,8 +1,10 @@
<section class='field'>
- <section class="field-item">
- <label>{{i18n 'category.name'}}</label>
- {{text-field value=category.name placeholderKey="category.name_placeholder" maxlength="50"}}
- </section>
+ {{#unless category.isUncategorizedCategory}}
+ <section class="field-item">
+ <label>{{i18n 'category.name'}}</label>
+ {{text-field value=category.name placeholderKey="category.name_placeholder" maxlength="50"}}
+ </section>
+ {{/unless}}
<section class="field-item">
<label>{{i18n 'category.slug'}}</label>
{{text-field value=category.slug placeholderKey="category.slug_placeholder" maxlength="255"}}
diff --git a/app/assets/javascripts/discourse/templates/components/edit-category-general.hbs b/app/assets/javascripts/discourse/templates/components/edit-category-general.hbs
index 1c01b53db7f..03ae8badf4f 100644
--- a/app/assets/javascripts/discourse/templates/components/edit-category-general.hbs
+++ b/app/assets/javascripts/discourse/templates/components/edit-category-general.hbs
@@ -1,3 +1,10 @@
+{{#if category.isUncategorizedCategory}}
+ <p class="warning">
+ {{d-icon "warning"}}
+ {{{i18n 'category.uncategorized_general_warning' settingLink=uncategorizedSiteSettingLink customizeLink=customizeTextContentLink}}}
+ </p>
+{{/if}}
+
<form>
{{category-name-fields category=category tagName=""}}
diff --git a/app/assets/javascripts/discourse/templates/components/edit-category-security.hbs b/app/assets/javascripts/discourse/templates/components/edit-category-security.hbs
index ea241adae6f..a7efeec6e33 100644
--- a/app/assets/javascripts/discourse/templates/components/edit-category-security.hbs
+++ b/app/assets/javascripts/discourse/templates/components/edit-category-security.hbs
@@ -1,19 +1,25 @@
<section class='field'>
{{#if category.is_special}}
- <p class="warning">{{i18n 'category.special_warning'}}</p>
+ {{#if category.isUncategorizedCategory}}
+ <p class="warning">{{i18n 'category.uncategorized_security_warning'}}</p>
+ {{else}}
+ <p class="warning">{{i18n 'category.special_warning'}}</p>
+ {{/if}}
{{/if}}
- <ul class='permission-list'>
- {{#each category.permissions as |p|}}
- <li>
- <span class="name"><span class="badge-group">{{p.group_name}}</span></span>
- {{{i18n "category.can"}}}
- <span class="permission">{{p.permission.description}}</span>
- {{#if editingPermissions}}
- <a class="remove-permission" href {{action "removePermission" p}}>{{d-icon "times-circle"}}</a>
- {{/if}}
- </li>
- {{/each}}
- </ul>
+ {{#unless category.isUncategorizedCategory}}
+ <ul class='permission-list'>
+ {{#each category.permissions as |p|}}
+ <li>
+ <span class="name"><span class="badge-group">{{p.group_name}}</span></span>
+ {{{i18n "category.can"}}}
+ <span class="permission">{{p.permission.description}}</span>
+ {{#if editingPermissions}}
+ <a class="remove-permission" href {{action "removePermission" p}}>{{d-icon "times-circle"}}</a>
+ {{/if}}
+ </li>
+ {{/each}}
+ </ul>
+ {{/unless}}
{{#if editingPermissions}}
{{#if category.availableGroups}}
{{combo-box class="available-groups"
diff --git a/app/assets/javascripts/discourse/templates/modal/edit-category.hbs b/app/assets/javascripts/discourse/templates/modal/edit-category.hbs
index 675754b7cfe..d0029b0f73d 100644
--- a/app/assets/javascripts/discourse/templates/modal/edit-category.hbs
+++ b/app/assets/javascripts/discourse/templates/modal/edit-category.hbs
@@ -1,9 +1,7 @@
<div>
<ul class="nav nav-pills">
{{edit-category-tab panels=panels selectedTab=selectedTab tab="general"}}
- {{#unless model.isUncategorizedCategory}}
- {{edit-category-tab panels=panels selectedTab=selectedTab tab="security"}}
- {{/unless}}
+ {{edit-category-tab panels=panels selectedTab=selectedTab tab="security"}}
{{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"}}
diff --git a/app/serializers/basic_category_serializer.rb b/app/serializers/basic_category_serializer.rb
index 6be2df27ff1..806f0cc5594 100644
--- a/app/serializers/basic_category_serializer.rb
+++ b/app/serializers/basic_category_serializer.rb
@@ -35,8 +35,12 @@ class BasicCategorySerializer < ApplicationSerializer
parent_category_id
end
+ def name
+ object.uncategorized? ? I18n.t('uncategorized_category_name', locale: SiteSetting.default_locale) : object.name
+ end
+
def description
- object.uncategorized? ? I18n.t('category.uncategorized_description') : object.description
+ object.uncategorized? ? I18n.t('category.uncategorized_description', locale: SiteSetting.default_locale) : object.description
end
def can_edit
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 4ae368e72cf..b046ebd94e5 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -2390,6 +2390,8 @@ en:
already_used: "This color has been used by another category"
security: "Security"
special_warning: "Warning: This category is a pre-seeded category and the security settings cannot be edited. If you do not wish to use this category, delete it instead of repurposing it."
+ uncategorized_security_warning: "This category is special. It is intended as holding area for topics that have no category; it cannot have security settings."
+ uncategorized_general_warning: 'This category is special. It is used as the default category for new topics that do not have a category selected. If you want to prevent this behavior and force category selection, <a href="%{link}">please disable the setting here</a>. If you want to change the name or description, go to <a href="%{customizeLink}">Customize / Text Content</a>.'
images: "Images"
email_in: "Custom incoming email address:"
email_in_allow_strangers: "Accept emails from anonymous users with no accounts"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 66e1b5f8bcc..d1013cc4589 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -524,6 +524,8 @@ en:
word:
too_many: "Too many words for that action"
+ uncategorized_category_name: "Uncategorized"
+
vip_category_name: "Lounge"
vip_category_description: "A category exclusive to members with trust level 3 and higher."
@@ -590,7 +592,7 @@ en:
permission_conflict: "Subcategory permissions cannot be less restrictive than parent's."
disallowed_topic_tags: "This topic has tags not allowed by this category: '%{tags}'"
cannot_delete:
- uncategorized: "Can't delete Uncategorized"
+ uncategorized: "This category is special. It is intended as a holding area for topics that have no category; it cannot be deleted."
has_subcategories: "Can't delete this category because it has sub-categories."
topic_exists:
one: "Can't delete this category because it has 1 topic. Oldest topic is %{topic_link}."
diff --git a/db/migrate/20190304170931_migrate_uncategorized_category_name.rb b/db/migrate/20190304170931_migrate_uncategorized_category_name.rb
new file mode 100644
index 00000000000..cb9e1546b63
--- /dev/null
+++ b/db/migrate/20190304170931_migrate_uncategorized_category_name.rb
@@ -0,0 +1,10 @@
+class MigrateUncategorizedCategoryName < ActiveRecord::Migration[5.2]
+ def change
+ execute <<~SQL
+ INSERT INTO translation_overrides (locale, translation_key, value, created_at, updated_at)
+ SELECT '#{I18n.locale}', 'uncategorized_category_name', name, now(), now()
+ FROM categories
+ WHERE id = #{SiteSetting.uncategorized_category_id} AND LOWER(name) <> 'uncategorized';
+ SQL
+ end
+end