From c038758f8cfbd1227e566cb4487401d5da09f45f Mon Sep 17 00:00:00 2001 From: Kane York Date: Thu, 10 Sep 2015 13:42:10 -0700 Subject: [PATCH] FIX: Several fixes related to category reorder - Move "New Category" and "Reorder Categories" into a dropdown - Always show "New Topic" on categories page, even for admins - Make category reorder modal full-height (.full-height-modal) - Move category reorder stylesheet out of admin stylesheet --- .../categories-admin-dropdown.js.es6 | 37 +++++++++++ .../components/dropdown-button.js.es6 | 4 +- .../routes/discovery-categories.js.es6 | 3 +- .../templates/modal/reorder-categories.hbs | 66 +++++++++---------- .../templates/navigation/categories.hbs | 5 +- .../common/{admin => base}/cat_reorder.scss | 3 + app/assets/stylesheets/common/base/modal.scss | 3 + config/locales/client.en.yml | 3 +- 8 files changed, 80 insertions(+), 44 deletions(-) create mode 100644 app/assets/javascripts/discourse/components/categories-admin-dropdown.js.es6 rename app/assets/stylesheets/common/{admin => base}/cat_reorder.scss (92%) diff --git a/app/assets/javascripts/discourse/components/categories-admin-dropdown.js.es6 b/app/assets/javascripts/discourse/components/categories-admin-dropdown.js.es6 new file mode 100644 index 00000000000..ac53485198d --- /dev/null +++ b/app/assets/javascripts/discourse/components/categories-admin-dropdown.js.es6 @@ -0,0 +1,37 @@ +import { iconHTML } from 'discourse/helpers/fa-icon'; +import DropdownButton from 'discourse/components/dropdown-button'; +import computed from "ember-addons/ember-computed-decorators"; + +export default DropdownButton.extend({ + buttonExtraClasses: 'no-text', + title: '', + text: iconHTML('bars') + ' ' + iconHTML('caret-down'), + classNames: ['category-notification-menu', 'category-admin-menu'], + + @computed() + dropDownContent() { + const includeReorder = this.get('siteSettings.fixed_category_positions'); + const items = [ + { id: 'createCategory', + title: I18n.t('category.create'), + description: I18n.t('category.create_long'), + styleClasses: 'fa fa-plus' } + ]; + if (includeReorder) { + items.push({ + id: 'reorderCategories', + title: I18n.t('categories.reorder.title'), + description: I18n.t('categories.reorder.title_long'), + styleClasses: 'fa fa-random' + }); + } + return items; + }, + + // sendAction() is pretty silly if you ask me + actionFor_createCategory: 'createCategory', + actionFor_reorderCategories: 'reorderCategories', + clicked(id) { + this.sendAction('actionFor_' + id); + } +}); diff --git a/app/assets/javascripts/discourse/components/dropdown-button.js.es6 b/app/assets/javascripts/discourse/components/dropdown-button.js.es6 index 99d211bbe38..0037ec17f2a 100644 --- a/app/assets/javascripts/discourse/components/dropdown-button.js.es6 +++ b/app/assets/javascripts/discourse/components/dropdown-button.js.es6 @@ -29,9 +29,7 @@ export default Ember.Component.extend(StringBuffer, { buffer.push("

" + title + "

"); } - buffer.push(""); + buffer.push(``); buffer.push("