2 * Copyright 2016 Alexandre Terrasa <alexandre@moz-code.org>.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 .config(function($stateProvider
, $locationProvider
) {
25 templateUrl
: 'views/catalog/index.html',
26 controller
: 'CatalogCtrl',
30 .state('catalog.highlighted', {
32 templateUrl
: 'views/catalog/highlighted.html',
33 controller
: 'CatalogHighlightedCtrl',
36 .state('catalog.required', {
38 templateUrl
: 'views/catalog/most_required.html',
39 controller
: 'CatalogRequiredCtrl',
42 .state('catalog.tags', {
44 templateUrl
: 'views/catalog/by_tags.html',
45 controller
: 'CatalogTagsCtrl',
50 .factory('Catalog', [ '$http', function($http
) {
52 loadHightlighted
: function(cb
, cbErr
) {
53 $http
.get('/api/catalog/highlighted')
58 loadMostRequired
: function(cb
, cbErr
) {
59 $http
.get('/api/catalog/required')
64 loadByTags
: function(cb
, cbErr
) {
65 $http
.get('/api/catalog/bytags')
70 loadStats
: function(cb
, cbErr
) {
71 $http
.get('/api/catalog/stats')
76 loadContributors
: function(cb
, cbErr
) {
77 $http
.get('/api/catalog/contributors')
84 .controller('CatalogCtrl', function(Catalog
) {
87 Catalog
.loadContributors(
89 vm
.contributors
= data
;
102 .controller('CatalogHighlightedCtrl', function(Catalog
) {
105 Catalog
.loadHightlighted(
107 vm
.highlighted
= data
;
113 .controller('CatalogRequiredCtrl', function(Catalog
) {
116 Catalog
.loadMostRequired(
124 .controller('CatalogTagsCtrl', function(Catalog
, $anchorScroll
, $location
) {
135 vm
.scrollTo
= function(hash
) {
136 $location
.hash(hash
);
141 .directive('contributorList', function(Model
) {
147 listContributors
: '='
149 templateUrl
: '/directives/contributor-list.html'