Created
June 12, 2019 12:03
-
-
Save KevinJump/02ecd711a2d261c427a21243de9f7064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<umb-load-indicator ng-if="model.loading"></umb-load-indicator> | |
<umb-box ng-if="!model.loading"> | |
<umb-box-header title="Notifications" | |
description="Define who will get an email when key events occur (';' seperated lists)"> | |
</umb-box-header> | |
<umb-box-content> | |
<umb-control-group label="Pending Notifications" | |
description="Email addresses to notify"> | |
<input type="text" class="umb-textstring umb-property-editor" | |
ng-model="model.settings.Notify.Pending" /> | |
</umb-control-group> | |
<umb-control-group label="Submitted Notifications" | |
description="Email addresses to notify"> | |
<input type="text" class="umb-textstring umb-property-editor" | |
ng-model="model.settings.Notify.Submitted" /> | |
</umb-control-group> | |
<umb-control-group label="Received Notifications" | |
description="Email addresses to notify"> | |
<input type="text" class="umb-textstring umb-property-editor" | |
ng-model="model.settings.Notify.Received" /> | |
</umb-control-group> | |
<umb-control-group label="Approved Notifications" | |
description="Email addresses to notify"> | |
<input type="text" class="umb-textstring umb-property-editor" | |
ng-model="model.settings.Notify.Approved" /> | |
</umb-control-group> | |
</umb-box-content> | |
</umb-box> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-controller="translateSettingsViewController as vm"> | |
<umb-editor-view> | |
<umb-editor-header name="vm.page.title" | |
name-locked="true" | |
hide-alias="true" | |
hide-description="true" | |
hide-icon="true" | |
navigation="vm.page.navigation"></umb-editor-header> | |
<umb-editor-container class="form-horizontal"> | |
<umb-editor-sub-views sub-views="vm.page.navigation" model="vm"></umb-editor-sub-views> | |
</umb-editor-container> | |
<umb-editor-footer> | |
<umb-editor-footer-content-right> | |
<umb-button action="vm.saveSettings()" | |
type="button" | |
button-style="action" | |
state="vm.saveButtonState" | |
label="Save"></umb-button> | |
</umb-editor-footer-content-right> | |
</umb-editor-footer> | |
</umb-editor-view> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
function settingsController( | |
$scope, | |
notificationsService, | |
translateSettingsService) { | |
var vm = this; | |
vm.saveSettings = saveSettings; | |
vm.isValidLicence = isValidLicence; | |
vm.saveButtonState = 'init'; | |
vm.page = { | |
title: 'Translation Manager settings', | |
description: '', | |
navigation: [ | |
{ | |
'name': 'Settings', | |
'alias': 'settings', | |
'icon': 'icon-settings', | |
'view': Umbraco.Sys.ServerVariables.translationManager.Plugin + 'settings/settings.html', | |
'active': true | |
}, | |
{ | |
'name': 'licence', | |
'alias': 'licence', | |
'icon': 'icon-lock', | |
'view': Umbraco.Sys.ServerVariables.translationManager.Plugin + 'settings/licence.html' | |
}, | |
{ | |
'name': 'Notifications', | |
'alias': 'notifications', | |
'icon': 'icon-message', | |
'view': Umbraco.Sys.ServerVariables.translationManager.Plugin + 'settings/notifications.html' | |
}, | |
{ | |
'name': 'Diagnostics', | |
'alias': 'diagnostics', | |
'icon': 'icon-lab', | |
'view': Umbraco.Sys.ServerVariables.translationManager.Plugin + 'settings/diagnostics.html' | |
} | |
] | |
}; | |
init(); | |
//////////////////////// | |
function saveSettings() { | |
vm.saveButtonState = 'busy'; | |
translateSettingsService.saveSettings(vm.settings) | |
.then(function (result) { | |
notificationsService.success('Saved', 'Settings saved'); | |
vm.saveButtonState = 'success'; | |
getSettings(); | |
}, function (error) { | |
vm.saveButtonState = 'error'; | |
notificationsService.error('Error', error.data.ExceptionMessage); | |
}); | |
} | |
function isValidLicence() { | |
if (vm.settings.Licence.Key !== null && vm.settings.Licence.Key !== '') { | |
return vm.settings.Licence.Licenced && vm.settings.Licence.Valid; | |
} | |
return false; | |
} | |
//////////////////////// | |
function init() { | |
getSettings(); | |
} | |
function getSettings() { | |
vm.loading = true; | |
translateSettingsService.getSettings() | |
.then(function (result) { | |
vm.loading = false; | |
vm.settings = result.data; | |
}, function (error) { | |
vm.loading = false; | |
notificationsService.error('Error', error.data.ExceptionMessage); | |
}); | |
} | |
} | |
angular.module('umbraco') | |
.controller('translateSettingsViewController', settingsController); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment