UNPKG

zettapi_client

Version:

Admin panel and client-side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project.

38 lines (34 loc) 1.09 kB
app.directive('zlCalendar', function () { return { restrict: 'E', scope: { calendarView: '=?', calendarTitle: '@' }, replace: false, templateUrl: 'directives/calendar/calendar.html', controller: function ($scope, $calendar) { $scope.calendarView = $scope.calendarView || 'month'; $scope.viewDate = new Date(); $scope.isCellOpen = true; $scope.eventTypes = $calendar.getEventTypes(); $scope.events = $calendar.getEvents(); $scope.toggleEventType = function (key) { $scope.eventTypes = $calendar.toggleEventType(key); $scope.events = $calendar.getEvents(); }; $scope.toggle = function ($event, field, event) { $event.preventDefault(); $event.stopPropagation(); event[field] = !event[field]; }; $scope.groupEvents = function (cell) { cell.groups = {}; cell.events.forEach(function (event) { cell.groups[event.type] = cell.groups[event.type] || []; cell.groups[event.type].push(event); }); }; } }; });