Add a slide for the current talk

This commit is contained in:
Petko Bordjukov 2014-06-21 05:08:15 +03:00
parent 23d276b812
commit dd3207b060
3 changed files with 36 additions and 0 deletions

View File

@ -58,6 +58,22 @@
</section> </section>
</script> </script>
<script id="current_talk_template" type="text/ractive">
<section id="current_talk">
<h3>В момента</h3>
<h1>{{currentEvent.title}}</h1>
<p>{{currentEvent.description}}</p>
</section>
</script>
<script id="current_speaker_template" type="text/ractive">
<section id="current_speaker">
<h3>Лектор</h3>
<h1>{{currentEvent.speaker.name}}</h1>
<p>{{currentEvent.speaker.description}}</p>
</section>
</script>
<script id="next_talk_template" type="text/ractive"> <script id="next_talk_template" type="text/ractive">
<section id="next_talk"> <section id="next_talk">
<h3>Следва</h3> <h3>Следва</h3>
@ -84,6 +100,14 @@
<section> <section>
{{> agenda_template}} {{> agenda_template}}
{{#currentEvent}}
{{> current_talk_template}}
{{/currentEvent}}
{{#currentEvent.speaker}}
{{> current_speaker_template}}
{{/currentEvent.speaker}}
{{#nextEvent}} {{#nextEvent}}
{{> next_talk_template}} {{> next_talk_template}}
{{/nextEvent}} {{/nextEvent}}

View File

@ -8,6 +8,7 @@ var reactive = new Ractive({
// Here, we're passing in some initial data // Here, we're passing in some initial data
data: {pastEvents: schedule.pastEvents(), data: {pastEvents: schedule.pastEvents(),
currentEvent: schedule.currentEvent(),
nextEvent: schedule.nextEvent(), nextEvent: schedule.nextEvent(),
futureEvents: schedule.futureEvents(), futureEvents: schedule.futureEvents(),
eventCount: schedule.allEvents().length} eventCount: schedule.allEvents().length}
@ -15,6 +16,7 @@ var reactive = new Ractive({
function refreshEvent() { function refreshEvent() {
reactive.set({pastEvents: schedule.pastEvents(), reactive.set({pastEvents: schedule.pastEvents(),
currentEvent: schedule.currentEvent(),
nextEvent: schedule.nextEvent(), nextEvent: schedule.nextEvent(),
futureEvents: schedule.futureEvents(), futureEvents: schedule.futureEvents(),
eventCount: schedule.allEvents().length}); eventCount: schedule.allEvents().length});

View File

@ -18,6 +18,16 @@ function Schedule() {
return _.first(this.upcomingEvents()); return _.first(this.upcomingEvents());
} }
this.currentEvent = function() {
var nextEvent = this.nextEvent();
return _.last(
_.select(this.pastEvents(), function(event) {
return event.startTime.isAfter(nextEvent.startTime.subtract('20', 'minutes'));
})
);
}
this.futureEvents = function() { this.futureEvents = function() {
return this.upcomingEvents().splice(1); return this.upcomingEvents().splice(1);
} }