New ng-module for common desktop widgets
This commit is contained in:
parent
391ebee218
commit
1c858e846d
|
@ -146,10 +146,12 @@
|
|||
</script>
|
||||
<script type="text/javascript" rsrc:src="js/vendor/underscore-min.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="js/vendor/angular.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="js/vendor/angular-animate.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="js/vendor/angular-sanitize.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="js/vendor/angular-ui-router.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="js/vendor/mm-foundation-tpls.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="js/Common/utils.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="js/Common/ui-desktop.js"><!-- space --></script>
|
||||
<var:if condition="hasProductSpecificJavaScript"><script type="text/javascript"
|
||||
var:src="productJavaScriptURL"><!-- space --></script></var:if>
|
||||
<var:if condition="hasPageSpecificJavaScript"><script type="text/javascript"
|
||||
|
|
64
UI/WebServerResources/js/Common/ui-desktop.js
Normal file
64
UI/WebServerResources/js/Common/ui-desktop.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* JavaScript for common UI services */
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/* Dialog */
|
||||
function Dialog() {
|
||||
}
|
||||
|
||||
Dialog.alert = function(title, content) {
|
||||
var modal = this.$modal.open({
|
||||
template:
|
||||
'<h2>{{title}}</h2>' +
|
||||
'<p>{{content}}</p>' +
|
||||
'<a class="button button-primary" ng-click="closeModal()">' + l('OK') + '</a>' +
|
||||
'<span class="close-reveal-modal" ng-click="closeModal()"><i class="icon-close"></i></span>',
|
||||
windowClass: 'small',
|
||||
controller: function($scope, $modalInstance) {
|
||||
$scope.title = title;
|
||||
$scope.content = content;
|
||||
$scope.closeModal = function() {
|
||||
$modalInstance.close();
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Dialog.confirm = function(title, content, callback) {
|
||||
var modal = this.$modal.open({
|
||||
template:
|
||||
'<h2>{{title}}</h2>' +
|
||||
'<p>{{content}}</p>' +
|
||||
'<a class="button button-primary" ng-click="confirm()">' + l('OK') + '</a>' +
|
||||
'<a class="button button-secondary" ng-click="closeModal()">' + l('Cancel') + '</a>' +
|
||||
'<span class="close-reveal-modal" ng-click="closeModal()"><i class="icon-close"></i></span>',
|
||||
windowClass: 'small',
|
||||
controller: function($scope, $modalInstance) {
|
||||
$scope.title = title;
|
||||
$scope.content = content;
|
||||
$scope.closeModal = function() {
|
||||
$modalInstance.close();
|
||||
};
|
||||
$scope.confirm = function() {
|
||||
callback();
|
||||
$modalInstance.close();
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* The factory we'll use to register with Angular */
|
||||
Dialog.$factory = ['$modal', function($modal) {
|
||||
angular.extend(Dialog, { $modal: $modal });
|
||||
|
||||
return Dialog; // return constructor
|
||||
}];
|
||||
|
||||
/* Angular module instanciation */
|
||||
angular.module('SOGo.UIDesktop', ['mm.foundation'])
|
||||
|
||||
/* Factory registration in Angular module */
|
||||
.factory('sgDialog', Dialog.$factory);
|
||||
})();
|
Loading…
Reference in a new issue