Store sort order on server
This commit is contained in:
parent
df50d3a8eb
commit
1a68446884
9 changed files with 40 additions and 36 deletions
|
@ -25,13 +25,13 @@
|
|||
|
||||
angular.module('Tasks').controller('TasksController', [
|
||||
'$scope', '$window', '$routeParams', 'TasksModel', 'ListsModel', 'CollectionsModel', 'TasksBusinessLayer', '$location',
|
||||
'SettingsBusinessLayer', 'SearchBusinessLayer', 'VTodo',
|
||||
'SettingsBusinessLayer', 'SearchBusinessLayer', 'VTodo', 'SettingsModel',
|
||||
function($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location,
|
||||
SettingsBusinessLayer, SearchBusinessLayer, VTodo) {
|
||||
SettingsBusinessLayer, SearchBusinessLayer, VTodo, SettingsModel) {
|
||||
var TasksController;
|
||||
TasksController = (function() {
|
||||
function TasksController(_$scope, _$window, _$routeParams, _$tasksmodel, _$listsmodel, _$collectionsmodel, _tasksbusinesslayer, $location,
|
||||
_settingsbusinesslayer, _searchbusinesslayer, vtodo) {
|
||||
_settingsbusinesslayer, _searchbusinesslayer, vtodo, _$settingsmodel) {
|
||||
var _this = this;
|
||||
this._$scope = _$scope;
|
||||
this._$window = _$window;
|
||||
|
@ -52,8 +52,7 @@
|
|||
this._$scope.focusInputField = false;
|
||||
this._$scope.TasksModel = this._$tasksmodel;
|
||||
this._$scope.TasksBusinessLayer = this._tasksbusinesslayer;
|
||||
this._$scope.sortOrder = 'default';
|
||||
this._$scope.sortDirection = false;
|
||||
this._$settingsmodel = _$settingsmodel;
|
||||
|
||||
this._$scope.addTask = function(taskName, related, calendar, parent) {
|
||||
var _ref, _this = this;
|
||||
|
@ -335,7 +334,7 @@
|
|||
};
|
||||
|
||||
this._$scope.getSortOrder = function() {
|
||||
switch (_$scope.sortOrder) {
|
||||
switch (_$scope.settingsmodel.getById('various').sortOrder) {
|
||||
case 'due':
|
||||
return _$scope.sortDue;
|
||||
case 'start':
|
||||
|
@ -353,8 +352,10 @@
|
|||
|
||||
this._$scope.setSortOrder = function($event, order) {
|
||||
$event.stopPropagation();
|
||||
_$scope.sortDirection = (_$scope.sortOrder === order) ? !_$scope.sortDirection : false;
|
||||
_$scope.sortOrder = order;
|
||||
_$scope.settingsmodel.getById('various').sortDirection = (_$scope.settingsmodel.getById('various').sortOrder === order) ? +!_$scope.settingsmodel.getById('various').sortDirection : 0;
|
||||
_$scope.settingsmodel.getById('various').sortOrder = order;
|
||||
_settingsbusinesslayer.set('various', 'sortOrder', order);
|
||||
_settingsbusinesslayer.set('various', 'sortDirection', _$scope.settingsmodel.getById('various').sortDirection);
|
||||
};
|
||||
|
||||
this._$scope.dropAsSubtask = function($event, item, index) {
|
||||
|
@ -419,7 +420,7 @@
|
|||
|
||||
})();
|
||||
return new TasksController($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location, SettingsBusinessLayer,
|
||||
SearchBusinessLayer, VTodo);
|
||||
SearchBusinessLayer, VTodo, SettingsModel);
|
||||
}
|
||||
]);
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ angular.module('Tasks').factory('Persistence', [
|
|||
routeParams: {
|
||||
type: type,
|
||||
setting: setting,
|
||||
value: +value
|
||||
value: value
|
||||
}
|
||||
};
|
||||
return this._request.post('/apps/tasks/settings/{type}/{setting}/{value}', params);
|
||||
|
|
|
@ -904,13 +904,13 @@ angular.module('Tasks').controller('SettingsController', [
|
|||
|
||||
angular.module('Tasks').controller('TasksController', [
|
||||
'$scope', '$window', '$routeParams', 'TasksModel', 'ListsModel', 'CollectionsModel', 'TasksBusinessLayer', '$location',
|
||||
'SettingsBusinessLayer', 'SearchBusinessLayer', 'VTodo',
|
||||
'SettingsBusinessLayer', 'SearchBusinessLayer', 'VTodo', 'SettingsModel',
|
||||
function($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location,
|
||||
SettingsBusinessLayer, SearchBusinessLayer, VTodo) {
|
||||
SettingsBusinessLayer, SearchBusinessLayer, VTodo, SettingsModel) {
|
||||
var TasksController;
|
||||
TasksController = (function() {
|
||||
function TasksController(_$scope, _$window, _$routeParams, _$tasksmodel, _$listsmodel, _$collectionsmodel, _tasksbusinesslayer, $location,
|
||||
_settingsbusinesslayer, _searchbusinesslayer, vtodo) {
|
||||
_settingsbusinesslayer, _searchbusinesslayer, vtodo, _$settingsmodel) {
|
||||
var _this = this;
|
||||
this._$scope = _$scope;
|
||||
this._$window = _$window;
|
||||
|
@ -931,8 +931,7 @@ angular.module('Tasks').controller('SettingsController', [
|
|||
this._$scope.focusInputField = false;
|
||||
this._$scope.TasksModel = this._$tasksmodel;
|
||||
this._$scope.TasksBusinessLayer = this._tasksbusinesslayer;
|
||||
this._$scope.sortOrder = 'default';
|
||||
this._$scope.sortDirection = false;
|
||||
this._$settingsmodel = _$settingsmodel;
|
||||
|
||||
this._$scope.addTask = function(taskName, related, calendar, parent) {
|
||||
var _ref, _this = this;
|
||||
|
@ -1214,7 +1213,7 @@ angular.module('Tasks').controller('SettingsController', [
|
|||
};
|
||||
|
||||
this._$scope.getSortOrder = function() {
|
||||
switch (_$scope.sortOrder) {
|
||||
switch (_$scope.settingsmodel.getById('various').sortOrder) {
|
||||
case 'due':
|
||||
return _$scope.sortDue;
|
||||
case 'start':
|
||||
|
@ -1232,8 +1231,10 @@ angular.module('Tasks').controller('SettingsController', [
|
|||
|
||||
this._$scope.setSortOrder = function($event, order) {
|
||||
$event.stopPropagation();
|
||||
_$scope.sortDirection = (_$scope.sortOrder === order) ? !_$scope.sortDirection : false;
|
||||
_$scope.sortOrder = order;
|
||||
_$scope.settingsmodel.getById('various').sortDirection = (_$scope.settingsmodel.getById('various').sortOrder === order) ? +!_$scope.settingsmodel.getById('various').sortDirection : 0;
|
||||
_$scope.settingsmodel.getById('various').sortOrder = order;
|
||||
_settingsbusinesslayer.set('various', 'sortOrder', order);
|
||||
_settingsbusinesslayer.set('various', 'sortDirection', _$scope.settingsmodel.getById('various').sortDirection);
|
||||
};
|
||||
|
||||
this._$scope.dropAsSubtask = function($event, item, index) {
|
||||
|
@ -1298,7 +1299,7 @@ angular.module('Tasks').controller('SettingsController', [
|
|||
|
||||
})();
|
||||
return new TasksController($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location, SettingsBusinessLayer,
|
||||
SearchBusinessLayer, VTodo);
|
||||
SearchBusinessLayer, VTodo, SettingsModel);
|
||||
}
|
||||
]);
|
||||
|
||||
|
@ -4328,7 +4329,7 @@ angular.module('Tasks').factory('Persistence', [
|
|||
routeParams: {
|
||||
type: type,
|
||||
setting: setting,
|
||||
value: +value
|
||||
value: value
|
||||
}
|
||||
};
|
||||
return this._request.post('/apps/tasks/settings/{type}/{setting}/{value}', params);
|
||||
|
|
|
@ -47,6 +47,8 @@ class SettingsService {
|
|||
'id' => 'various',
|
||||
'showHidden' => (int)$this->settings->getUserValue($this->userId, $this->appName,'various_showHidden'),
|
||||
'startOfWeek' => (int)$this->settings->getUserValue($this->userId, $this->appName,'various_startOfWeek'),
|
||||
'sortOrder' => (string)$this->settings->getUserValue($this->userId, $this->appName,'various_sortOrder'),
|
||||
'sortDirection' => (bool)$this->settings->getUserValue($this->userId, $this->appName,'various_sortDirection'),
|
||||
'userID' => $this->userId
|
||||
)
|
||||
);
|
||||
|
|
|
@ -167,46 +167,46 @@
|
|||
</div>
|
||||
<div class="app-navigation-entry-menu bubble sortorder-dropdown">
|
||||
<ul>
|
||||
<li ng-click="setSortOrder($event, 'default')" ng-class="{active: sortOrder == 'default'}" class="handler">
|
||||
<li ng-click="setSortOrder($event, 'default')" ng-class="{active: settingsmodel.getById('various').sortOrder == 'default'}" class="handler">
|
||||
<span>
|
||||
<span class="icon list-list"></span>
|
||||
<span><?php p($l->t('Default')); ?></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': sortDirection, 'icon-triangle-s': !sortDirection}"></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': settingsmodel.getById('various').sortDirection, 'icon-triangle-s': !settingsmodel.getById('various').sortDirection}"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-click="setSortOrder($event, 'due')" ng-class="{active: sortOrder == 'due'}">
|
||||
<li ng-click="setSortOrder($event, 'due')" ng-class="{active: settingsmodel.getById('various').sortOrder == 'due'}">
|
||||
<span>
|
||||
<span class="icon detail-date"></span>
|
||||
<span><?php p($l->t('Due date')); ?></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': sortDirection, 'icon-triangle-s': !sortDirection}"></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': settingsmodel.getById('various').sortDirection, 'icon-triangle-s': !settingsmodel.getById('various').sortDirection}"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-click="setSortOrder($event, 'start')" ng-class="{active: sortOrder == 'start'}">
|
||||
<li ng-click="setSortOrder($event, 'start')" ng-class="{active: settingsmodel.getById('various').sortOrder == 'start'}">
|
||||
<span>
|
||||
<span class="icon detail-start"></span>
|
||||
<span><?php p($l->t('Start date')); ?></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': sortDirection, 'icon-triangle-s': !sortDirection}"></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': settingsmodel.getById('various').sortDirection, 'icon-triangle-s': !settingsmodel.getById('various').sortDirection}"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-click="setSortOrder($event, 'priority')" ng-class="{active: sortOrder == 'priority'}">
|
||||
<li ng-click="setSortOrder($event, 'priority')" ng-class="{active: settingsmodel.getById('various').sortOrder == 'priority'}">
|
||||
<span>
|
||||
<span class="icon detail-priority"></span>
|
||||
<span><?php p($l->t('Priority')); ?></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': sortDirection, 'icon-triangle-s': !sortDirection}"></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': settingsmodel.getById('various').sortDirection, 'icon-triangle-s': !settingsmodel.getById('various').sortDirection}"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-click="setSortOrder($event, 'alphabetically')" ng-class="{active: sortOrder == 'alphabetically'}">
|
||||
<li ng-click="setSortOrder($event, 'alphabetically')" ng-class="{active: settingsmodel.getById('various').sortOrder == 'alphabetically'}">
|
||||
<span>
|
||||
<span class="icon sort-alphabetically"></span>
|
||||
<span><?php p($l->t('Alphabetically')); ?></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': sortDirection, 'icon-triangle-s': !sortDirection}"></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': settingsmodel.getById('various').sortDirection, 'icon-triangle-s': !settingsmodel.getById('various').sortDirection}"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-click="setSortOrder($event, 'manual')" ng-class="{active: sortOrder == 'manual'}">
|
||||
<li ng-click="setSortOrder($event, 'manual')" ng-class="{active: settingsmodel.getById('various').sortOrder == 'manual'}">
|
||||
<span>
|
||||
<span class="icon sort-manual"></span>
|
||||
<span><?php p($l->t('Manually')); ?></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': sortDirection, 'icon-triangle-s': !sortDirection}"></span>
|
||||
<span class="sort-indicator" ng-class="{'icon-triangle-n': settingsmodel.getById('various').sortDirection, 'icon-triangle-s': !settingsmodel.getById('various').sortDirection}"></span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<li class="task-item ui-draggable handler"
|
||||
taskID="{{task.uri}}"
|
||||
ng-animate="'animate'"
|
||||
ng-repeat="task in filtered = filteredTasks() | filter:hasNoParent(task) | filter:filterTasks(task,calendar.uri) | filter:filterTasks(task,route.collectionID) | orderBy:getSortOrder():sortDirection"
|
||||
ng-repeat="task in filtered = filteredTasks() | filter:hasNoParent(task) | filter:filterTasks(task,calendar.uri) | filter:filterTasks(task,route.collectionID) | orderBy:getSortOrder():settingsmodel.getById('various').sortDirection"
|
||||
ng-click="openDetails(task.uri,$event)"
|
||||
ng-class="{done: task.completed}"
|
||||
dnd-draggable="task"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<li class="task-item ui-draggable handler"
|
||||
taskID="{{task.uri}}"
|
||||
ng-animate="'animate'"
|
||||
ng-repeat="task in filtered = filteredTasks() | filter:taskAtDay(task,day) | filter:hasNoParent(task) | filter:{'completed':'false'} | orderBy:getSortOrder():sortDirection"
|
||||
ng-repeat="task in filtered = filteredTasks() | filter:taskAtDay(task,day) | filter:hasNoParent(task) | filter:{'completed':'false'} | orderBy:getSortOrder():settingsmodel.getById('various').sortDirection"
|
||||
ng-click="openDetails(task.uri,$event)"
|
||||
ng-class="{done: task.completed}"
|
||||
dnd-draggable="task"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</li>
|
||||
<li taskID="{{ task.uri }}"
|
||||
class="task-item ui-draggable handler subtask"
|
||||
ng-repeat="task in getSubTasks(filtered,task) | orderBy:getSortOrder():sortDirection"
|
||||
ng-repeat="task in getSubTasks(filtered,task) | orderBy:getSortOrder():settingsmodel.getById('various').sortDirection"
|
||||
ng-click="openDetails(task.uri,$event)"
|
||||
ng-class="{done: task.completed}"
|
||||
ng-include="'part.taskbody'"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
dnd-dragover="dragover(event, index)">
|
||||
<li class="task-item ui-draggable handler"
|
||||
taskID="{{ task.uri }}"
|
||||
ng-repeat="task in filtered = filteredTasks() | filter:hasNoParent(task) | filter:filterTasks(task,route.calendarID) | filter:{'completed':'false'} | orderBy:getSortOrder():sortDirection"
|
||||
ng-repeat="task in filtered = filteredTasks() | filter:hasNoParent(task) | filter:filterTasks(task,route.calendarID) | filter:{'completed':'false'} | orderBy:getSortOrder():settingsmodel.getById('various').sortDirection"
|
||||
ng-click="openDetails(task.uri,$event)"
|
||||
ng-class="{done: task.completed}"
|
||||
dnd-draggable="task"
|
||||
|
|
Loading…
Reference in a new issue