Calendar module: add month view

This commit is contained in:
Francis Lachapelle
2015-06-12 11:44:35 -04:00
parent a2c469d46a
commit 8f47e62dd2
6 changed files with 137 additions and 34 deletions
+67 -1
View File
@@ -702,7 +702,6 @@
* @example:
<sg-calendar-day-block
class="event draggable"
ng-repeat="block in blocks[day]"
sg-block="block"/>
*/
@@ -730,6 +729,73 @@
iElement.addClass('starts' + scope.block.start);
iElement.addClass('lasts' + scope.block.length);
}
}])
/*
* sgCalendarMonthDay - Build list of blocks for a specific day in a month
* @memberof SOGo.UIDesktop
* @restrict element
* @param {object} sgBlocks - the events blocks definitions for the current view
* @param {string} sgDay - the day of the events to display
* @example:
<sg-calendar-monh-day
sg-blocks="calendar.blocks"
sg-day="20150408" />
*/
.directive('sgCalendarMonthDay', [function() {
return {
restrict: 'E',
scope: {
blocks: '=sgBlocks',
day: '@sgDay'
},
template:
'<sg-calendar-month-event' +
' ng-repeat="block in blocks[day]"' +
' sg-block="block"/>',
};
}])
/*
* sgCalendarMonthEvent - An event block to be displayed in a month
* @memberof SOGo.UIDesktop
* @restrict element
* @param {object} sgBlock - the event block definition
* @example:
<sg-calendar-month-event
ng-repeat="block in blocks[day]"
sg-block="block"/>
*/
.directive('sgCalendarMonthEvent', [function() {
return {
restrict: 'E',
scope: {
block: '=sgBlock'
},
replace: true,
template:
'<div class="event">' +
' <div>' +
' <div>' +
' <span ng-if="!block.component.c_isallday">{{ block.starthour }} - </span>' +
' {{ block.component.c_title }}<span class="icons">' +
' <i ng-if="block.component.c_nextalarm" class="md-icon-alarm"></i>' +
' <i ng-if="block.component.c_classification == 1" class="md-icon-visibility-off"></i>' +
' <i ng-if="block.component.c_classification == 2" class="md-icon-vpn-key"></i>' +
' </span>' +
' </div>' +
' </div>' +
' <div class="leftDragGrip"></div>' +
' <div class="rightDragGrip"></div>' +
'</div>',
link: link
};
function link(scope, iElement, attrs) {
iElement.addClass('calendarFolder' + scope.block.component.c_folder);
}
}]);
})();
+13 -1
View File
@@ -82,7 +82,7 @@ String.prototype.asDate = function () {
if (this.length == 8) {
newDate = new Date(this.substring(0, 4),
this.substring(4, 6) - 1,
this.substring(6, 8));
this.substring(6, 8)); // yyyymmdd
}
}
}
@@ -156,6 +156,18 @@ Date.prototype.beginOfWeek = function() {
return beginOfWeek;
};
Date.prototype.endOfWeek = function() {
var endOfWeek = this.beginOfWeek();
endOfWeek.addDays(6);
endOfWeek.setHours(23);
endOfWeek.setMinutes(59);
endOfWeek.setSeconds(59);
endOfWeek.setMilliseconds(999);
return endOfWeek;
};
// YYYYMMDD
Date.prototype.getDayString = function() {
var newString = this.getYear();