Fetch available categories from the server
This commit is contained in:
parent
c05cce3af8
commit
c9885510f4
5 changed files with 18 additions and 5 deletions
|
@ -49,7 +49,8 @@ class SettingsController extends Controller {
|
|||
'id' => 'various',
|
||||
'showHidden' => (int)$this->settings->getUserValue($this->userId, $this->appName,'various_showHidden'),
|
||||
'startOfWeek' => (int)$this->settings->getUserValue($this->userId, $this->appName,'various_startOfWeek'),
|
||||
'userID' => $this->userId
|
||||
'userID' => $this->userId,
|
||||
'categories' => \OC_Calendar_App::getCategoryOptions()
|
||||
)
|
||||
);
|
||||
$result = array(
|
||||
|
|
|
@ -50,6 +50,13 @@ $timeout, $routeParams, SettingsModel, Loading) ->
|
|||
|
||||
@_$scope.settingsmodel = @_$settingsmodel
|
||||
|
||||
# workaroung till https://github.com/angular-ui/ui-select/issues/587
|
||||
# is resolved
|
||||
@_$scope.settingsmodel.add({
|
||||
'id': 'various',
|
||||
'categories': []
|
||||
})
|
||||
|
||||
@_$scope.isAddingComment = false
|
||||
|
||||
@_$scope.timers = []
|
||||
|
@ -319,8 +326,6 @@ $timeout, $routeParams, SettingsModel, Loading) ->
|
|||
input: t('tasks','Add a comment')
|
||||
}
|
||||
|
||||
@_$scope.availableCategories = []
|
||||
|
||||
@_$scope.addCategory = (category, model) ->
|
||||
_tasksbusinesslayer.addCategory(_$scope.route.taskID, category)
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ angular.module('Tasks').factory 'SettingsModel',
|
|||
@_nameCache[data.displayname] = data
|
||||
if angular.isDefined(data.id)
|
||||
super(data, clearCache)
|
||||
else
|
||||
@_data.push(data)
|
||||
|
||||
toggle: (type, setting) ->
|
||||
set = @getById(type)
|
||||
|
|
|
@ -491,6 +491,10 @@
|
|||
}
|
||||
});
|
||||
this._$scope.settingsmodel = this._$settingsmodel;
|
||||
this._$scope.settingsmodel.add({
|
||||
'id': 'various',
|
||||
'categories': []
|
||||
});
|
||||
this._$scope.isAddingComment = false;
|
||||
this._$scope.timers = [];
|
||||
this._$scope.durations = [
|
||||
|
@ -769,7 +773,6 @@
|
|||
input: t('tasks', 'Add a comment')
|
||||
};
|
||||
};
|
||||
this._$scope.availableCategories = [];
|
||||
this._$scope.addCategory = function(category, model) {
|
||||
return _tasksbusinesslayer.addCategory(_$scope.route.taskID, category);
|
||||
};
|
||||
|
@ -2110,6 +2113,8 @@
|
|||
this._nameCache[data.displayname] = data;
|
||||
if (angular.isDefined(data.id)) {
|
||||
return SettingsModel.__super__.add.call(this, data, clearCache);
|
||||
} else {
|
||||
return this._data.push(data);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
<ui-select multiple tagging tagging-label="<?php p($l->t('(New category)')); ?> " ng-model="task.categories" theme="select2" ng-disabled="disabled" style="width: 100%;"
|
||||
on-remove="removeCategory($item, $model)" on-select="addCategory($item, $model)">
|
||||
<ui-select-match placeholder="<?php p($l->t('Select categories...')); ?>">{{$item}}</ui-select-match>
|
||||
<ui-select-choices repeat="category in availableCategories">
|
||||
<ui-select-choices repeat="category in settingsmodel.getById('various').categories">
|
||||
{{category}}
|
||||
</ui-select-choices>
|
||||
</ui-select>
|
||||
|
|
Loading…
Reference in a new issue