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.
19 .module('index', ['ngSanitize'])
21 .config(function($stateProvider
, $locationProvider
) {
25 templateUrl
: 'views/index.html',
26 controller
: 'IndexCtrl',
27 controllerAs
: 'indexCtrl'
31 .factory('Catalog', [ '$http', function($http
) {
33 loadHightlighted
: function(cb
, cbErr
) {
34 $http
.get('/api/catalog/highlighted')
39 loadMostRequired
: function(cb
, cbErr
) {
40 $http
.get('/api/catalog/required')
45 loadByTags
: function(cb
, cbErr
) {
46 $http
.get('/api/catalog/bytags')
51 loadStats
: function(cb
, cbErr
) {
52 $http
.get('/api/catalog/stats')
57 loadContributors
: function(cb
, cbErr
) {
58 $http
.get('/api/catalog/contributors')
65 .controller('IndexCtrl', function(Catalog
, $sce
, $scope
, $location
, $anchorScroll
) {
66 this.loadHighlighted
= function() {
67 Catalog
.loadHightlighted(
69 $scope
.highlighted
= data
;
75 this.loadMostRequired
= function() {
76 Catalog
.loadMostRequired(
78 $scope
.required
= data
;
84 this.loadByTags
= function() {
93 this.loadStats
= function() {
102 this.loadContributors
= function() {
103 Catalog
.loadContributors(
105 $scope
.contributors
= data
;
112 this.scrollTo
= function(hash
) {
116 this.loadHighlighted();
118 this.loadContributors();
121 .directive('contributorList', function(Model
) {
127 listContributors
: '='
129 templateUrl
: '/directives/contributor-list.html'