Some adjusting of calendar list sort order:

- All filters except Before default to sorting earlier events first  (start date asc)
- For all day events for the same date, non-blocking before blocking
This commit is contained in:
Nathan Gray 2016-04-20 16:52:52 +00:00
parent ac9ca13a8f
commit 80e935fb0b
2 changed files with 14 additions and 2 deletions

View File

@ -256,7 +256,7 @@ class calendar_uilist extends calendar_ui
if ($old_params['filter'] && $old_params['filter'] != $params['filter']) // filter changed => order accordingly
{
$params['order'] = 'cal_start';
$params['sort'] = $params['filter'] == 'after' ? 'ASC' : 'DESC';
$params['sort'] = $params['filter'] == 'before' ? 'DESC' : 'ASC';
}
if ($old_params['search'] != $params['search'])
{
@ -286,9 +286,12 @@ class calendar_uilist extends calendar_ui
'query' => $params['search'],
'offset' => (int) $params['start'],
'num_rows'=> $params['num_rows'],
'order' => $params['order'] ? $params['order'].' '.$params['sort'] : 'cal_start',
'order' => $params['order'] ? $params['order'].' '.$params['sort'] : 'cal_start ASC',
'cfs' => $params['csv_export'] ? array() : $cfs,
);
// Non-blocking events above blocking
$search_params['order'] .= ', cal_non_blocking DESC';
switch($params['filter'])
{
case 'all':

View File

@ -1217,6 +1217,15 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
if(filter)
{
app.calendar.state.filter = filter.getValue();
// Change sort order for before - this is just the UI, server does the query
if(app.calendar.state.filter == 'before')
{
view.getWidgetById('nm').sortBy('cal_start',false, false);
}
else
{
view.getWidgetById('nm').sortBy('cal_start',true, false);
}
}
else
{