/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
(function() {
'use strict';
/*
* sgCalendarListEvent - An event block to be displayed in a list
* @memberof SOGo.SchedulerUI
* @restrict element
* @param {object} sgComponent - the Component object.
* @param {function} sgClick - the function to call when clicking on the event.
* Two variables are available: clickEvent (the event that triggered the mouse click),
* and clickComponent (a Component object)
*
* @example:
*/
sgCalendarListEvent.$inject = ['CalendarSettings'];
function sgCalendarListEvent(CalendarSettings) {
return {
restrict: 'E',
scope: {
component: '=sgComponent',
clickComponent: '&sgClick'
},
replace: true,
template: template,
link: link
};
function template(tElem, tAttrs) {
return [
'
',
// Categories color stripes
'
',
// Priority
'
',
// Summary
' {{ ::component.c_title }}',
'
',
// Component is reccurent
' ',
// Component has an alarm
' ',
// Component is confidential
' ',
// Component is private
' ',
' ',
// Time
'
',
' access_time ',
'
',
// Location
'
',
' place ',
'
',
'
'
].join('');
}
function link(scope, iElement, attrs) {
/**
* No data binding here since the view is completely redraw when
* a change is detected.
*/
if (scope.component.viewable)
iElement.addClass('md-clickable');
// Add class for user's participation state
if (scope.component.userstate)
iElement.addClass('sg-event--' + scope.component.userstate);
// Set background color
iElement.addClass('bg-folder' + scope.component.pid);
iElement.addClass('contrast-bdr-folder' + scope.component.pid);
// Add class for transparency
if (scope.component.c_isopaque === 0)
iElement.addClass('sg-event--transparent');
// Add class for cancelled event
if (scope.component.c_status === 0)
iElement.addClass('sg-event--cancelled');
}
}
angular
.module('SOGo.SchedulerUI')
.directive('sgCalendarListEvent', sgCalendarListEvent);
})();