diff --git a/app/assets/javascripts/admin/components/admin-nav-item.js.es6 b/app/assets/javascripts/admin/components/admin-nav-item.js.es6 index aa1d33844c3..f5acc94a139 100644 --- a/app/assets/javascripts/admin/components/admin-nav-item.js.es6 +++ b/app/assets/javascripts/admin/components/admin-nav-item.js.es6 @@ -7,6 +7,12 @@ export default Ember.Component.extend({ }.property(), active: function() { - return this.get('router').isActive(this.get('route')); + const route = this.get('route'); + if (!route) { return; } + + const routeParam = this.get('routeParam'), + router = this.get('router'); + + return routeParam ? router.isActive(route, routeParam) : router.isActive(route); }.property('router.url', 'route') }); diff --git a/app/assets/javascripts/admin/templates/backups.hbs b/app/assets/javascripts/admin/templates/backups.hbs index e700cff02ed..bcd14fadd60 100644 --- a/app/assets/javascripts/admin/templates/backups.hbs +++ b/app/assets/javascripts/admin/templates/backups.hbs @@ -1,18 +1,31 @@
{{#if canRollback}} - + {{d-button action="rollback" + class="btn-rollback" + label="admin.backups.operations.rollback.text" + title="admin.backups.operations.rollback.title" + icon="ambulance" + disabled=rollbackDisabled}} {{/if}} {{#if isOperationRunning}} - + {{d-button action="cancelOperation" + class="btn-danger" + title="admin.backups.operations.cancel.title" + label="admin.backups.operations.cancel.text" + icon="times"}} {{else}} - + {{d-button action="startBackup" + class="btn-primary" + title="admin.backups.operations.backup.title" + label="admin.backups.operations.backup.text" + icon="rocket"}} {{/if}}
diff --git a/app/assets/javascripts/admin/templates/components/admin-nav-item.hbs b/app/assets/javascripts/admin/templates/components/admin-nav-item.hbs index 5ff04027b29..d6341fdce8f 100644 --- a/app/assets/javascripts/admin/templates/components/admin-nav-item.hbs +++ b/app/assets/javascripts/admin/templates/components/admin-nav-item.hbs @@ -1 +1,9 @@ -{{#link-to route}}{{i18n label}}{{/link-to}} +{{#if routeParam}} + {{#link-to route routeParam}}{{i18n label}}{{/link-to}} +{{else}} + {{#if route}} + {{#link-to route}}{{i18n label}}{{/link-to}} + {{else}} + {{i18n label}} + {{/if}} +{{/if}} diff --git a/app/assets/javascripts/admin/templates/components/admin-nav.hbs b/app/assets/javascripts/admin/templates/components/admin-nav.hbs new file mode 100644 index 00000000000..c5b1d3b58a7 --- /dev/null +++ b/app/assets/javascripts/admin/templates/components/admin-nav.hbs @@ -0,0 +1,7 @@ +
+
+ +
+
diff --git a/app/assets/javascripts/admin/templates/customize.hbs b/app/assets/javascripts/admin/templates/customize.hbs index ae7e0010fe8..75dcdbab9f6 100644 --- a/app/assets/javascripts/admin/templates/customize.hbs +++ b/app/assets/javascripts/admin/templates/customize.hbs @@ -1,14 +1,10 @@ -
-
- -
-
+{{#admin-nav}} + {{admin-nav-item route='adminCustomize.colors' label='admin.customize.colors.title'}} + {{admin-nav-item route='adminCustomize.css_html' label='admin.customize.css_html.title'}} + {{admin-nav-item route='adminSiteText' label='admin.site_text.title'}} + {{admin-nav-item route='adminUserFields' label='admin.user_fields.title'}} + {{admin-nav-item route='adminEmojis' label='admin.emoji.title'}} +{{/admin-nav}}
{{outlet}} diff --git a/app/assets/javascripts/admin/templates/email.hbs b/app/assets/javascripts/admin/templates/email.hbs index 40057afbe21..0ec147207e3 100644 --- a/app/assets/javascripts/admin/templates/email.hbs +++ b/app/assets/javascripts/admin/templates/email.hbs @@ -1,14 +1,10 @@ -
-
- -
-
+{{#admin-nav}} + {{admin-nav-item route='adminEmail.index' label='admin.email.settings'}} + {{admin-nav-item route='adminEmail.all' label='admin.email.all'}} + {{admin-nav-item route='adminEmail.sent' label='admin.email.sent'}} + {{admin-nav-item route='adminEmail.skipped' label='admin.email.skipped'}} + {{admin-nav-item route='adminEmail.previewDigest' label='admin.email.preview_digest'}} +{{/admin-nav}}
{{outlet}} diff --git a/app/assets/javascripts/admin/templates/flags.hbs b/app/assets/javascripts/admin/templates/flags.hbs index e99f63cfa52..a1ecf478755 100644 --- a/app/assets/javascripts/admin/templates/flags.hbs +++ b/app/assets/javascripts/admin/templates/flags.hbs @@ -1,11 +1,7 @@ -
-
- -
-
+{{#admin-nav}} + {{admin-nav-item route='adminFlags.list' routeParam='active' label='admin.flags.active'}} + {{admin-nav-item route='adminFlags.list' routeParam='old' label='admin.flags.old'}} +{{/admin-nav}}
{{outlet}} diff --git a/app/assets/javascripts/admin/templates/groups.hbs b/app/assets/javascripts/admin/templates/groups.hbs index 751e46323f2..0de3fc5c796 100644 --- a/app/assets/javascripts/admin/templates/groups.hbs +++ b/app/assets/javascripts/admin/templates/groups.hbs @@ -1,11 +1,8 @@ -
-
- -
-
+{{#admin-nav}} + {{admin-nav-item route='adminGroupsType' routeParam='custom' label='admin.groups.custom'}} + {{admin-nav-item route='adminGroupsType' routeParam='automatic' label='admin.groups.automatic'}} +{{/admin-nav}} +
{{outlet}}
diff --git a/app/assets/javascripts/admin/templates/logs.hbs b/app/assets/javascripts/admin/templates/logs.hbs index c85bb02d7cb..38654fefcad 100644 --- a/app/assets/javascripts/admin/templates/logs.hbs +++ b/app/assets/javascripts/admin/templates/logs.hbs @@ -1,14 +1,12 @@ -
-
- -
-
+{{#admin-nav}} + {{admin-nav-item route='adminLogs.staffActionLogs' label='admin.logs.staff_actions.title'}} + {{admin-nav-item route='adminLogs.screenedEmails' label='admin.logs.screened_emails.title'}} + {{admin-nav-item route='adminLogs.screenedIpAddresses' label='admin.logs.screened_ips.title'}} + {{admin-nav-item route='adminLogs.screenedUrls' label='admin.logs.screened_urls.title'}} + {{#if currentUser.admin}} + {{admin-nav-item href='/logs' label='admin.logs.logster.title'}} + {{/if}} +{{/admin-nav}}
{{outlet}} diff --git a/app/assets/javascripts/admin/templates/users_list.hbs b/app/assets/javascripts/admin/templates/users_list.hbs index 14032b4e203..bbc7709e5cf 100644 --- a/app/assets/javascripts/admin/templates/users_list.hbs +++ b/app/assets/javascripts/admin/templates/users_list.hbs @@ -1,19 +1,19 @@
- + {{d-button action="exportUsers" title="admin.export_csv.button_title.user" icon="download" label="admin.export_csv.button_text"}}
diff --git a/app/assets/javascripts/discourse/components/d-button.js.es6 b/app/assets/javascripts/discourse/components/d-button.js.es6 index 29bd2a5f1f4..21ebedc8e82 100644 --- a/app/assets/javascripts/discourse/components/d-button.js.es6 +++ b/app/assets/javascripts/discourse/components/d-button.js.es6 @@ -6,26 +6,31 @@ export default Ember.Component.extend({ attributeBindings: ['disabled', 'translatedTitle:title'], translatedTitle: function() { - var label = this.get('label'); + const title = this.get('title'); + return title ? I18n.t(title) : this.get('translatedLabel'); + }.property('title', 'translatedLabel'), + + translatedLabel: function() { + const label = this.get('label'); if (label) { return I18n.t(this.get('label')); } }.property('label'), - render: function(buffer) { - var title = this.get('translatedTitle'), - icon = this.get('icon'); + render(buffer) { + const label = this.get('translatedLabel'), + icon = this.get('icon'); - if (title || icon) { + if (label || icon) { if (icon) { buffer.push(iconHTML(icon) + ' '); } - if (title) { buffer.push(title); } + if (label) { buffer.push(label); } } else { // If no label or icon is present, yield return this._super(); } }, - click: function() { + click() { this.sendAction("action", this.get("actionParam")); } });