diff options
Diffstat (limited to 'plugins/MobileMessaging/angularjs/delegate-mobile-messaging-settings/delegate-mobile-messaging-settings.controller.js')
-rw-r--r-- | plugins/MobileMessaging/angularjs/delegate-mobile-messaging-settings/delegate-mobile-messaging-settings.controller.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/MobileMessaging/angularjs/delegate-mobile-messaging-settings/delegate-mobile-messaging-settings.controller.js b/plugins/MobileMessaging/angularjs/delegate-mobile-messaging-settings/delegate-mobile-messaging-settings.controller.js new file mode 100644 index 0000000000..d7f6a9bfab --- /dev/null +++ b/plugins/MobileMessaging/angularjs/delegate-mobile-messaging-settings/delegate-mobile-messaging-settings.controller.js @@ -0,0 +1,39 @@ +/*! + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +(function () { + angular.module('piwikApp').controller('DelegateMobileMessagingSettingsController', DelegateMobileMessagingSettingsController); + + DelegateMobileMessagingSettingsController.$inject = ['piwikApi', 'piwik']; + + function DelegateMobileMessagingSettingsController(piwikApi, piwik) { + + var self = this; + this.isLoading = false; + + this.save = function () { + this.isLoading = true; + + piwikApi.post( + {method: 'MobileMessaging.setDelegatedManagement'}, + {delegatedManagement: (this.enabled == '1') ? 'true' : 'false'} + ).then(function () { + + var UI = require('piwik/UI'); + var notification = new UI.Notification(); + notification.show(_pk_translate('CoreAdminHome_SettingsSaveSuccess'), { + id: 'mobileMessagingSettings', context: 'success' + }); + notification.scrollToNotification(); + + piwik.helper.redirect(); + self.isLoading = false; + }, function () { + self.isLoading = false; + }); + }; + } +})();
\ No newline at end of file |