diff --git a/src/client/app.js b/src/client/app.js index dede626b..56e346d0 100644 --- a/src/client/app.js +++ b/src/client/app.js @@ -7,6 +7,7 @@ import Award from './components/Award'; import GalleryItem from './components/GalleryItem'; import TeamMemberProfile from './components/TeamMemberProfile'; import AppController from './controllers/AppController'; +import DocumentsController from './controllers/DocumentsController'; import api from './api/api'; let deps = [ @@ -98,7 +99,6 @@ app.run(($location, $rootScope, $http) => { require('./pages/schedule'), require('./pages/team'), require('./pages/gallery'), - require('./pages/docs'), require('./controllers/ContactsController'), require('./controllers/CopyrightController'), Document, @@ -106,6 +106,7 @@ app.run(($location, $rootScope, $http) => { GalleryItem, TeamMemberProfile, AppController, + DocumentsController, function (app) { app.controller('SchedulePageController', ($scope) => { $scope.pageClass = 'page-schedule'; diff --git a/src/client/controllers/DocumentsController.js b/src/client/controllers/DocumentsController.js new file mode 100644 index 00000000..76cf13e0 --- /dev/null +++ b/src/client/controllers/DocumentsController.js @@ -0,0 +1,10 @@ +export default function (app) { + app.controller('DocumentsController', ($scope, api, docs) => { + $scope.documents = docs.docs; + + api.document.awards() + .success(data => { + $scope.awards = data; + }); + }); +}; diff --git a/src/client/pages/docs.js b/src/client/pages/docs.js deleted file mode 100644 index 1a526310..00000000 --- a/src/client/pages/docs.js +++ /dev/null @@ -1,53 +0,0 @@ -module.exports = function (app) { - app.controller("DocumentsController", function ($scope, api, docs) { - $scope.documents = docs.docs; - - api.document.awards() - .success(data => { - $scope.awards = data; - }); - }); -}; - -/** - * Generates list of numbers - * @param {Number} start starting value - * @param {Number} num amount of numbers in list - * @param {Number} step difference value - * @return {Array} list of numbers - */ -function range(start, num, step) { - var list = []; - var val = start; - for (var i = 0; i < num; i++) { - list.push(val); - val += step; - } - return list; -} - -///** -// * Monday date of current week -// * @param {[type]} d [description] -// * @return {[type]} [description] -// */ -//function getMonday(d) { -// d = new Date(d); -// var day = d.getDay(); -// var diff = d.getDate() - day + (day == 0 ? -6 : 1); // adjust when day is sunday -// return new Date(d.setDate(diff)); -//} - -function getDates(day) { - var dates = []; - var prev = day == 0 ? 0 : day - 1; - var next = 6 - prev; - var dayMask = range(-1, prev, -1).concat([0]).concat(range(1, next, 1)); - - dayMask.forEach(function (m) { - var time = Date.now() + (1000 * 60 * 60 * 24) * m; - var date = new Date(time); - dates.push(date.getDate()); - }); - return dates; -} \ No newline at end of file