Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

Commit

Permalink
scores: Implement editing stage, closes #106.
Browse files Browse the repository at this point in the history
  • Loading branch information
poelstra committed Nov 26, 2014
1 parent 671b6fb commit e71d2c4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion spec/views/scoresSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ describe('scores', function() {
controller = $controller('scoresCtrl', {
'$scope': $scope,
'$scores': scoresMock,
'$teams': teamsMock
'$teams': teamsMock,
'$stages': stagesMock
});
});
});
Expand Down
1 change: 1 addition & 0 deletions src/js/services/ng-scores.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ define('services/ng-scores',[
file: _score.file,
teamNumber: _score.teamNumber,
team: $teams.get(_score.teamNumber),
stageId: _score.stageId,
stage: $stages.get(_score.stageId),
round: _score.round,
score: _score.score,
Expand Down
5 changes: 3 additions & 2 deletions src/js/views/scores.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ define('views/scores',[
],function(log) {
var moduleName = 'scores';
return angular.module(moduleName,[]).controller(moduleName+'Ctrl',[
'$scope', '$scores','$teams',
function($scope,$scores,$teams) {
'$scope', '$scores','$teams','$stages',
function($scope,$scores,$teams,$stages) {
log('init scores ctrl');

$scope.sort = 'index';
$scope.rev = true;

$scope.scores = $scores.scores;
$scope.stages = $stages.stages;

$scope.doSort = function(col, defaultSort) {
$scope.rev = (String($scope.sort) === String(col)) ? !$scope.rev : defaultSort;
Expand Down
7 changes: 6 additions & 1 deletion src/views/scores.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
<td>{{score.index + 1}}</td>
<td>
<i class="icon-exclamation-sign" ng-show="score.error.name == 'UnknownStageError'" title="{{score.error.message}}"></i>
{{score.stage.name}}
<span ng-if="!score.$editing">
{{score.stage.name}}
</span>
<span ng-if="score.$editing">
<select ng-model="score.stageId" ng-options="stage.id as stage.name for stage in stages"></select>
</span>
</td>
<td>
<i class="icon-exclamation-sign" ng-show="score.error.name == 'UnknownRoundError'" title="{{score.error.message}}"></i>
Expand Down

0 comments on commit e71d2c4

Please sign in to comment.