From 731823c61f17da2410dbf41e35ff5b62348a2091 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 16 May 2014 20:11:12 +0200 Subject: cleanup --- js/app/app.js | 10 ++++++++++ js/app/config.js | 41 +++++++++++++++++++++++++++++++++++++++++ js/app/run.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 js/app/app.js create mode 100644 js/app/config.js create mode 100644 js/app/run.js (limited to 'js/app') diff --git a/js/app/app.js b/js/app/app.js new file mode 100644 index 000000000..947a68a2e --- /dev/null +++ b/js/app/app.js @@ -0,0 +1,10 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt + * @copyright Bernhard Posselt 2014 + */ +var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); \ No newline at end of file diff --git a/js/app/config.js b/js/app/config.js new file mode 100644 index 000000000..776f4ee92 --- /dev/null +++ b/js/app/config.js @@ -0,0 +1,41 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt + * @copyright Bernhard Posselt 2014 + */ +app.config(function ($routeProvider, $provide) { + 'use strict'; + + $provide.constant('baseUrl', OC.generateUrl('')); + + $routeProvider + .when('/items', { + controller: 'AllItemsController', + templateUrl: 'content.html', + resolve: {} + }) + .when('/items/starred', { + controller: 'StarredItemsController', + templateUrl: 'content.html', + resolve: {} + }) + .when('/items/feeds/:id', { + controller: 'FeedItemsController', + templateUrl: 'content.html', + resolve: {} + }) + .when('/items/folders/:id', { + controller: 'FolderItemsController', + templateUrl: 'content.html', + resolve: {} + }) + .otherwise({ + redirectTo: '/items' + }); + +}); + diff --git a/js/app/run.js b/js/app/run.js new file mode 100644 index 000000000..00e71a7b0 --- /dev/null +++ b/js/app/run.js @@ -0,0 +1,28 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt + * @copyright Bernhard Posselt 2014 + */ +app.run(function ($rootScope, $location, Loading, Setup) { + 'use strict'; + + // load feeds, settings and last read feed + Setup.load(); + + $rootScope.$on('$routeChangeStart', function () { + Loading.setLoading('content', true); + }); + + $rootScope.$on('$routeChangeSuccess', function () { + Loading.setLoading('content', false); + }); + + // in case of wrong id etc show all items + $rootScope.$on('$routeChangeError', function () { + $location.path('/items'); + }); +}); \ No newline at end of file -- cgit v1.2.3