diff --git a/background.css b/background.css index 9b7471c..dcba3c2 100644 --- a/background.css +++ b/background.css @@ -29,4 +29,16 @@ body, border: none; Background: none; box-shadow: none; +} + +tr.past_event { + color: #6F6F6F; +} + +tr.next_event { + color: #10AE00; +} + +tr.future_event { + color: #BBBBBB; } \ No newline at end of file diff --git a/index.html b/index.html index 4598c70..c5e8b68 100644 --- a/index.html +++ b/index.html @@ -37,15 +37,35 @@ Лекция + + Лектор + - {{#agenda}} - + {{#pastEvents}} + {{startTime.format('HH:mm')}} {{title}} + {{lecturer.name}} - {{/agenda}} + {{/pastEvents}} + + {{#nextEvent}} + + {{startTime.format('HH:mm')}} + {{title}} + {{lecturer.name}} + + {{/nextEvent}} + + {{#futureEvents}} + + {{startTime.format('HH:mm')}} + {{title}} + {{lecturer.name}} + + {{/futureEvents}} @@ -54,17 +74,17 @@ @@ -73,17 +93,17 @@ - {{#agenda.length}} + {{#eventCount}} {{> agenda_template}} - {{/agenda.length}} + {{/eventCount}} - {{#event}} + {{#nextEvent}} {{> next_lecture_template}} - {{/event}} + {{/nextEvent}} - {{#event.lecturer}} + {{#nextEvent.lecturer}} {{> next_lecturer_template}} - {{/event.lecturer}} + {{/nextEvent.lecturer}}

#PlovdivConf

diff --git a/reactive-init.js b/reactive-init.js index 2e95903..5508f1a 100644 --- a/reactive-init.js +++ b/reactive-init.js @@ -7,9 +7,15 @@ var reactive = new Ractive({ template: '#slides_template', // Here, we're passing in some initial data - data: {event: schedule.nextEvent(), agenda: schedule.getEvents()} + data: {pastEvents: schedule.pastEvents(), + nextEvent: schedule.nextEvent(), + futureEvents: schedule.futureEvents(), + eventCount: schedule.allEvents().length} }); function refreshEvent() { - reactive.set({event: schedule.nextEvent(), agenda: schedule.getEvents()}); + reactive.set({pastEvents: schedule.pastEvents(), + nextEvent: schedule.nextEvent(), + futureEvents: schedule.futureEvents(), + eventCount: schedule.allEvents().length}); } diff --git a/schedule.js b/schedule.js index 2da2825..2904eb4 100644 --- a/schedule.js +++ b/schedule.js @@ -18,7 +18,17 @@ function Schedule() { return _.first(this.upcomingEvents()); } - this.getEvents = function() { + this.futureEvents = function() { + return this.upcomingEvents().splice(1); + } + + this.pastEvents = function() { + return _.select(events, function(event) { + return event.startTime.isBefore(moment()); + }); + } + + this.allEvents = function() { return events; }