From 5f8004385749fae28249a61c25a8feac8d14cfde Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 9 Oct 2015 10:21:26 +1100 Subject: [PATCH] using translate filter instead of root scope function with parameters --- .../javascripts/darkswarm/filters/translate.js.coffee | 8 ++++---- .../javascripts/templates/registration/about.html.haml | 4 ++-- .../javascripts/templates/registration/contact.html.haml | 3 +-- .../javascripts/templates/registration/finished.html.haml | 6 ++---- .../javascripts/templates/registration/social.html.haml | 3 +-- .../javascripts/templates/registration/type.html.haml | 3 +-- 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/darkswarm/filters/translate.js.coffee b/app/assets/javascripts/darkswarm/filters/translate.js.coffee index d2fef7889a..55606da2cf 100644 --- a/app/assets/javascripts/darkswarm/filters/translate.js.coffee +++ b/app/assets/javascripts/darkswarm/filters/translate.js.coffee @@ -1,7 +1,7 @@ Darkswarm.filter "translate", -> - (key) -> - t(key) + (key, options) -> + t(key, options) Darkswarm.filter "t", -> - (key) -> - t(key) + (key, options) -> + t(key, options) diff --git a/app/assets/javascripts/templates/registration/about.html.haml b/app/assets/javascripts/templates/registration/about.html.haml index 7a0592799c..40d02e3d32 100644 --- a/app/assets/javascripts/templates/registration/about.html.haml +++ b/app/assets/javascripts/templates/registration/about.html.haml @@ -13,7 +13,7 @@ .row .small-12.columns .alert-box.info{ "ofn-inline-alert" => true, ng: { show: "visible" } } - %h6 {{t('enterprise_success', {enterprise: enterprise.name})}} + %h6{ "ng-bind" => "'enterprise_success' | t:{enterprise: enterprise.name}" } %span {{'enterprise_registration_exit_message' | t}} %a.close{ ng: { click: "close()" } } × @@ -28,7 +28,7 @@ .field %label{ for: 'enterprise_long_desc' } {{'enterprise_long_desc' | t}}: %textarea.chunky{ id: 'enterprise_long_desc', rows: 6, placeholder: "{{'enterprise_long_desc_placeholder' | t}}", ng: { model: 'enterprise.long_description' } } - %small {{t('enterprise_long_desc_length', {num: enterprise.long_description.length})}} + %small{ "ng-bind" => "'enterprise_long_desc_length' | t:{num: enterprise.long_description.length}" } .small-12.large-4.columns .row .small-12.columns diff --git a/app/assets/javascripts/templates/registration/contact.html.haml b/app/assets/javascripts/templates/registration/contact.html.haml index 1621b95a01..b2a2164910 100644 --- a/app/assets/javascripts/templates/registration/contact.html.haml +++ b/app/assets/javascripts/templates/registration/contact.html.haml @@ -4,8 +4,7 @@ .small-12.columns %header %h2 {{'registration_greeting' | t}} - %h5 - {{t('who_is_managing_enterprise', {enterprise: enterprise.name})}} + %h5{ "ng-bind" => "'who_is_managing_enterprise' | t:{enterprise: enterprise.name}" } %form{ name: 'contact', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "selectIfValid('type',contact)" } } .row.content diff --git a/app/assets/javascripts/templates/registration/finished.html.haml b/app/assets/javascripts/templates/registration/finished.html.haml index 1bf86d3ed5..5c7b3b6ad0 100644 --- a/app/assets/javascripts/templates/registration/finished.html.haml +++ b/app/assets/javascripts/templates/registration/finished.html.haml @@ -4,13 +4,11 @@ %header %h2 {{'registration_finished_headline' | t}} .panel.callout - %p - {{t('registration_finished_thanks', {enterprise: enterprise.name})}} + %p{ "ng-bind" => "'registration_finished_thanks' | t:{enterprise: enterprise.name}" } %p {{'registration_finished_login' | t}} .row .small-12.columns.text-center - %h4 - {{t('registration_finished_activate', {enterprise: enterprise.name})}} + %h4{ "ng-bind" => "'registration_finished_activate' | t:{enterprise: enterprise.name}" } %p{ "ng-bind-html" => "t('registration_finished_activate_instruction_html', {email: enterprise.email})"} diff --git a/app/assets/javascripts/templates/registration/social.html.haml b/app/assets/javascripts/templates/registration/social.html.haml index 553c801b4e..ac40ef9c56 100644 --- a/app/assets/javascripts/templates/registration/social.html.haml +++ b/app/assets/javascripts/templates/registration/social.html.haml @@ -5,8 +5,7 @@ .small-12.columns %header %h2 {{'enterprise_final_step' | t}} - %h5 - {{t('enterprise_social_text', {enterprise: enterprise.name})}} + %h5{ "ng-bind" => "'enterprise_social_text' | t:{enterprise: enterprise.name}" } %form{ name: 'social', novalidate: true, ng: { controller: "RegistrationFormCtrl", submit: "update('finished',social)" } } .row.content diff --git a/app/assets/javascripts/templates/registration/type.html.haml b/app/assets/javascripts/templates/registration/type.html.haml index f7b580e64c..c63b40239e 100644 --- a/app/assets/javascripts/templates/registration/type.html.haml +++ b/app/assets/javascripts/templates/registration/type.html.haml @@ -5,8 +5,7 @@ .row .small-12.columns %header - %h2 - {{t('registration_type_headline', {enterprise: enterprise.name})}} + %h2{ "ng-bind" => "'registration_type_headline' | t:{enterprise: enterprise.name}" } %h4 {{'registration_type_question' | t}}