From be6e6dc129ee7d47bf372b6fd5034d1fd29b7a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 3 Sep 2015 00:22:25 +0200 Subject: [PATCH] UX: tidy up the category settings tab --- .../components/auto-close-form.js.es6 | 28 ++++--- .../components/edit-category-settings.hbs | 83 ++++++++++--------- .../stylesheets/common/base/compose.scss | 3 + 3 files changed, 64 insertions(+), 50 deletions(-) diff --git a/app/assets/javascripts/discourse/components/auto-close-form.js.es6 b/app/assets/javascripts/discourse/components/auto-close-form.js.es6 index fdad14df537..51669101067 100644 --- a/app/assets/javascripts/discourse/components/auto-close-form.js.es6 +++ b/app/assets/javascripts/discourse/components/auto-close-form.js.es6 @@ -1,25 +1,29 @@ +import computed from "ember-addons/ember-computed-decorators"; +import { observes } from "ember-addons/ember-computed-decorators"; + export default Ember.Component.extend({ autoCloseValid: false, limited: false, - autoCloseUnits: function() { - var key = this.get("limited") ? "composer.auto_close.limited.units" - : "composer.auto_close.all.units"; + @computed("limited") + autoCloseUnits(limited) { + const key = limited ? "composer.auto_close.limited.units" : "composer.auto_close.all.units"; return I18n.t(key); - }.property("limited"), + }, - autoCloseExamples: function() { - var key = this.get("limited") ? "composer.auto_close.limited.examples" - : "composer.auto_close.all.examples"; + @computed("limited") + autoCloseExamples(limited) { + const key = limited ? "composer.auto_close.limited.examples" : "composer.auto_close.all.examples"; return I18n.t(key); - }.property("limited"), + }, - _updateAutoCloseValid: function() { - var isValid = this._isAutoCloseValid(this.get("autoCloseTime"), this.get("limited")); + @observes("autoCloseTime", "limited") + _updateAutoCloseValid(autoCloseTime, limited) { + var isValid = this._isAutoCloseValid(autoCloseTime, limited); this.set("autoCloseValid", isValid); - }.observes("autoCloseTime", "limited"), + }, - _isAutoCloseValid: function(autoCloseTime, limited) { + _isAutoCloseValid(autoCloseTime, limited) { var t = (autoCloseTime || "").toString().trim(); if (t.length === 0) { // "empty" is always valid diff --git a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs index dd943f94944..722a9f5e1f8 100644 --- a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs +++ b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs @@ -1,54 +1,61 @@
{{auto-close-form autoCloseTime=category.auto_close_hours autoCloseBasedOnLastPost=category.auto_close_based_on_last_post + autoCloseExamples="" limited="true" }}
-
-
- {{input type="checkbox" checked=category.allow_badges}} - {{i18n 'category.allow_badges_label'}} -
-
-
- -
- -
- -
- {{#if showPositionInput}} - - {{text-field value=category.position class="position-input"}} - {{else}} - {{i18n 'category.position_disabled'}} - {{i18n 'category.position_disabled_click'}} - {{/if}} +
-
+{{#if emailInEnabled}} +
+ +
+
+ +
+{{/if}} + +{{#if showPositionInput}} +
+ +
+{{/if}} + +{{#unless emailInEnabled}} +
+ {{i18n 'category.email_in_disabled'}} + {{i18n 'category.email_in_disabled_click'}} +
+{{/unless}} + +{{#unless showPositionInput}} +
+ {{i18n 'category.position_disabled'}} + {{i18n 'category.position_disabled_click'}} +
+{{/unless}} + {{plugin-outlet "category-custom-settings"}} diff --git a/app/assets/stylesheets/common/base/compose.scss b/app/assets/stylesheets/common/base/compose.scss index 4ebe91a7eee..844a9e32d37 100644 --- a/app/assets/stylesheets/common/base/compose.scss +++ b/app/assets/stylesheets/common/base/compose.scss @@ -130,6 +130,9 @@ div.ac-wrap { input[type=text] { width: 50px; } + label { + font-size: .929em; + } } }