2015-05-06 04:06:13 +02:00
|
|
|
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngInject
|
|
|
|
*/
|
|
|
|
AddressBookController.$inject = ['$state', '$scope', '$rootScope', '$stateParams', '$timeout', '$mdDialog', 'sgFocus', 'Card', 'AddressBook', 'Dialog', 'sgSettings', 'stateAddressbooks', 'stateAddressbook'];
|
|
|
|
function AddressBookController($state, $scope, $rootScope, $stateParams, $timeout, $mdDialog, focus, Card, AddressBook, Dialog, Settings, stateAddressbooks, stateAddressbook) {
|
2015-05-06 23:46:58 +02:00
|
|
|
var currentAddressbook;
|
2015-05-06 04:06:13 +02:00
|
|
|
|
2015-05-06 23:46:58 +02:00
|
|
|
$rootScope.currentFolder = stateAddressbook;
|
|
|
|
$rootScope.card = null;
|
2015-05-06 04:06:13 +02:00
|
|
|
|
|
|
|
$scope.newComponent = function(ev) {
|
|
|
|
$mdDialog.show({
|
|
|
|
parent: angular.element(document.body),
|
|
|
|
targetEvent: ev,
|
|
|
|
clickOutsideToClose: true,
|
|
|
|
escapeToClose: true,
|
|
|
|
template: [
|
2015-05-06 23:46:58 +02:00
|
|
|
'<md-dialog aria-label="' + l('Create component') + '">',
|
2015-05-06 04:06:13 +02:00
|
|
|
' <md-content>',
|
|
|
|
' <div layout="column">',
|
2015-05-06 23:46:58 +02:00
|
|
|
' <md-button ng-click="create(\'card\')">',
|
2015-05-06 04:06:13 +02:00
|
|
|
' ' + l('Contact'),
|
|
|
|
' </md-button>',
|
2015-05-06 23:46:58 +02:00
|
|
|
' <md-button ng-click="create(\'list\')">',
|
2015-05-06 04:06:13 +02:00
|
|
|
' ' + l('List'),
|
|
|
|
' </md-button>',
|
|
|
|
' </div>',
|
|
|
|
' </md-content>',
|
|
|
|
'</md-dialog>'
|
|
|
|
].join(''),
|
|
|
|
locals: {
|
2015-05-06 23:46:58 +02:00
|
|
|
state: $state,
|
|
|
|
addressbookId: $scope.currentFolder.id
|
2015-05-06 04:06:13 +02:00
|
|
|
},
|
|
|
|
controller: ComponentDialogController
|
|
|
|
});
|
2015-05-06 23:46:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngInject
|
|
|
|
*/
|
|
|
|
ComponentDialogController.$inject = ['scope', '$mdDialog', 'state', 'addressbookId'];
|
|
|
|
function ComponentDialogController(scope, $mdDialog, state, addressbookId) {
|
|
|
|
scope.create = function(type) {
|
2015-05-06 04:06:13 +02:00
|
|
|
$mdDialog.hide();
|
2015-05-06 23:46:58 +02:00
|
|
|
state.go('app.addressbook.new', { addressbookId: addressbookId, contactType: type });
|
2015-05-06 04:06:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
angular
|
|
|
|
.module('SOGo.ContactsUI')
|
|
|
|
.controller('AddressBookController', AddressBookController);
|
|
|
|
})();
|