Colorize the agenda

This commit is contained in:
Petko Bordjukov 2014-05-13 15:43:58 +03:00
parent d549e10af3
commit e22602ec63
4 changed files with 65 additions and 17 deletions

View File

@ -30,3 +30,15 @@ body,
Background: none; Background: none;
box-shadow: none; box-shadow: none;
} }
tr.past_event {
color: #6F6F6F;
}
tr.next_event {
color: #10AE00;
}
tr.future_event {
color: #BBBBBB;
}

View File

@ -37,15 +37,35 @@
<th> <th>
Лекция Лекция
</th> </th>
<th>
Лектор
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#agenda}} {{#pastEvents}}
<tr> <tr class="past_event">
<td>{{startTime.format('HH:mm')}}</td> <td>{{startTime.format('HH:mm')}}</td>
<td>{{title}}</td> <td>{{title}}</td>
<td>{{lecturer.name}}</td>
</tr> </tr>
{{/agenda}} {{/pastEvents}}
{{#nextEvent}}
<tr class="next_event">
<td>{{startTime.format('HH:mm')}}</td>
<td>{{title}}</td>
<td>{{lecturer.name}}</td>
</tr>
{{/nextEvent}}
{{#futureEvents}}
<tr class="future_event">
<td>{{startTime.format('HH:mm')}}</td>
<td>{{title}}</td>
<td>{{lecturer.name}}</td>
</tr>
{{/futureEvents}}
</tbody> </tbody>
</table> </table>
</section> </section>
@ -54,17 +74,17 @@
<script id="next_lecture_template" type="text/reactive"> <script id="next_lecture_template" type="text/reactive">
<section id="next-lecture"> <section id="next-lecture">
<h3>Следва</h3> <h3>Следва</h3>
<h1>{{event.title}}</h1> <h1>{{nextEvent.title}}</h1>
<p>{{event.description}}</p> <p>{{nextEvent.description}}</p>
<h4>({{event.startTime.fromNow()}})</h4> <h4>({{nextEvent.startTime.fromNow()}})</h4>
</section> </section>
</script> </script>
<script id="next_lecturer_template" type="text/reactive"> <script id="next_lecturer_template" type="text/reactive">
<section id="next-lecturer"> <section id="next-lecturer">
<h3>Лектор</h3> <h3>Лектор</h3>
<h1>{{event.lecturer.name}}</h1> <h1>{{nextEvent.lecturer.name}}</h1>
<p>{{event.lecturer.description}}</p> <p>{{nextEvent.lecturer.description}}</p>
</section> </section>
</script> </script>
@ -73,17 +93,17 @@
<img src="logo.svg"> <img src="logo.svg">
</section> </section>
{{#agenda.length}} {{#eventCount}}
{{> agenda_template}} {{> agenda_template}}
{{/agenda.length}} {{/eventCount}}
{{#event}} {{#nextEvent}}
{{> next_lecture_template}} {{> next_lecture_template}}
{{/event}} {{/nextEvent}}
{{#event.lecturer}} {{#nextEvent.lecturer}}
{{> next_lecturer_template}} {{> next_lecturer_template}}
{{/event.lecturer}} {{/nextEvent.lecturer}}
<section> <section>
<h1>#PlovdivConf</h1> <h1>#PlovdivConf</h1>

View File

@ -7,9 +7,15 @@ var reactive = new Ractive({
template: '#slides_template', template: '#slides_template',
// Here, we're passing in some initial data // 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() { 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});
} }

View File

@ -18,7 +18,17 @@ function Schedule() {
return _.first(this.upcomingEvents()); 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; return events;
} }