Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
fix issue in feature detail controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Jul 9, 2014
1 parent cc26a11 commit 850c569
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Expand Up @@ -11,7 +11,7 @@ featureApp.config(['$routeProvider',
templateUrl: 'partials/list.html',
controller: 'FeatureListCtrl'
}).
when('/features/:featureId', {
when('/features/:testName', {
templateUrl: 'partials/detail.html',
controller: 'FeatureDetailCtrl'
}).
Expand Down
Expand Up @@ -11,14 +11,20 @@ var FeatureListCtrl = function($scope, $http, $location, $filter) {
};
};

var FeatureDetailCtrl = function($scope, $http, $routeParams) {
var FeatureDetailCtrl = function($scope, $http, $routeParams, filterFilter) {
$http.get('features.json').success(function(data) {
$scope.feature = data[$routeParams.featureId];
var filtered = filterFilter(data, {testName: $routeParams.testName});
if (filtered.length == 1) {
$scope.feature = filtered[0];
} else {
$scope.warning =
"Something wrong with the URL. Can't find test name in features.";
}
});
};

featureControllers.controller('FeatureListCtrl', [ '$scope', '$http',
'$location', '$filter', FeatureListCtrl ]);

featureControllers.controller('FeatureDetailCtrl', [ '$scope', '$http',
'$routeParams', FeatureDetailCtrl ]);
'$routeParams', 'filterFilter', FeatureDetailCtrl ]);
Expand Up @@ -14,5 +14,5 @@ <h4 class="heading--sub">{{feature.testName}}</h4>
<a ng-href="https://tcms.engineering.redhat.com/plan/{{planId}}">TCMS Test Plan {{planId}}</a>
</li>
</ul>

{{warning}}
</div>
Expand Up @@ -32,9 +32,9 @@
<span
class="label--highlight l--pad-all-quarter">{{feature.category}}</span>
<span class="l--constrain-medium">{{feature.summary}} </span>
<span ng-click="featureDetail($index)" class="txt--meta l--push-h-quarter">
<a ng-href="#features/{{feature.testName}}" class="txt--meta l--push-h-quarter">
{{feature.testName}}
</span>
</a>
<span
class="{{feature.testResult | resultStyle}} l--pad-all-quarter">{{feature.testResult}}</span>
</li>
Expand Down

0 comments on commit 850c569

Please sign in to comment.