FIX: Hide "error logs" logs from staff. Refactor admin menu HTML.

This commit is contained in:
Robin Ward 2015-02-11 11:53:06 -05:00
parent 38279c79c9
commit 282476fdf9
11 changed files with 93 additions and 71 deletions

View File

@ -7,6 +7,12 @@ export default Ember.Component.extend({
}.property(), }.property(),
active: function() { 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') }.property('router.url', 'route')
}); });

View File

@ -1,18 +1,31 @@
<div class="admin-controls"> <div class="admin-controls">
<div class="span15"> <div class="span15">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li>{{#link-to "admin.backups.index"}}{{i18n 'admin.backups.menu.backups'}}{{/link-to}}</li> {{admin-nav-item route='admin.backups.index' label='admin.backups.menu.backups'}}
<li>{{#link-to "admin.backups.logs"}}{{i18n 'admin.backups.menu.logs'}}{{/link-to}}</li> {{admin-nav-item route='admin.backups.logs' label='admin.backups.menu.logs'}}
</ul> </ul>
</div> </div>
<div class="pull-right"> <div class="pull-right">
{{#if canRollback}} {{#if canRollback}}
<button {{action "rollback"}} class="btn btn-rollback" title="{{i18n 'admin.backups.operations.rollback.title'}}" {{bind-attr disabled="rollbackDisabled"}}><i class="fa fa-ambulance fa-flip-horizontal"></i>{{i18n 'admin.backups.operations.rollback.text'}}</button> {{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}}
{{#if isOperationRunning}} {{#if isOperationRunning}}
<button {{action "cancelOperation"}} class="btn btn-danger" title="{{i18n 'admin.backups.operations.cancel.title'}}"><i class="fa fa-times"></i>{{i18n 'admin.backups.operations.cancel.text'}}</button> {{d-button action="cancelOperation"
class="btn-danger"
title="admin.backups.operations.cancel.title"
label="admin.backups.operations.cancel.text"
icon="times"}}
{{else}} {{else}}
<button {{action "startBackup"}} class="btn btn-primary" title="{{i18n 'admin.backups.operations.backup.title'}}"><i class="fa fa-rocket"></i>{{i18n 'admin.backups.operations.backup.text'}}</button> {{d-button action="startBackup"
class="btn-primary"
title="admin.backups.operations.backup.title"
label="admin.backups.operations.backup.text"
icon="rocket"}}
{{/if}} {{/if}}
</div> </div>
</div> </div>

View File

@ -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}}
<a href="{{unbound href}}" data-auto-route="true">{{i18n label}}</a>
{{/if}}
{{/if}}

View File

@ -0,0 +1,7 @@
<div class='admin-controls'>
<div class='span15'>
<ul class="nav nav-pills">
{{yield}}
</ul>
</div>
</div>

View File

@ -1,14 +1,10 @@
<div class='admin-controls'> {{#admin-nav}}
<div class='span15'> {{admin-nav-item route='adminCustomize.colors' label='admin.customize.colors.title'}}
<ul class="nav nav-pills"> {{admin-nav-item route='adminCustomize.css_html' label='admin.customize.css_html.title'}}
<li>{{#link-to 'adminCustomize.colors'}}{{i18n 'admin.customize.colors.title'}}{{/link-to}}</li> {{admin-nav-item route='adminSiteText' label='admin.site_text.title'}}
<li>{{#link-to 'adminCustomize.css_html'}}{{i18n 'admin.customize.css_html.title'}}{{/link-to}}</li> {{admin-nav-item route='adminUserFields' label='admin.user_fields.title'}}
<li>{{#link-to 'adminSiteText'}}{{i18n 'admin.site_text.title'}}{{/link-to}}</li> {{admin-nav-item route='adminEmojis' label='admin.emoji.title'}}
<li>{{#link-to 'adminUserFields'}}{{i18n 'admin.user_fields.title'}}{{/link-to}}</li> {{/admin-nav}}
<li>{{#link-to 'adminEmojis'}}{{i18n 'admin.emoji.title'}}{{/link-to}}</li>
</ul>
</div>
</div>
<div class="admin-container"> <div class="admin-container">
{{outlet}} {{outlet}}

View File

@ -1,14 +1,10 @@
<div class='admin-controls'> {{#admin-nav}}
<div class='span15'> {{admin-nav-item route='adminEmail.index' label='admin.email.settings'}}
<ul class="nav nav-pills"> {{admin-nav-item route='adminEmail.all' label='admin.email.all'}}
<li>{{#link-to 'adminEmail.index'}}{{i18n 'admin.email.settings'}}{{/link-to}}</li> {{admin-nav-item route='adminEmail.sent' label='admin.email.sent'}}
<li>{{#link-to 'adminEmail.all'}}{{i18n 'admin.email.all'}}{{/link-to}}</li> {{admin-nav-item route='adminEmail.skipped' label='admin.email.skipped'}}
<li>{{#link-to 'adminEmail.sent'}}{{i18n 'admin.email.sent'}}{{/link-to}}</li> {{admin-nav-item route='adminEmail.previewDigest' label='admin.email.preview_digest'}}
<li>{{#link-to 'adminEmail.skipped'}}{{i18n 'admin.email.skipped'}}{{/link-to}}</li> {{/admin-nav}}
<li>{{#link-to 'adminEmail.previewDigest'}}{{i18n 'admin.email.preview_digest'}}{{/link-to}}</li>
</ul>
</div>
</div>
<div class="admin-container"> <div class="admin-container">
{{outlet}} {{outlet}}

View File

@ -1,11 +1,7 @@
<div class='admin-controls'> {{#admin-nav}}
<div class='span15'> {{admin-nav-item route='adminFlags.list' routeParam='active' label='admin.flags.active'}}
<ul class="nav nav-pills"> {{admin-nav-item route='adminFlags.list' routeParam='old' label='admin.flags.old'}}
<li>{{#link-to 'adminFlags.list' 'active'}}{{i18n 'admin.flags.active'}}{{/link-to}}</li> {{/admin-nav}}
<li>{{#link-to 'adminFlags.list' 'old'}}{{i18n 'admin.flags.old'}}{{/link-to}}</li>
</ul>
</div>
</div>
<div class="admin-container"> <div class="admin-container">
{{outlet}} {{outlet}}

View File

@ -1,11 +1,8 @@
<div class="admin-controls"> {{#admin-nav}}
<div class="span15"> {{admin-nav-item route='adminGroupsType' routeParam='custom' label='admin.groups.custom'}}
<ul class="nav nav-pills"> {{admin-nav-item route='adminGroupsType' routeParam='automatic' label='admin.groups.automatic'}}
<li>{{#link-to "adminGroupsType" "custom"}}{{i18n 'admin.groups.custom'}}{{/link-to}}</li> {{/admin-nav}}
<li>{{#link-to "adminGroupsType" "automatic"}}{{i18n 'admin.groups.automatic'}}{{/link-to}}</li>
</ul>
</div>
</div>
<div class="admin-container"> <div class="admin-container">
{{outlet}} {{outlet}}
</div> </div>

View File

@ -1,14 +1,12 @@
<div class='admin-controls'> {{#admin-nav}}
<div class='span15'> {{admin-nav-item route='adminLogs.staffActionLogs' label='admin.logs.staff_actions.title'}}
<ul class="nav nav-pills"> {{admin-nav-item route='adminLogs.screenedEmails' label='admin.logs.screened_emails.title'}}
<li>{{#link-to 'adminLogs.staffActionLogs'}}{{i18n 'admin.logs.staff_actions.title'}}{{/link-to}}</li> {{admin-nav-item route='adminLogs.screenedIpAddresses' label='admin.logs.screened_ips.title'}}
<li>{{#link-to 'adminLogs.screenedEmails'}}{{i18n 'admin.logs.screened_emails.title'}}{{/link-to}}</li> {{admin-nav-item route='adminLogs.screenedUrls' label='admin.logs.screened_urls.title'}}
<li>{{#link-to 'adminLogs.screenedIpAddresses'}}{{i18n 'admin.logs.screened_ips.title'}}{{/link-to}}</li> {{#if currentUser.admin}}
<li>{{#link-to 'adminLogs.screenedUrls'}}{{i18n 'admin.logs.screened_urls.title'}}{{/link-to}}</li> {{admin-nav-item href='/logs' label='admin.logs.logster.title'}}
<li><a href="/logs" data-auto-route="true">{{i18n 'admin.logs.logster.title'}}</a></li> {{/if}}
</ul> {{/admin-nav}}
</div>
</div>
<div class="admin-container"> <div class="admin-container">
{{outlet}} {{outlet}}

View File

@ -1,19 +1,19 @@
<div class='admin-controls'> <div class='admin-controls'>
<div class='span15'> <div class='span15'>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li>{{#link-to 'adminUsersList.show' 'active'}}{{i18n 'admin.users.nav.active'}}{{/link-to}}</li> {{admin-nav-item route='adminUsersList.show' routeParam='active' label='admin.users.nav.active'}}
<li>{{#link-to 'adminUsersList.show' 'new'}}{{i18n 'admin.users.nav.new'}}{{/link-to}}</li> {{admin-nav-item route='adminUsersList.show' routeParam='new' label='admin.users.nav.new'}}
{{#if siteSettings.must_approve_users}} {{#if siteSettings.must_approve_users}}
<li>{{#link-to 'adminUsersList.show' 'pending'}}{{i18n 'admin.users.nav.pending'}}{{/link-to}}</li> {{admin-nav-item route='adminUsersList.show' routeParam='pending' label='admin.users.nav.pending'}}
{{/if}} {{/if}}
<li>{{#link-to 'adminUsersList.show' 'staff'}}{{i18n 'admin.users.nav.staff'}}{{/link-to}}</li> {{admin-nav-item route='adminUsersList.show' routeParam='staff' label='admin.users.nav.staff'}}
<li>{{#link-to 'adminUsersList.show' 'suspended'}}{{i18n 'admin.users.nav.suspended'}}{{/link-to}}</li> {{admin-nav-item route='adminUsersList.show' routeParam='suspended' label='admin.users.nav.suspended'}}
<li>{{#link-to 'adminUsersList.show' 'blocked'}}{{i18n 'admin.users.nav.blocked'}}{{/link-to}}</li> {{admin-nav-item route='adminUsersList.show' routeParam='blocked' label='admin.users.nav.blocked'}}
<li>{{#link-to 'adminUsersList.show' 'suspect'}}{{i18n 'admin.users.nav.suspect'}}{{/link-to}}</li> {{admin-nav-item route='adminUsersList.show' routeParam='suspect' label='admin.users.nav.suspect'}}
</ul> </ul>
</div> </div>
<div class="pull-right"> <div class="pull-right">
<button {{action "exportUsers"}} class="btn" title="{{i18n 'admin.export_csv.button_title.user'}}"><i class="fa fa-download"></i>{{i18n 'admin.export_csv.button_text'}}</button> {{d-button action="exportUsers" title="admin.export_csv.button_title.user" icon="download" label="admin.export_csv.button_text"}}
</div> </div>
</div> </div>

View File

@ -6,26 +6,31 @@ export default Ember.Component.extend({
attributeBindings: ['disabled', 'translatedTitle:title'], attributeBindings: ['disabled', 'translatedTitle:title'],
translatedTitle: function() { 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) { if (label) {
return I18n.t(this.get('label')); return I18n.t(this.get('label'));
} }
}.property('label'), }.property('label'),
render: function(buffer) { render(buffer) {
var title = this.get('translatedTitle'), const label = this.get('translatedLabel'),
icon = this.get('icon'); icon = this.get('icon');
if (title || icon) { if (label || icon) {
if (icon) { buffer.push(iconHTML(icon) + ' '); } if (icon) { buffer.push(iconHTML(icon) + ' '); }
if (title) { buffer.push(title); } if (label) { buffer.push(label); }
} else { } else {
// If no label or icon is present, yield // If no label or icon is present, yield
return this._super(); return this._super();
} }
}, },
click: function() { click() {
this.sendAction("action", this.get("actionParam")); this.sendAction("action", this.get("actionParam"));
} }
}); });