Skip to content

Commit

Permalink
Fixes example poll entries to have votes for all possible times.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemmy committed Apr 10, 2015
1 parent eda2869 commit 53cbaed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions public/js/directives/poll.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ angular.module('rallly')
var example = {name: examplesNames[i]};
example.votes = [];
for (var j = 0; j < event.dates.length; j++) {
var answer = Math.random() < .5;
example.votes[j] = answer;
for (var k = 0; k <event.dates[j].possible_times.length; ++k) {
var answer = Math.random() < .5;
example.votes[j+k] = answer;
}
}
examples.push(example);
}
Expand Down
16 changes: 10 additions & 6 deletions public/templates/directives/poll.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{time.start_time | date: 'hh:mma'}}
{{time.end_time | date: 'hh:mma'}}
<span class="count" ng-show="numberVotes(time)"
ng-class={top:isTopDate(time)}>{{numberVotes(time)}}</span>
ng-class={top:isTopDate(time)}>{{numberVotes(time)}}</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -78,11 +78,13 @@
<span class="avatar style-{{$index + 1}}">
<img src="/images/user.png" width="11"/>
</span>
<span class="name">{{example.name}}</span>
<span class="name">{{example.name}}</span>x
</div>
<div class="cell vote-cell" ng-repeat="date in event.dates">
<img src="/images/[email protected]" width="16" ng-if="example.votes[$index]"/>
<img src="/images/[email protected]" width="8" ng-if="!example.votes[$index]"/>
<div class="time-group" ng-repeat="date in event.dates">
<div class="cell vote-cell" ng-repeat="time in date.possible_times">
<img src="/images/[email protected]" width="16" ng-if="example.votes[$index + $parent.$index]"/>
<img src="/images/[email protected]" width="8" ng-if="!example.votes[$index + $parent.$index]"/>
</div>
</div>
<div class="cell action-cell">

Expand All @@ -106,7 +108,9 @@
<div class="time-group" ng-repeat="date in event.dates track by date._id">
<div class="cell vote-cell" ng-repeat="time in date.possible_times">
<input ng-model="participantVotes[date._id][time._id]" ng-false-value="false" type="checkbox"/>
<div class="overlay" ng-click="participantVotes[date._id][time._id] = !participantVotes[date._id][time._id]"></div>

<div class="overlay"
ng-click="participantVotes[date._id][time._id] = !participantVotes[date._id][time._id]"></div>
</div>
</div>
<div class="cell action-cell">
Expand Down

0 comments on commit 53cbaed

Please sign in to comment.