Merge "Default guideline to latest approved guideline"
This commit is contained in:
commit
fcac21f1bf
@ -4,9 +4,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<strong>Version:</strong>
|
<strong>Version:</strong>
|
||||||
<select ng-model="ctrl.version" ng-change="ctrl.update()" class="form-control">
|
<!-- Slicing the version file name here gets rid of the '.json' file extension -->
|
||||||
<!-- Slicing the version file name here gets rid of the '.json' file extension. -->
|
<select ng-model="ctrl.version"
|
||||||
<option ng-repeat="versionFile in ctrl.versionList" value="{{versionFile}}">{{versionFile.slice(0, -5)}}</option>
|
ng-change="ctrl.update()"
|
||||||
|
class="form-control"
|
||||||
|
ng-options="versionFile.slice(0,-5) for versionFile in ctrl.versionList">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
@ -66,7 +66,9 @@
|
|||||||
ctrl.versionsRequest =
|
ctrl.versionsRequest =
|
||||||
$http.get(content_url).success(function (data) {
|
$http.get(content_url).success(function (data) {
|
||||||
ctrl.versionList = data.sort().reverse();
|
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();
|
ctrl.update();
|
||||||
}).error(function (error) {
|
}).error(function (error) {
|
||||||
ctrl.showError = true;
|
ctrl.showError = true;
|
||||||
|
@ -90,7 +90,9 @@
|
|||||||
$http.get(content_url).success(function (data) {
|
$http.get(content_url).success(function (data) {
|
||||||
ctrl.versionList = data.sort().reverse();
|
ctrl.versionList = data.sort().reverse();
|
||||||
if (!ctrl.version) {
|
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();
|
ctrl.updateGuidelines();
|
||||||
}).error(function (error) {
|
}).error(function (error) {
|
||||||
|
@ -91,14 +91,16 @@ describe('Refstack controllers', function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$httpBackend.expectGET(fakeApiUrl +
|
$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.
|
// Should call request with latest version.
|
||||||
$httpBackend.expectGET(fakeApiUrl +
|
$httpBackend.expectGET(fakeApiUrl +
|
||||||
'/guidelines/2015.04.json').respond(fakeCaps);
|
'/guidelines/2015.04.json').respond(fakeCaps);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
// The version list should be sorted latest first.
|
// The version list should be sorted latest first.
|
||||||
expect(ctrl.versionList).toEqual(['2015.04.json',
|
expect(ctrl.versionList).toEqual(['next.json',
|
||||||
'2015.03.json']);
|
'2015.04.json',
|
||||||
|
'2015.03.json']);
|
||||||
expect(ctrl.guidelines).toEqual(fakeCaps);
|
expect(ctrl.guidelines).toEqual(fakeCaps);
|
||||||
// The guideline status should be approved.
|
// The guideline status should be approved.
|
||||||
expect(ctrl.guidelines.status).toEqual('approved');
|
expect(ctrl.guidelines.status).toEqual('approved');
|
||||||
|
Loading…
Reference in New Issue
Block a user