diff --git a/refstack-ui/app/components/guidelines/guidelines.html b/refstack-ui/app/components/guidelines/guidelines.html index ce0fe691..06ba6e3a 100644 --- a/refstack-ui/app/components/guidelines/guidelines.html +++ b/refstack-ui/app/components/guidelines/guidelines.html @@ -4,9 +4,11 @@
Version: -
diff --git a/refstack-ui/app/components/guidelines/guidelinesController.js b/refstack-ui/app/components/guidelines/guidelinesController.js index b23eb32c..2153911d 100644 --- a/refstack-ui/app/components/guidelines/guidelinesController.js +++ b/refstack-ui/app/components/guidelines/guidelinesController.js @@ -66,7 +66,9 @@ ctrl.versionsRequest = $http.get(content_url).success(function (data) { ctrl.versionList = data.sort().reverse(); - ctrl.version = ctrl.versionList[0]; + // Default to the first approved guideline which is expected + // to be at index 1. + ctrl.version = ctrl.versionList[1]; ctrl.update(); }).error(function (error) { ctrl.showError = true; diff --git a/refstack-ui/app/components/results-report/resultsReportController.js b/refstack-ui/app/components/results-report/resultsReportController.js index b3aaf42b..24826d72 100644 --- a/refstack-ui/app/components/results-report/resultsReportController.js +++ b/refstack-ui/app/components/results-report/resultsReportController.js @@ -90,7 +90,9 @@ $http.get(content_url).success(function (data) { ctrl.versionList = data.sort().reverse(); if (!ctrl.version) { - ctrl.version = ctrl.versionList[0]; + // Default to the first approved guideline which is + // expected to be at index 1. + ctrl.version = ctrl.versionList[1]; } ctrl.updateGuidelines(); }).error(function (error) { diff --git a/refstack-ui/tests/unit/ControllerSpec.js b/refstack-ui/tests/unit/ControllerSpec.js index c078ec02..b54dd721 100644 --- a/refstack-ui/tests/unit/ControllerSpec.js +++ b/refstack-ui/tests/unit/ControllerSpec.js @@ -91,14 +91,16 @@ describe('Refstack controllers', function () { }; $httpBackend.expectGET(fakeApiUrl + - '/guidelines').respond(['2015.03.json', '2015.04.json']); + '/guidelines').respond(['next.json', '2015.03.json', + '2015.04.json']); // Should call request with latest version. $httpBackend.expectGET(fakeApiUrl + '/guidelines/2015.04.json').respond(fakeCaps); $httpBackend.flush(); // The version list should be sorted latest first. - expect(ctrl.versionList).toEqual(['2015.04.json', - '2015.03.json']); + expect(ctrl.versionList).toEqual(['next.json', + '2015.04.json', + '2015.03.json']); expect(ctrl.guidelines).toEqual(fakeCaps); // The guideline status should be approved. expect(ctrl.guidelines.status).toEqual('approved');