(js) Use a speed dial for event/task creation

pull/214/head
Francis Lachapelle 2016-06-10 16:50:21 -04:00
parent e4c6b83c33
commit d2869bed7f
3 changed files with 26 additions and 18 deletions

1
NEWS
View File

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

View File

@ -641,18 +641,28 @@
</md-tab> </md-tab>
</md-tabs> </md-tabs>
</md-content> </md-content>
<md-button class="md-fab md-fab-bottom-right" <md-fab-speed-dial
label:aria-label="Create a new event" class="md-fling md-fab-bottom-right"
ng-click="list.newComponent($event)" md-direction="up" md-open="false"
ng-if="list.componentType == 'events'"> ng-cloak="ng-cloak">
<md-icon >event</md-icon> <md-fab-trigger>
</md-button> <md-button class="md-fab md-accent" label:aria-label="New Event">
<md-button class="md-fab md-fab-bottom-right" <md-icon>add</md-icon>
label:aria-label="Create a new task" </md-button>
ng-click="list.newComponent($event)" </md-fab-trigger>
ng-if="list.componentType == 'tasks'"> <md-fab-actions>
<md-icon>assignment_turned_in</md-icon> <md-button var:aria-label="Create a new event" class="md-fab md-raised md-mini"
</md-button> ng-click="list.newComponent($event, 'appointment')">
<md-tooltip md-direction="left"><var:string label:value="Create a new event"/></md-tooltip>
<md-icon>event</md-icon>
</md-button>
<md-button var:aria-label="Create a new task" class="md-fab md-raised md-mini"
ng-click="list.newComponent($event, 'task')">
<md-tooltip md-direction="left"><var:string label:value="Create a new task"/></md-tooltip>
<md-icon>assignment_turned_in</md-icon>
</md-button>
</md-fab-actions>
</md-fab-speed-dial>
</div> </div>
<div id="detailView" class="view-detail hide show-gt-md md-default-theme md-background md-bg md-hue-2" <div id="detailView" class="view-detail hide show-gt-md md-default-theme md-background md-bg md-hue-2"
layout="column" ui-view="calendarView"> layout="column" ui-view="calendarView">

View File

@ -123,16 +123,13 @@
} }
} }
function newComponent($event, baseComponent) { function newComponent($event, type, baseComponent) {
var type = 'appointment', component; var component;
if (baseComponent) { if (baseComponent) {
component = baseComponent; component = baseComponent;
type = baseComponent.type;
} }
else { else {
if (vm.componentType == 'tasks')
type = 'task';
component = new Component({ pid: Calendar.$defaultCalendar(), type: type }); component = new Component({ pid: Calendar.$defaultCalendar(), type: type });
} }
@ -166,7 +163,7 @@
if (component.isAllDay) if (component.isAllDay)
coordinates.duration -= 96; coordinates.duration -= 96;
component.setDelta(coordinates.duration * 15); component.setDelta(coordinates.duration * 15);
newComponent(null, component).finally(function() { newComponent(null, 'appointment', component).finally(function() {
$timeout(function() { $timeout(function() {
Component.$resetGhost(); Component.$resetGhost();
}); });