Add a slide for the current talk
This commit is contained in:
parent
23d276b812
commit
dd3207b060
24
index.html
24
index.html
|
@ -58,6 +58,22 @@
|
|||
</section>
|
||||
</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">
|
||||
<section id="next_talk">
|
||||
<h3>Следва</h3>
|
||||
|
@ -84,6 +100,14 @@
|
|||
<section>
|
||||
{{> agenda_template}}
|
||||
|
||||
{{#currentEvent}}
|
||||
{{> current_talk_template}}
|
||||
{{/currentEvent}}
|
||||
|
||||
{{#currentEvent.speaker}}
|
||||
{{> current_speaker_template}}
|
||||
{{/currentEvent.speaker}}
|
||||
|
||||
{{#nextEvent}}
|
||||
{{> next_talk_template}}
|
||||
{{/nextEvent}}
|
||||
|
|
|
@ -8,6 +8,7 @@ var reactive = new Ractive({
|
|||
|
||||
// Here, we're passing in some initial data
|
||||
data: {pastEvents: schedule.pastEvents(),
|
||||
currentEvent: schedule.currentEvent(),
|
||||
nextEvent: schedule.nextEvent(),
|
||||
futureEvents: schedule.futureEvents(),
|
||||
eventCount: schedule.allEvents().length}
|
||||
|
@ -15,6 +16,7 @@ var reactive = new Ractive({
|
|||
|
||||
function refreshEvent() {
|
||||
reactive.set({pastEvents: schedule.pastEvents(),
|
||||
currentEvent: schedule.currentEvent(),
|
||||
nextEvent: schedule.nextEvent(),
|
||||
futureEvents: schedule.futureEvents(),
|
||||
eventCount: schedule.allEvents().length});
|
||||
|
|
10
schedule.js
10
schedule.js
|
@ -18,6 +18,16 @@ function Schedule() {
|
|||
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() {
|
||||
return this.upcomingEvents().splice(1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue