コード例 #1
0
ファイル: calendar-view.js プロジェクト: andesk/platform
        createViewModel: function (eventModel) {
            var fcEvent = _.pick(
                    eventModel.attributes,
                    ['id', 'title', 'start', 'end', 'allDay', 'backgroundColor', 'calendarUid', 'editable']
                ),
                colors = this.colorManager.getCalendarColors(fcEvent.calendarUid);

            // set an event text and background colors the same as the owning calendar
            fcEvent.color = colors.backgroundColor;
            if (fcEvent.backgroundColor) {
                fcEvent.textColor = colorUtil.getContrastColor(fcEvent.backgroundColor);
            } else {
                fcEvent.textColor = colors.color;
            }

            if (fcEvent.start !== null && !moment.isMoment(fcEvent.start)) {
                fcEvent.start = $.fullCalendar.moment(fcEvent.start).tz(this.options.timezone);
            }
            if (fcEvent.end !== null && !moment.isMoment(fcEvent.end)) {
                fcEvent.end = $.fullCalendar.moment(fcEvent.end).tz(this.options.timezone);
            }

            if (fcEvent.end && fcEvent.end.diff(fcEvent.start) === 0) {
                fcEvent.end = null;
            }
            return fcEvent;
        },
コード例 #2
0
        createViewModel: function (eventModel) {
            var fcEvent = _.pick(
                    eventModel.attributes,
                    ['id', 'title', 'start', 'end', 'allDay', 'backgroundColor', 'calendarUid', 'editable']
                ),
                colors = this.colorManager.getCalendarColors(fcEvent.calendarUid);

            // set an event text and background colors the same as the owning calendar
            fcEvent.color = colors.backgroundColor;
            if (fcEvent.backgroundColor) {
                fcEvent.textColor = colorUtil.getContrastColor(fcEvent.backgroundColor);
            } else {
                fcEvent.textColor = colors.color;
            }

            this.applyTzCorrection(1, fcEvent);
            if (fcEvent.end && fcEvent.end.diff(fcEvent.start) === 0) {
                fcEvent.end = null;
            }
            return fcEvent;
        },