(js) Use a speed dial for card/list creation

This commit is contained in:
Francis Lachapelle
2016-06-10 15:05:35 -04:00
parent d9d8a72651
commit ff4e50d904
3 changed files with 26 additions and 42 deletions

View File

@@ -40,42 +40,8 @@
$event.stopPropagation();
}
function newComponent(ev) {
$mdDialog.show({
parent: angular.element(document.body),
targetEvent: ev,
clickOutsideToClose: true,
escapeToClose: true,
template: [
'<md-dialog aria-label="' + l('Create component') + '">',
' <md-dialog-content>',
' <div layout="column">',
' <md-button ng-click="create(\'card\')">',
' ' + l('Contact'),
' </md-button>',
' <md-button ng-click="create(\'list\')">',
' ' + l('List'),
' </md-button>',
' </div>',
' </md-dialog-content>',
'</md-dialog>'
].join(''),
locals: {
addressbookId: vm.selectedFolder.id
},
controller: ComponentDialogController
});
/**
* @ngInject
*/
ComponentDialogController.$inject = ['scope', '$mdDialog', '$state', 'addressbookId'];
function ComponentDialogController(scope, $mdDialog, $state, addressbookId) {
scope.create = function(type) {
$mdDialog.hide();
$state.go('app.addressbook.new', { addressbookId: addressbookId, contactType: type });
};
}
function newComponent(type) {
$state.go('app.addressbook.new', { contactType: type });
}
function unselectCards() {