mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-05 08:34:30 +00:00
Desktop list editor, mobile contact editor
This commit is contained in:
@@ -4,15 +4,24 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/* Dialog */
|
||||
/**
|
||||
* @name Dialog (sgDialog factory in SOGo.UIDesktop)
|
||||
* @desc Dialog object constructor
|
||||
*/
|
||||
function Dialog() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name alert
|
||||
* @desc Show an alert dialog box with a single "OK" button
|
||||
* @param {string} title
|
||||
* @param {string} content
|
||||
*/
|
||||
Dialog.alert = function(title, content) {
|
||||
var modal = this.$modal.open({
|
||||
template:
|
||||
'<h2>{{title}}</h2>' +
|
||||
'<p>{{content}}</p>' +
|
||||
'<h2 data-ng-bind-html="title"></h2>' +
|
||||
'<p data-ng-bind-html="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',
|
||||
@@ -26,11 +35,20 @@
|
||||
});
|
||||
};
|
||||
|
||||
Dialog.confirm = function(title, content, callback) {
|
||||
/**
|
||||
* @name confirm
|
||||
* @desc Show a confirmation dialog box with buttons "Cancel" and "OK"
|
||||
* @param {string} title
|
||||
* @param {string} content
|
||||
* @returns a promise that always resolves, but returns true only if the user user has clicked on the
|
||||
* 'OK' button
|
||||
*/
|
||||
Dialog.confirm = function(title, content) {
|
||||
var d = this.$q.defer();
|
||||
var modal = this.$modal.open({
|
||||
template:
|
||||
'<h2>{{title}}</h2>' +
|
||||
'<p>{{content}}</p>' +
|
||||
'<h2 data-ng-bind-html="title"></h2>' +
|
||||
'<p data-ng-bind-html="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>',
|
||||
@@ -40,18 +58,20 @@
|
||||
$scope.content = content;
|
||||
$scope.closeModal = function() {
|
||||
$modalInstance.close();
|
||||
d.resolve(false);
|
||||
};
|
||||
$scope.confirm = function() {
|
||||
callback();
|
||||
$modalInstance.close();
|
||||
d.resolve(true);
|
||||
};
|
||||
}
|
||||
});
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
/* The factory we'll use to register with Angular */
|
||||
Dialog.$factory = ['$modal', function($modal) {
|
||||
angular.extend(Dialog, { $modal: $modal });
|
||||
Dialog.$factory = ['$modal', '$q', function($modal, $q) {
|
||||
angular.extend(Dialog, { $modal: $modal, $q: $q });
|
||||
|
||||
return Dialog; // return constructor
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user