From 132e984373f3dfa070318122b122dd146836931b Mon Sep 17 00:00:00 2001 From: Emmanuel Darnis Date: Mon, 6 Nov 2017 17:55:08 +0000 Subject: [PATCH] Code review --- ...odal.coffee => connect-addon-modal.coffee} | 22 ++++++++++++++----- .../connect-addon-modal.html | 4 ++-- .../views/apps/modals/app-connect-modal.less | 4 ---- .../apps/modals/app-settings-modal.coffee | 7 +----- 4 files changed, 20 insertions(+), 17 deletions(-) rename src/app/components/connect-addon-modal/{connec-addon-modal.coffee => connect-addon-modal.coffee} (67%) diff --git a/src/app/components/connect-addon-modal/connec-addon-modal.coffee b/src/app/components/connect-addon-modal/connect-addon-modal.coffee similarity index 67% rename from src/app/components/connect-addon-modal/connec-addon-modal.coffee rename to src/app/components/connect-addon-modal/connect-addon-modal.coffee index 1397186b..1baab43b 100644 --- a/src/app/components/connect-addon-modal/connec-addon-modal.coffee +++ b/src/app/components/connect-addon-modal/connect-addon-modal.coffee @@ -5,7 +5,7 @@ angular.module('mnoEnterpriseAngular').component('connectAddonModal', { dismiss: '&' }, templateUrl: 'app/components/connect-addon-modal/connect-addon-modal.html', - controller: (MnoeAppInstances, toastr, $filter) -> + controller: (MnoeAppInstances, toastr, $translate) -> ctrl = this @@ -19,6 +19,18 @@ angular.module('mnoEnterpriseAngular').component('connectAddonModal', { ctrl.historicalData = false ctrl.date = new Date() + $translate([ + 'mno_enterprise.templates.components.addon_connect.sync.sync_launched', + 'mno_enterprise.templates.components.addon_connect.link_account.submit_form', + 'mno_enterprise.templates.components.addon_connect.entities.update_entities', + 'mno_enterprise.templates.components.addon_connect.sync.start_sync', + ]).then((tls) -> + ctrl.syncLaunchedTl = tls['mno_enterprise.templates.components.addon_connect.sync.sync_launched'] + ctrl.submitTl = tls['mno_enterprise.templates.components.addon_connect.link_account.submit_form'] + ctrl.updateTl = tls['mno_enterprise.templates.components.addon_connect.entities.update_entities'] + ctrl.startSyncTl = tls['mno_enterprise.templates.components.addon_connect.sync.start_sync'] + ) + ctrl.$onInit = -> ctrl.app = ctrl.resolve.app ctrl.hasLinked = ctrl.app.addon_organization.has_account_linked @@ -57,15 +69,15 @@ angular.module('mnoEnterpriseAngular').component('connectAddonModal', { MnoeAppInstances.sync(ctrl.app, ctrl.historicalData) ctrl.app.addon_organization.sync_enabled = true ctrl.close() - toastr.success($filter('translate')("mno_enterprise.templates.components.addon_connect.sync.sync_launched")) + toastr.success(ctrl.syncLaunchedTl) ctrl.titleForButton = -> if !ctrl.hasLinked - $filter('translate')("mno_enterprise.templates.components.addon_connect.link_account.submit_form") + ctrl.submitTl else if !ctrl.hasChosenEntities - $filter('translate')("mno_enterprise.templates.components.addon_connect.entities.update_entities") + ctrl.updateTl else - $filter('translate')("mno_enterprise.templates.components.addon_connect.sync.start_sync") + ctrl.startSyncTl ctrl.callToAction = (connectForm, historicalData)-> if !ctrl.hasLinked diff --git a/src/app/components/connect-addon-modal/connect-addon-modal.html b/src/app/components/connect-addon-modal/connect-addon-modal.html index 4c01c979..89980de3 100644 --- a/src/app/components/connect-addon-modal/connect-addon-modal.html +++ b/src/app/components/connect-addon-modal/connect-addon-modal.html @@ -59,13 +59,13 @@

{{"mno_enterprise.templates.components.addon_connect.ent