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

pull/214/head
Francis Lachapelle 2016-06-10 15:05:35 -04:00
parent d9d8a72651
commit ff4e50d904
3 changed files with 26 additions and 42 deletions

1
NEWS
View File

@ -3,6 +3,7 @@
Enhancements
- [web] always display name of month in week view (#3724)
- [web] use a speed dial (instead of a dialog) for card/list creation
Bug fixes
- [web] fixed generic avatar in lists (#3719)

View File

@ -436,12 +436,29 @@
md-mode="indeterminate"
md-diameter="32"><!-- progress --></md-progress-circular>
</div>
<md-button class="md-fab md-fab-bottom-right md-accent"
label:aria-label="New Contact"
ng-show="addressbook.selectedFolder.isOwned || addressbook.selectedFolder.acls.objectCreator"
ng-click="addressbook.newComponent($event)">
<md-icon>add</md-icon>
</md-button>
<md-fab-speed-dial
class="md-fling md-fab-bottom-right"
md-direction="up" md-open="false"
ng-cloak="ng-cloak"
ng-show="addressbook.selectedFolder.isOwned || addressbook.selectedFolder.acls.objectCreator">
<md-fab-trigger>
<md-button class="md-fab md-accent" label:aria-label="New Contact">
<md-icon>add</md-icon>
</md-button>
</md-fab-trigger>
<md-fab-actions>
<md-button var:aria-label="Contact" class="md-fab md-raised md-mini"
ng-click="addressbook.newComponent('card')">
<md-tooltip md-direction="left"><var:string label:value="Create a new address book card"/></md-tooltip>
<md-icon>person</md-icon>
</md-button>
<md-button var:aria-label="List" class="md-fab md-raised md-mini"
ng-click="addressbook.newComponent('list')">
<md-tooltip md-direction="left"><var:string label:value="Create a new list"/></md-tooltip>
<md-icon>group</md-icon>
</md-button>
</md-fab-actions>
</md-fab-speed-dial>
</md-content>
</div>

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() {