Skip to content

Commit

Permalink
Replace ternary operator and remove blank lines
Browse files Browse the repository at this point in the history
  • Loading branch information
manu-d committed Nov 22, 2017
1 parent b75a3a3 commit 04d0f38
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ angular.module('mnoEnterpriseAngular').component('connectAddonModal', {

ctrl.app = null
ctrl.model = {}
ctrl.currentStep = 0
ctrl.isFormLoading = true
ctrl.isSubmitting = false
ctrl.historicalData = false
ctrl.date = new Date()

ctrl.$onInit = ->
ctrl.app = ctrl.resolve.app
ctrl.currentStep = ctrl.app.addon_organization.has_account_linked ? 1 : 0
ctrl.currentStep = if ctrl.app.addon_organization.has_account_linked then 1 else 0
MnoeAppInstances.getForm(ctrl.app).then((response) ->
ctrl.schema = response.schema
ctrl.form = [ "*" ]
Expand Down
22 changes: 10 additions & 12 deletions src/app/components/connect-addon-modal/connect-addon-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
translate-values="{appname: $ctrl.app.name}"></h3>
</div>


<div>
<ul class="breadcrumb" ng-switch on="$ctrl.currentStep">
<li ng-switch-when="false|0" ng-switch-when-separator="|">{{"mno_enterprise.templates.components.addon_connect.link_account.title" | translate}}</li>
<li ng-switch-when="false|0" ng-switch-when-separator="|"><a href="#" class="not-active">{{"mno_enterprise.templates.components.addon_connect.entities.select" | translate}}</a></li>
<li ng-switch-when="false|0" ng-switch-when-separator="|"><a href="#" class="not-active">{{"mno_enterprise.templates.components.addon_connect.sync.start_sync" | translate}}</a></li>
<li ng-switch-when="0">{{"mno_enterprise.templates.components.addon_connect.link_account.title" | translate}}</li>
<li ng-switch-when="0"><a href="#" class="not-active">{{"mno_enterprise.templates.components.addon_connect.entities.select" | translate}}</a></li>
<li ng-switch-when="0"><a href="#" class="not-active">{{"mno_enterprise.templates.components.addon_connect.sync.start_sync" | translate}}</a></li>

<li ng-switch-when="true|1|2" ng-switch-when-separator="|"><a href="#" class="not-active">{{"mno_enterprise.templates.components.addon_connect.link_account.title" | translate}}</a></li>
<li ng-switch-when="true|1" ng-switch-when-separator="|">{{"mno_enterprise.templates.components.addon_connect.entities.select" | translate}}</li>
<li ng-switch-when="true|1" ng-switch-when-separator="|"><a href="#" ng-click="$ctrl.forceSelectEntities()">{{"mno_enterprise.templates.components.addon_connect.sync.start_sync" | translate}}</a></li>
<li ng-switch-when="1|2" ng-switch-when-separator="|"><a href="#" class="not-active">{{"mno_enterprise.templates.components.addon_connect.link_account.title" | translate}}</a></li>
<li ng-switch-when="1">{{"mno_enterprise.templates.components.addon_connect.entities.select" | translate}}</li>
<li ng-switch-when="1"><a href="#" ng-click="$ctrl.forceSelectEntities()">{{"mno_enterprise.templates.components.addon_connect.sync.start_sync" | translate}}</a></li>

<li ng-switch-when="2"><a href="#" ng-click="$ctrl.unselectEntities()">{{"mno_enterprise.templates.components.addon_connect.entities.select" | translate}}</a></li>
<li ng-switch-when="2">{{"mno_enterprise.templates.components.addon_connect.sync.start_sync" | translate}}</li>
Expand All @@ -36,12 +35,12 @@ <h4 class="text-center">{{"mno_enterprise.templates.components.addon_connect.ent

<table class="table-striped table-condensed" width="100%">
<tr>
<th>{{"mno_enterprise.templates.components.addon_connect.entities.entity" | translate}}&nbsp</th>
<th>{{"mno_enterprise.templates.components.addon_connect.entities.to_app" | translate:{ appname: $ctrl.app.app_name} }}&nbsp</th>
<th>{{"mno_enterprise.templates.components.addon_connect.entities.to_connec" | translate:{ appname: $ctrl.app.app_name} }}&nbsp</th>
<th>{{"mno_enterprise.templates.components.addon_connect.entities.entity" | translate}}</th>
<th>{{"mno_enterprise.templates.components.addon_connect.entities.to_app" | translate:{ appname: $ctrl.app.app_name} }}</th>
<th>{{"mno_enterprise.templates.components.addon_connect.entities.to_connec" | translate:{ appname: $ctrl.app.app_name} }}</th>
</tr>
<tr ng-repeat="entity in $ctrl.app.addon_organization.displayable_synchronized_entities">
<td>{{entity.connec_name}}&nbsp</td>
<td>{{entity.connec_name}}</td>
<td align="center"><input type="checkbox" ng-model="entity.can_push_to_external" checked="entity.can_push_to_external"/></td>
<td align="center"><input type="checkbox" ng-model="entity.can_push_to_connec" checked="entity.can_push_to_connec"/></td>
</tr>
Expand All @@ -63,7 +62,6 @@ <h4 class="text-center">{{"mno_enterprise.templates.components.addon_connect.syn
</div>
</div>


<div class="modal-footer">
<button class="btn btn-default" ng-click="$ctrl.close()">{{"mno_enterprise.webhook.o_auth.providers.cancel" | translate}}</button>
<button class="btn btn-success" ng-show="$ctrl.currentStep == 0" ng-disabled="$ctrl.isSubmitting" ng-click="$ctrl.submitForm()">
Expand Down
3 changes: 3 additions & 0 deletions src/app/views/apps/modals/app-settings-modal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ angular.module 'mnoEnterpriseAngular'
sort = "-#{sort}" if sortState.reverse
return sort

$scope.syncEnabled = ->
MnoeAppInstances.isAddOnWithOrg($scope.app) && $scope.app.addon_organization.sync_enabled

$scope.selectHistory = ->
$scope.selectedTab = 0

Expand Down
2 changes: 1 addition & 1 deletion src/app/views/apps/modals/app-settings-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h4 class="text-center" style="margin-bottom: 20px; margin-top: 20px">{{"mno_ent
</button>
<button class="btn btn-danger" ng-hide="app.showDelete" ng-click="app.showDelete = !app.showDelete">{{ 'mno_enterprise.templates.impac.dock.settings.delete' | translate }}</button>
<div class="pull-right">
<button class="btn btn-success" ng-if="selectedTab == 0" ng-click="syncApp()">{{"mno_enterprise.templates.impac.dock.settings.sync" | translate}}</button>
<button class="btn btn-success" ng-if="selectedTab == 0 && syncEnabled()" ng-click="syncApp()">{{"mno_enterprise.templates.impac.dock.settings.sync" | translate}}</button>
<button class="btn btn-success" ng-if="selectedTab == 2" ng-click="syncApp()">{{"mno_enterprise.templates.impac.dock.settings.entities.update" | translate}}</button>
</div>
</div>
Expand Down

0 comments on commit 04d0f38

Please sign in to comment.