allow for current (ongoing) events

This commit is contained in:
rolux 2011-05-26 20:18:20 +02:00
parent bd0f1e1ae3
commit 385aac008c
3 changed files with 15 additions and 1 deletions

View file

@ -49,8 +49,9 @@ Ox.load('UI', {debug: true, hideScreen: true, showScreen: true, theme: 'modern'}
{name: 'Julius Caesar', start: '-100-07-13', end: '-44-03-15', type: 'person'},
{name: 'Jesus Christ', start: '-5', end: '33', type: 'person'},
{name: 'Barbarossa', start: '1122', end: '1190-06-10', type: 'person'},
{name: 'Genghis Khan', start: '1162', end: '1228', type: 'person'},
{name: 'Genghis Khan', start: '1162-05-31', end: '1227-08-25', type: 'person'},
{name: 'Marco Polo', start: '1254', end: '1324-01-08', type: 'person'},
{name: 'Christopher Columbus', start: '1451-08-22', end: '1506-05-20', type: 'person'},
{name: 'Leonardo da Vinci', start: '1452-04-15', end: '1519-05-02', type: 'person'},
@ -208,6 +209,7 @@ Ox.load('UI', {debug: true, hideScreen: true, showScreen: true, theme: 'modern'}
{name: 'George W. Bush Presidency', start: '2001-01-20', end: '2009-01-20', type: 'other'},
{name: 'Carlo Giuliani', start: '2001-07-20', end: '2001-07-21', type: 'other'},
{name: '9-11', start: '2001-09-11', end: '2001-09-12', type: 'other'},
{name: 'Obama Presidency', start: '2009-01-20', end: '', type: 'other'},
{name: 'Fukushima', start: '2011-03-11', end: '2011-03-12', type: 'other'}
],

View file

@ -156,6 +156,10 @@ Calendar
background: -webkit-linear-gradient(top, rgba(255, 0, 0, 0.9), rgba(224, 0, 0, 0.9));
color: rgb(255, 255, 255);
}
.OxCalendar .OxLine > .OxEvent.OxCurrent {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.OxCalendar .OxLine > .OxEvent.OxDate {
background: -moz-linear-gradient(top, rgba(224, 0, 0, 0.9), rgba(192, 0, 0, 0.9));
background: -webkit-linear-gradient(top, rgba(224, 0, 0, 0.9), rgba(192, 0, 0, 0.9));

View file

@ -73,11 +73,18 @@ Ox.Calendar = function(options, self) {
});
self.options.events.forEach(function(event) {
if (!event.end) {
event.end = Ox.formatDate(new Date(), '%Y-%m-%d');
event.current = true;
}
event.id = Ox.isUndefined(event.id) ? Ox.uid() : event.id;
event.startTime = Ox.parseDate(event.start, true);
event.endTime = Ox.parseDate(event.end, true);
event.rangeText = Ox.formatDateRange(event.start, event.end, true);
event.durationText = Ox.formatDateRangeDuration(event.start, event.end, true);
if (event.current) {
event.rangeText = event.rangeText.split(' - ').shift() + ' - ...';
}
});
self.maxZoom = 32;
@ -554,6 +561,7 @@ Ox.Calendar = function(options, self) {
return new Ox.Element()
.addClass('OxEvent' +
(event.type ? ' Ox' + Ox.toTitleCase(event.type) : '' ) +
(event.current ? ' OxCurrent' : '') +
(event.id == self.options.selected ? ' OxSelected' : '')
)
.css({