Admin dashboard: use ember's class name binding

This commit is contained in:
Neil Lalonde 2013-02-26 17:05:17 -05:00
parent cd6c1de5b0
commit 4e15227fd0
2 changed files with 3 additions and 21 deletions

View File

@ -1,7 +1,7 @@
<h3>{{i18n admin.dashboard.welcome}}</h3> <h3>{{i18n admin.dashboard.welcome}}</h3>
{{#if Discourse.SiteSettings.version_checks}} {{#if Discourse.SiteSettings.version_checks}}
<p {{bindAttr class="view.priorityClass"}}> <p {{bindAttr class=":version-check versionCheck.critical_updates:critical:normal"}}>
{{#if loading }} {{#if loading }}
{{i18n loading}} {{i18n loading}}
{{else}} {{else}}
@ -15,7 +15,7 @@
{{#if versionCheck.upToDate }} {{#if versionCheck.upToDate }}
<i class='icon icon-ok update-to-date'></i> {{i18n admin.dashboard.up_to_date}} <i class='icon icon-ok update-to-date'></i> {{i18n admin.dashboard.up_to_date}}
{{else}} {{else}}
<i {{bindAttr class="view.updateIconClasses"}}></i> <i {{bindAttr class=":icon :icon-warning-sign versionCheck.critical_updates:critical-updates-available:updates-available"}}></i>
<span class="critical-note">{{i18n admin.dashboard.critical_available}}</span> <span class="critical-note">{{i18n admin.dashboard.critical_available}}</span>
<span class="normal-note">{{i18n admin.dashboard.updates_available}}</span> <span class="normal-note">{{i18n admin.dashboard.updates_available}}</span>
{{i18n admin.dashboard.please_upgrade}} {{i18n admin.dashboard.please_upgrade}}

View File

@ -7,25 +7,7 @@
@module Discourse @module Discourse
**/ **/
Discourse.AdminDashboardView = Discourse.View.extend({ Discourse.AdminDashboardView = Discourse.View.extend({
templateName: 'admin/templates/dashboard', templateName: 'admin/templates/dashboard'
updateIconClasses: function() {
var classes;
classes = "icon icon-warning-sign ";
if (this.get('controller.versionCheck.critical_updates')) {
classes += "critical-updates-available";
} else {
classes += "updates-available";
}
return classes;
}.property('controller.versionCheck.critical_updates'),
priorityClass: function() {
if (this.get('controller.versionCheck.critical_updates')) {
return 'version-check critical';
}
return 'version-check normal';
}.property('controller.versionCheck.critical_updates')
}); });