(js,css) Show categories in events/tasks lists

This commit is contained in:
Francis Lachapelle
2015-11-17 12:22:06 -05:00
parent 2d6bdd37da
commit e4eef9b780
9 changed files with 46 additions and 19 deletions
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
CalendarsController.$inject = ['$rootScope', '$scope', '$window', '$mdDialog', '$log', '$mdToast', 'FileUploader', 'sgFocus', 'Dialog', 'sgSettings', 'Calendar', 'User', 'stateCalendars'];
function CalendarsController($rootScope, $scope, $window, $mdDialog, $log, $mdToast, FileUploader, focus, Dialog, Settings, Calendar, User, stateCalendars) {
CalendarsController.$inject = ['$rootScope', '$scope', '$window', '$mdDialog', '$log', '$mdToast', 'FileUploader', 'sgFocus', 'Dialog', 'sgSettings', 'Preferences', 'Calendar', 'User', 'stateCalendars'];
function CalendarsController($rootScope, $scope, $window, $mdDialog, $log, $mdToast, FileUploader, focus, Dialog, Settings, Preferences, Calendar, User, stateCalendars) {
var vm = this;
vm.activeUser = Settings.activeUser;
@@ -26,6 +26,15 @@
vm.subscribeToFolder = subscribeToFolder;
vm.today = today;
Preferences.ready().then(function() {
vm.categories = _.map(Preferences.defaults.SOGoCalendarCategories, function(name) {
return { id: name.asCSSIdentifier(),
name: name,
color: Preferences.defaults.SOGoCalendarCategoriesColors[name]
};
});
});
// Dispatch the event named 'calendars:list' when a calendar is activated or deactivated or
// when the color of a calendar is changed
$scope.$watch(
@@ -288,7 +288,6 @@
var componentData = _.object(this.eventsFields, eventData),
start = new Date(componentData.c_startdate * 1000);
componentData.hour = start.getHourString();
componentData.categories = _.invoke(componentData.c_category, 'asCSSIdentifier');
componentData.blocks = [];
objects.push(new Component(componentData));
return objects;
@@ -462,6 +461,9 @@
if (this.dueDate)
this.due = new Date(this.dueDate.substring(0,10) + ' ' + this.dueDate.substring(11,16));
if (this.c_category)
this.categories = _.invoke(this.c_category, 'asCSSIdentifier');
// Parse recurrence rule definition and initialize default values
this.$isRecurrent = angular.isDefined(data.repeat);
if (this.repeat.days) {
@@ -34,9 +34,9 @@
' ng-class="{\'sg-event--dragging\': block.dragging}">',
' <div class="eventInside" ng-click="clickBlock({clickEvent: $event, clickComponent: block.component})">',
// Categories color stripes
' <div class="category" ng-repeat="category in block.component.categories"',
' <div class="sg-category" ng-repeat="category in block.component.categories"',
' ng-class="\'bg-category\' + category"',
' ng-style="{ right: ($index * 10) + \'%\' }"></div>',
' ng-style="{ right: ($index * 3) + \'px\' }"></div>',
' <div class="text">{{ block.component.summary }}',
' <span class="icons">',
// Component is reccurent
@@ -23,9 +23,9 @@
'<div class="sg-event sg-event--ghost md-whiteframe-3dp ng-hide">',
' <div class="eventInside">',
// Categories color stripes
' <div class="category" ng-repeat="category in block.component.categories"',
' <div class="sg-category" ng-repeat="category in block.component.categories"',
' ng-class="\'bg-category\' + category"',
' ng-style="{ right: ($index * 10) + \'%\' }"></div>',
' ng-style="{ right: ($index * 3) + \'px\' }"></div>',
' <div class="text">{{ block.component.summary }}',
' <span class="icons">',
// Component is reccurent