mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-31 19:12:44 +00:00
Display all-day events in day & week views
All-day events are now displayed and the day/week views are now built using flexbox.
This commit is contained in:
@@ -10,13 +10,15 @@
|
||||
function CalendarController($scope, $state, $stateParams, $timeout, $interval, $log, focus, Calendar, Component, stateEventsBlocks) {
|
||||
var vm = this;
|
||||
|
||||
vm.blocks = stateEventsBlocks;
|
||||
vm.blocks = stateEventsBlocks.blocks;
|
||||
vm.allDayBlocks = stateEventsBlocks.allDayBlocks;
|
||||
vm.changeView = changeView;
|
||||
|
||||
// Refresh current view when the list of calendars is modified
|
||||
$scope.$on('calendars:list', function() {
|
||||
Component.$eventsBlocksForView($stateParams.view, $stateParams.day.asDate()).then(function(data) {
|
||||
vm.blocks = data;
|
||||
vm.blocks = data.blocks;
|
||||
vm.allDayBlocks = data.allDayBlocks;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
futureComponentData = this.$$resource.fetch(null, 'eventsblocks', params);
|
||||
futureComponentData.then(function(data) {
|
||||
Component.$timeout(function() {
|
||||
var components = [], blocks = {};
|
||||
var components = [], blocks = {}, allDayBlocks = {}, dates = [];
|
||||
|
||||
// Instantiate Component objects
|
||||
_.reduce(data.events, function(objects, eventData, i) {
|
||||
@@ -294,18 +294,35 @@
|
||||
block.component = components[block.nbr];
|
||||
});
|
||||
|
||||
// Convert array of blocks to object with days as keys
|
||||
// Associate Component objects to all-day blocks positions
|
||||
_.each(_.flatten(data.allDayBlocks), function(allDayBlock) {
|
||||
allDayBlock.component = components[allDayBlock.nbr];
|
||||
});
|
||||
|
||||
// Build array of dates
|
||||
for (i = 0; i < data.blocks.length; i++) {
|
||||
blocks[startDate.getDayString()] = data.blocks[i];
|
||||
dates.push(startDate.getDayString());
|
||||
startDate.addDays(1);
|
||||
}
|
||||
|
||||
Component.$log.debug('blocks ready (' + _.keys(blocks).length + ')');
|
||||
// Convert array of blocks to object with days as keys
|
||||
for (i = 0; i < data.blocks.length; i++) {
|
||||
blocks[dates[i]] = data.blocks[i];
|
||||
}
|
||||
|
||||
// Convert array of all-day blocks to object with days as keys
|
||||
for (i = 0; i < data.allDayBlocks.length; i++) {
|
||||
allDayBlocks[dates[i]] = data.allDayBlocks[i];
|
||||
}
|
||||
|
||||
Component.$log.debug('blocks ready (' + _.flatten(data.blocks).length + ')');
|
||||
Component.$log.debug('all day blocks ready (' + _.flatten(data.allDayBlocks).length + ')');
|
||||
|
||||
// Save the blocks to the object model
|
||||
Component.$blocks = blocks;
|
||||
Component.$allDayBlocks = allDayBlocks;
|
||||
|
||||
deferred.resolve(blocks);
|
||||
deferred.resolve({ blocks: blocks, allDayBlocks: allDayBlocks });
|
||||
});
|
||||
}, deferred.reject);
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
' </div>',
|
||||
' <div class="text">{{ block.component.c_title }}',
|
||||
' <span class="icons">',
|
||||
// Component has an alarm
|
||||
// Component has an alarm
|
||||
' <md-icon ng-if="block.component.c_nextalarm" class="material-icons icon-alarm"></md-icon>',
|
||||
// Component is confidential
|
||||
// Component is confidential
|
||||
' <md-icon ng-if="block.component.c_classification == 1" class="material-icons icon-visibility-off"></md-icon>',
|
||||
// Component is private
|
||||
// Component is private
|
||||
' <md-icon ng-if="block.component.c_classification == 2" class="material-icons icon-vpn-key"></md-icon>',
|
||||
' </span></div>',
|
||||
' </div>',
|
||||
|
||||
Reference in New Issue
Block a user