summaryrefslogtreecommitdiffstats
path: root/js/app
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-16 20:11:12 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-16 20:11:12 +0200
commit731823c61f17da2410dbf41e35ff5b62348a2091 (patch)
tree7a71e220c833fceb6a5e9365c8a7bb7d182a7d9e /js/app
parent980da28c8fb007ea86a3f4c7fae85ebaf723fbde (diff)
cleanup
Diffstat (limited to 'js/app')
-rw-r--r--js/app/app.js10
-rw-r--r--js/app/config.js41
-rw-r--r--js/app/run.js28
3 files changed, 79 insertions, 0 deletions
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 <dev@bernhard-posselt.com>
+ * @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 <dev@bernhard-posselt.com>
+ * @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 <dev@bernhard-posselt.com>
+ * @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