Toolbar changes:

- Change Add button icon from new to +
- Add Today button to toolbar
This commit is contained in:
Nathan Gray 2016-01-21 18:41:54 +00:00
parent 01471c3d61
commit 0ae7ba40ce
2 changed files with 16 additions and 1 deletions

View File

@ -274,7 +274,7 @@ class calendar_uiviews extends calendar_ui
$actions = array(
'add' => array(
'caption' => 'Add',
'icon' => 'new',
'icon' => 'add',
'group' => ++$group,
'onExecute' => 'javaScript:app.calendar.toolbar_action',
'hint' => 'Add',
@ -380,6 +380,14 @@ class calendar_uiviews extends calendar_ui
'hint' => 'Previous',
'toolbarDefault' => true,
),
'today' => array(
'caption' => 'Today',
'icon' => 'today',
'group' => $group,
'onExecute' => 'javaScript:app.calendar.toolbar_action',
'hint' => 'Today',
'toolbarDefault' => true,
),
'next' => array(
'caption' => 'Next',
'icon' => 'next',

View File

@ -413,6 +413,13 @@ app.classes.calendar = AppJS.extend(
case 'weekend':
this.update_state({weekend: action.checked});
break;
case 'today':
var tempDate = new Date();
var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(),0,-tempDate.getTimezoneOffset(),0);
var change = {date: today.toJSON()};
if(app.calendar.state.view == 'planner') { change.planner_days = Math.ceil((new Date(app.calendar.state.last) - new Date(app.calendar.state.first)) / (24*3600000));}
app.calendar.update_state(change);
break;
case 'next':
case 'previous':
var delta = action.id == 'previous' ? -1 : 1;