(js) Add "today" button to Calendar module
parent
957336b24c
commit
08fbc00d7a
|
@ -585,14 +585,18 @@
|
|||
|
||||
<!-- day/week/month views -->
|
||||
<md-toolbar class="view-detail" hide-sm="hide-sm">
|
||||
<div class="md-toolbar-tools" layout-align="end center">
|
||||
<a class="sg-icon-button md-button"
|
||||
<div class="md-toolbar-tools">
|
||||
<md-button class="md-icon-button"
|
||||
label:aria-label="Today"
|
||||
ng-click="app.today()"><md-icon>today</md-icon></md-button>
|
||||
<div class="md-flex"><!-- spacer --></div>
|
||||
<a class="md-icon-button md-button"
|
||||
label:aria-label="Day"
|
||||
href="#/calendar/day"><md-icon>view_day</md-icon></a>
|
||||
<a class="sg-icon-button md-button"
|
||||
<a class="md-icon-button md-button"
|
||||
label:aria-label="Week"
|
||||
href="#/calendar/week"><md-icon>view_week</md-icon></a>
|
||||
<a class="sg-icon-button md-button"
|
||||
<a class="md-icon-button md-button"
|
||||
label:aria-label="Month"
|
||||
href="#/calendar/month"><md-icon>view_module</md-icon></a>
|
||||
</div>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
CalendarsController.$inject = ['$scope', '$rootScope', '$stateParams', '$state', '$timeout', '$q', '$mdDialog', '$log', 'sgFocus', 'Dialog', 'sgSettings', 'Calendar', 'User', 'stateCalendars'];
|
||||
function CalendarsController($scope, $rootScope, $stateParams, $state, $timeout, $q, $mdDialog, $log, focus, Dialog, Settings, Calendar, User, stateCalendars) {
|
||||
CalendarsController.$inject = ['$scope', '$window', '$mdDialog', '$log', 'sgFocus', 'Dialog', 'sgSettings', 'Calendar', 'User', 'stateCalendars'];
|
||||
function CalendarsController($scope, $window, $mdDialog, $log, focus, Dialog, Settings, Calendar, User, stateCalendars) {
|
||||
var vm = this;
|
||||
|
||||
vm.activeUser = Settings.activeUser;
|
||||
|
@ -22,6 +22,7 @@
|
|||
vm.showLinks = showLinks;
|
||||
vm.showProperties = showProperties;
|
||||
vm.subscribeToFolder = subscribeToFolder;
|
||||
vm.today = today;
|
||||
|
||||
// Dispatch the event named 'calendars:list' when a calendar is activated or deactivated or
|
||||
// when the color of a calendar is changed
|
||||
|
@ -204,6 +205,15 @@
|
|||
Dialog.alert(l('Warning'), l('An error occured please try again.'));
|
||||
});
|
||||
}
|
||||
|
||||
function today() {
|
||||
var fragments = $window.location.hash.split('/'),
|
||||
state = fragments[1],
|
||||
view = fragments[2],
|
||||
now = new Date(),
|
||||
path = ['#', state, view, now.getDayString()];
|
||||
$window.location = path.join('/');
|
||||
}
|
||||
}
|
||||
|
||||
angular
|
||||
|
|
Loading…
Reference in New Issue