mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-06 04:20:33 +00:00
Initial drag'n'drop support in Calendar module
TODO: - drag'n'drop in month's view; - drag to create an all-day event; - drag'n'drop to a calendar in the sidenav; - touchscreen gestures support.
This commit is contained in:
@@ -6,25 +6,31 @@
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
CalendarController.$inject = ['$scope', '$state', '$stateParams', '$timeout', '$interval', '$log', 'sgFocus', 'Calendar', 'Component', 'stateEventsBlocks'];
|
||||
function CalendarController($scope, $state, $stateParams, $timeout, $interval, $log, focus, Calendar, Component, stateEventsBlocks) {
|
||||
var vm = this;
|
||||
CalendarController.$inject = ['$scope', '$rootScope', '$state', '$stateParams', 'Calendar', 'Component', 'stateEventsBlocks'];
|
||||
function CalendarController($scope, $rootScope, $state, $stateParams, Calendar, Component, stateEventsBlocks) {
|
||||
var vm = this, deregisterCalendarsList;
|
||||
|
||||
vm.views = stateEventsBlocks;
|
||||
vm.changeView = changeView;
|
||||
|
||||
// Refresh current view when the list of calendars is modified
|
||||
$scope.$on('calendars:list', function() {
|
||||
deregisterCalendarsList = $rootScope.$on('calendars:list', updateView);
|
||||
|
||||
$scope.$on('$destroy', deregisterCalendarsList);
|
||||
|
||||
function updateView() {
|
||||
// See stateEventsBlocks in Scheduler.app.js
|
||||
Component.$eventsBlocksForView($stateParams.view, $stateParams.day.asDate()).then(function(data) {
|
||||
vm.views = data;
|
||||
_.forEach(vm.views, function(view) {
|
||||
if (view.id) {
|
||||
// Note: this can't be done in Component service since it would make Component dependent on
|
||||
// the Calendar service and create a circular dependency
|
||||
view.calendar = new Calendar({ id: view.id, name: view.calendarName });
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Change calendar's view
|
||||
function changeView($event) {
|
||||
|
||||
Reference in New Issue
Block a user