mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-14 21:04:53 +00:00
(js) New file structure for Angular modules
JavaScript files are now merged by the 'js' Grunt task.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
CalendarListController.$inject = ['$scope', '$rootScope', '$timeout', '$state', 'sgFocus', 'encodeUriFilter', 'Dialog', 'sgSettings', 'Calendar', 'Component', '$mdSidenav'];
|
||||
function CalendarListController($scope, $rootScope, $timeout, $state, focus, encodeUriFilter, Dialog, Settings, Calendar, Component, $mdSidenav) {
|
||||
var vm = this;
|
||||
|
||||
vm.component = Component;
|
||||
vm.componentType = null;
|
||||
vm.selectComponentType = selectComponentType;
|
||||
vm.newComponent = newComponent;
|
||||
// TODO: should reflect last state userSettings -> Calendar -> SelectedList
|
||||
vm.selectedList = 0;
|
||||
vm.selectComponentType('events');
|
||||
|
||||
// Switch between components tabs
|
||||
function selectComponentType(type, options) {
|
||||
if (options && options.reload || vm.componentType != type) {
|
||||
// TODO: save user settings (Calendar.SelectedList)
|
||||
Component.$filter(type);
|
||||
vm.componentType = type;
|
||||
}
|
||||
}
|
||||
|
||||
function newComponent() {
|
||||
var type = 'appointment';
|
||||
|
||||
if (vm.componentType == 'tasks')
|
||||
type = 'task';
|
||||
|
||||
$state.go('calendars.newComponent', { calendarId: 'personal', componentType: type });
|
||||
}
|
||||
|
||||
// Refresh current list when the list of calendars is modified
|
||||
$scope.$on('calendars:list', function() {
|
||||
Component.$filter(vm.componentType);
|
||||
});
|
||||
}
|
||||
|
||||
angular
|
||||
.module('SOGo.SchedulerUI')
|
||||
.controller('CalendarListController', CalendarListController);
|
||||
})();
|
||||
Reference in New Issue
Block a user