Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
manu-d committed Nov 14, 2017
1 parent 12d567b commit 132e984
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ <h4 class="text-center">{{"mno_enterprise.templates.components.addon_connect.ent
</ul>

<div class="modal-body">
<h4 class="text-center">Chose wether to synchronize historical data</h4>
<h4 class="text-center">{{"mno_enterprise.templates.components.addon_connect.sync.chose_historical" | translate}}</h4>

<div>
<p translate="mno_enterprise.templates.components.addon_connect.sync.warning_hisorical_html" translate-values="{appname: $ctrl.app.name}"></p>
<input ng-model="$ctrl.historicalData" type="checkbox" display=inline-block></input>
<small ng-show="!$ctrl.historicalData"
translate="mno_enterprise.templates.components.addon_connect.sync.historical_unchecked" translate-values="{date: ($ctrl.date | amDateFormat:'dddd, MMMM Do YYYY, h:mm:ss a')}">
translate="mno_enterprise.templates.components.addon_connect.sync.historical_unchecked" translate-values="{date: ($ctrl.date | amDateFormat:'LLL')}">
</small>
<small translate="mno_enterprise.templates.components.addon_connect.sync.historical_checked" translate-values="{appname: $ctrl.app.name}" ng-show="$ctrl.historicalData"></small>
</div>
Expand Down
4 changes: 0 additions & 4 deletions src/app/views/apps/modals/app-connect-modal.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@
ul.breadcrumb {
margin-bottom: 0px;
}

toast {
z-index: 9999;
}
}
7 changes: 1 addition & 6 deletions src/app/views/apps/modals/app-settings-modal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,7 @@ angular.module 'mnoEnterpriseAngular'
changeEntity: (model) ->
$scope.loadIdMaps(model)
getIndexFromValue: (value, array) ->
i = 0
for type in array
if type == value
return i
i++
return 0
_.indexOf(array ,value)

template: htmlTemplate
}
Expand Down

0 comments on commit 132e984

Please sign in to comment.