Skip to content

Commit

Permalink
Fixed a small bug with the ng-include for the experiment body
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Mar 11, 2013
1 parent 1f4c529 commit a91b484
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ doc/
/media/original/*
/media/cachedimages/*
/media/cachedaudio/*
/media/experiments/*
13 changes: 12 additions & 1 deletion app/assets/javascripts/angular/controllers/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
app.controller('ExperimentsCtrl', ['$scope', '$resource', '$routeParams', '$route', '$http', 'Media', 'AudioEvent', 'Tag',

/**
* The listen controller.
* The Experiments controller.
* @param $scope
* @param $resource
* @param $routeParams
Expand Down Expand Up @@ -45,6 +45,10 @@
success(function (data, status, headers, config) {
$scope.spec = data;
$scope.results.experiment = $scope.spec.experiment;

if ($routeParams.cheat) {
$scope.stage = $routeParams.cheat;
}
}).error(function (data, status, headers, config) {
alert("downloading test specification failed");
});
Expand Down Expand Up @@ -88,6 +92,13 @@

};

$scope.getPath = function () {
if ($scope.spec && $scope.spec.experimentSteps && $scope.spec.experimentSteps[$scope.step]) {

return $scope.spec.experimentSteps[$scope.step].template
}
};

$scope.$watch(function () {
return $scope.step;
}, function (newValue, oldValue) {
Expand Down
4 changes: 2 additions & 2 deletions app/assets/templates/experiment_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ <h3>Instructions</h3>
<div id="experimentBody" ng-show="stage == EXPERIMENT_STAGE">
<h2>Main experiment</h2>
<div>
Progress: {{step}}/{{spec.experimentSteps.length}} <progress value="{{step}}" max="{{spec.experimentSteps.length}}"></progress>
Progress: {{step}}/{{spec.experimentSteps.length}} <meter value="{{step}}" max="{{spec.experimentSteps.length}}"></meter>
</div>
<div ng-include src="step.template"></div>
<div ng-include src="getPath()"></div>

<button ng-click="step = step + 1">Next</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/experiments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create

if success.nil?
FileUtils.makedirs EXPERIMENTS_SAVE_DIRECTORY
File.open( (EXPERIMENTS_SAVE_DIRECTORY + '/' + Time.now.to_i.to_s + '.json'), 'w' ){ |file|
File.open( (EXPERIMENTS_SAVE_DIRECTORY + '/' + Time.now.to_f.to_s + '.json'), 'w' ){ |file|
file.write post_data
}

Expand Down

0 comments on commit a91b484

Please sign in to comment.