From e17ea2e787c31b17938d19ecc45e3ae83775494d Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 23 Apr 2015 14:50:06 -0400 Subject: [PATCH] UX: Show a dash if a version string is missing --- .../javascripts/admin/templates/dashboard.hbs | 2 +- .../admin/templates/version-checks.hbs | 72 ++++++++++++++++++ .../admin/templates/version_checks.hbs | 75 ------------------- .../discourse/helpers/dash-if-empty.js.es6 | 3 + 4 files changed, 76 insertions(+), 76 deletions(-) create mode 100644 app/assets/javascripts/admin/templates/version-checks.hbs delete mode 100644 app/assets/javascripts/admin/templates/version_checks.hbs create mode 100644 app/assets/javascripts/discourse/helpers/dash-if-empty.js.es6 diff --git a/app/assets/javascripts/admin/templates/dashboard.hbs b/app/assets/javascripts/admin/templates/dashboard.hbs index 0f06bf37828..f73a52b5cda 100644 --- a/app/assets/javascripts/admin/templates/dashboard.hbs +++ b/app/assets/javascripts/admin/templates/dashboard.hbs @@ -1,6 +1,6 @@
{{#if showVersionChecks}} - {{partial 'admin/templates/version_checks'}} + {{partial 'admin/templates/version-checks'}} {{/if}}
diff --git a/app/assets/javascripts/admin/templates/version-checks.hbs b/app/assets/javascripts/admin/templates/version-checks.hbs new file mode 100644 index 00000000000..1da45f3abcf --- /dev/null +++ b/app/assets/javascripts/admin/templates/version-checks.hbs @@ -0,0 +1,72 @@ +
+ + + {{custom-html 'upgrade-header'}} + + + + + + + {{#unless loading}} + + + + + {{#if versionCheck.noCheckPerformed}} + + + + {{else}} + {{#if versionCheck.staleData}} + + + + {{else}} + + + + {{/if}} + {{/if}} + + {{/unless}} +
 {{i18n 'admin.dashboard.installed_version'}}{{i18n 'admin.dashboard.latest_version'}}
{{i18n 'admin.dashboard.version'}}{{dash-if-empty versionCheck.installed_describe}} + + + {{i18n 'admin.dashboard.no_check_performed'}} + {{#if versionCheck.version_check_pending}}{{dash-if-empty versionCheck.installed_version}}{{/if}} + {{#if versionCheck.version_check_pending}} + {{fa-icon "smile-o"}} + {{else}} + {{fa-icon "frown-o"}} + {{/if}} + + + {{#if versionCheck.version_check_pending}} + {{i18n 'admin.dashboard.version_check_pending'}} + {{else}} + {{i18n 'admin.dashboard.stale_data'}} + {{/if}} + + {{dash-if-empty versionCheck.latest_version}} + {{#if versionCheck.upToDate }} + {{fa-icon "frown-o"}} + {{else}} + + {{#if versionCheck.behindByOneVersion}} + {{fa-icon "smile-o"}} + {{else}} + {{fa-icon "frown-o"}} + {{/if}} + + {{/if}} + + {{#if versionCheck.upToDate }} + {{i18n 'admin.dashboard.up_to_date'}} + {{else}} + {{i18n 'admin.dashboard.critical_available'}} + {{i18n 'admin.dashboard.updates_available'}} + {{i18n 'admin.dashboard.please_upgrade'}} + {{/if}} +
+
diff --git a/app/assets/javascripts/admin/templates/version_checks.hbs b/app/assets/javascripts/admin/templates/version_checks.hbs deleted file mode 100644 index 9148a4562d5..00000000000 --- a/app/assets/javascripts/admin/templates/version_checks.hbs +++ /dev/null @@ -1,75 +0,0 @@ - -
- - - {{custom-html 'upgrade-header'}} - - - - - - - - - {{#unless loading}} - - - - - {{#if versionCheck.noCheckPerformed}} - - - - {{else}} - {{#if versionCheck.staleData}} - - - - {{else}} - - - - {{/if}} - {{/if}} - - {{/unless}} -
 {{i18n 'admin.dashboard.installed_version'}}{{i18n 'admin.dashboard.latest_version'}}  
{{i18n 'admin.dashboard.version'}}{{ versionCheck.installed_describe }}  - - - {{i18n 'admin.dashboard.no_check_performed'}} - {{#if versionCheck.version_check_pending}}{{ versionCheck.installed_version }}{{/if}} - {{#if versionCheck.version_check_pending}} - - {{else}} - - {{/if}} - - - {{#if versionCheck.version_check_pending}} - {{i18n 'admin.dashboard.version_check_pending'}} - {{else}} - {{i18n 'admin.dashboard.stale_data'}} - {{/if}} - - {{ versionCheck.latest_version }} - {{#if versionCheck.upToDate }} - - {{else}} - - {{#if versionCheck.behindByOneVersion}} - ☺ - {{else}} - ☹ - {{/if}} - - {{/if}} - - {{#if versionCheck.upToDate }} - {{i18n 'admin.dashboard.up_to_date'}} - {{else}} - {{i18n 'admin.dashboard.critical_available'}} - {{i18n 'admin.dashboard.updates_available'}} - {{i18n 'admin.dashboard.please_upgrade'}} - {{/if}} -
-
diff --git a/app/assets/javascripts/discourse/helpers/dash-if-empty.js.es6 b/app/assets/javascripts/discourse/helpers/dash-if-empty.js.es6 new file mode 100644 index 00000000000..a018479e7de --- /dev/null +++ b/app/assets/javascripts/discourse/helpers/dash-if-empty.js.es6 @@ -0,0 +1,3 @@ +export default Ember.Handlebars.makeBoundHelper(function(str) { + return Ember.isEmpty(str) ? new Handlebars.SafeString('—') : str; +});