summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-19 02:22:02 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-19 02:22:02 +0200
commit90584316b8f275fcad904b644676544eb0322636 (patch)
tree35ead28e8f0cdccc1771464442bb83ce5b558cc6
parentded252d29e99e068ea341506129e47a05e053a24 (diff)
add test for firstrun page
-rw-r--r--css/addnew.css16
-rw-r--r--css/app.css13
-rw-r--r--css/content.css (renamed from css/items.css)21
-rw-r--r--css/firstrun.css41
-rw-r--r--css/navigation.css (renamed from css/feeds.css)37
-rw-r--r--css/owncloud6.css11
-rw-r--r--js/Gruntfile.js20
-rw-r--r--js/README.md4
-rw-r--r--js/app/App.js (renamed from js/app/app.js)0
-rw-r--r--js/app/Config.js65
-rw-r--r--js/app/Run.js78
-rw-r--r--js/app/config.js41
-rw-r--r--js/app/run.js36
-rw-r--r--js/build/app.js128
-rw-r--r--js/controller/AppController.js19
-rw-r--r--js/controller/ItemsController.js (renamed from js/service/setup.js)7
-rw-r--r--js/controller/NavigationController.js14
-rw-r--r--js/controller/SettingsController.js14
-rw-r--r--js/protractor.chrome.conf.js8
-rw-r--r--js/protractor.phantomjs.conf.js8
-rw-r--r--js/service/Feed.js (renamed from js/service/feed.js)0
-rw-r--r--js/service/Folder.js (renamed from js/service/folder.js)0
-rw-r--r--js/service/Item.js (renamed from js/service/item.js)0
-rw-r--r--js/service/Loading.js (renamed from js/service/loading.js)3
-rw-r--r--js/service/Model.js (renamed from js/service/model.js)0
-rw-r--r--js/service/Publisher.js (renamed from js/service/publisher.js)2
-rw-r--r--js/service/Settings.js32
-rw-r--r--js/tests/e2e/main.js15
-rw-r--r--js/tests/unit/controller/AppControllerSpec.js45
-rw-r--r--js/tests/unit/service/LoadingSpec.js1
-rw-r--r--js/tests/unit/service/PublisherSpec.js6
-rw-r--r--js/tests/unit/service/SettingsSpec.js30
-rw-r--r--templates/main.php43
-rw-r--r--templates/part.content.php3
-rw-r--r--templates/part.firstrun.php3
-rw-r--r--templates/part.items.php12
36 files changed, 558 insertions, 218 deletions
diff --git a/css/addnew.css b/css/addnew.css
index 24cdd6000..d289ecb4e 100644
--- a/css/addnew.css
+++ b/css/addnew.css
@@ -31,11 +31,11 @@
}
.add-new input[type=text] {
- width: 120px;
+ width: 170px;
}
.add-new select {
- width: 133px;
+ width: 170px;
margin-top: 1px !important;
height: 30px;
background-color: #eee;
@@ -46,7 +46,7 @@
box-sizing: border-box;
}
-.add-new input,
+.add-new input,
.add-new select {
margin: 0 0 5px 0;
display: inline-block;
@@ -69,7 +69,7 @@
.add-new .action-button {
width: 30px;
background-position: center;
- background-repeat: no-repeat;
+ background-repeat: no-repeat;
}
.add-new .back-button {
@@ -80,15 +80,15 @@
.add-new .new-button {
border-radius: 0;
background-image: url('../img/add.svg');
- border-top-right-radius: 5px;
- border-bottom-right-radius: 5px;
+ border-top-right-radius: 5px;
+ border-bottom-right-radius: 5px;
}
.add-new .create-button {
border-radius: 0;
background-image: url('../img/mark_read.svg');
- border-top-right-radius: 5px;
- border-bottom-right-radius: 5px;
+ border-top-right-radius: 5px;
+ border-bottom-right-radius: 5px;
}
.add-new .error {
diff --git a/css/app.css b/css/app.css
new file mode 100644
index 000000000..bf1e695a1
--- /dev/null
+++ b/css/app.css
@@ -0,0 +1,13 @@
+.loading-icon {
+ background-image: url('../img/loading.gif');
+ background-position: center;
+ background-repeat: no-repeat;
+}
+
+#global-loading {
+ width: 100%;
+ height: 100%;
+}
+
+
+
diff --git a/css/items.css b/css/content.css
index 04cd0ac63..4c071451b 100644
--- a/css/items.css
+++ b/css/content.css
@@ -19,6 +19,22 @@
*
*/
+#first-run {
+ height: 100%;
+ width: 100%;
+ display: table;
+}
+
+#first-run h1 {
+ color: #888888;
+ font-size: 1.5em;
+ font-weight: bold;
+ text-shadow: 0 1px 0 #FFFFFF;
+ display: table-cell;
+ text-align: center;
+ vertical-align: middle;
+}
+
#app-content:after {
content: '';
display: block;
@@ -35,11 +51,6 @@
height: 100%;
}
-#app-content.loading {
- background-image: url('../img/loading.gif');
- background-position: center;
- background-repeat: no-repeat;
-}
#app-content.loading > ul {
display: none;
diff --git a/css/firstrun.css b/css/firstrun.css
deleted file mode 100644
index 7467a7b2b..000000000
--- a/css/firstrun.css
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
-* ownCloud - News
-*
-* @author Alessandro Cosentino
-* @author Bernhard Posselt
-* @copyright 2013 Alessandro Cosentino cosenal@gmail.com
-* @copyright 2013 Bernhard Posselt dev@bernhard-posselt.com
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-#firstrun {
- height: 100%;
- margin-left: 300px;
- position: relative;
-}
-
-#firstrun .message {
- color: #888888;
- font-size: 1.5em;
- font-weight: bold;
- text-shadow: 0 1px 0 #FFFFFF;
- position: absolute;
- top: 50%;
- text-align: center;
- width: 100%;
- margin-top: -0.75em;
-}
-
diff --git a/css/feeds.css b/css/navigation.css
index 9b17cd973..79f27d094 100644
--- a/css/feeds.css
+++ b/css/navigation.css
@@ -19,16 +19,16 @@
*
*/
-#undo-container {
- position: fixed;
- top: 0px;
- width: 100%;
- text-align: center;
- z-index: 101;
+#undo-container {
+ position: fixed;
+ top: 0px;
+ width: 100%;
+ text-align: center;
+ z-index: 101;
line-height: 1.2;
}
-#undo {
+#undo {
z-index:101;
background-color:#fc4;
border:0;
@@ -144,7 +144,7 @@
}
.feed {
- text-transform: none;
+ text-transform: none;
}
.unread-counter {
@@ -182,11 +182,6 @@ button.action:hover {
padding-left: 0;
}
-#app-navigation .rename-feed > input {
- width: 155px;
- height: 15px;
-}
-
#app-navigation .folder-input {
text-transform: uppercase;
}
@@ -205,9 +200,13 @@ button.action:hover {
.rename-feed input {
margin: 1px 0 0px 5px;
+ border-right: 1px solid #ddd;
+ border-radius: 2px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-right: 0;
+ width: 208px;
+ height: 32px;
}
.rename-feed button {
@@ -222,7 +221,7 @@ button.action:hover {
.rename-feed .action-button {
background-position: center;
- background-repeat: no-repeat;
+ background-repeat: no-repeat;
}
.rename-feed .back-button {
@@ -240,15 +239,21 @@ button.action:hover {
}
#app-navigation .ui-draggable-dragging {
- width: 249px;
+ width: 100%;
}
#app-navigation .multiselect {
height:20px;
}
+#app-navigation .progress-icon,
+#app-navigation .problem-icon {
+ width: 299px;
+ line-height: 44px;
+}
+
.progress-icon {
- background-image: url('../img/loading.gif');
+ background-image: url('../img/loading.gif');
}
.problem-icon {
diff --git a/css/owncloud6.css b/css/owncloud6.css
index 5d3445cd9..1dbab96c5 100644
--- a/css/owncloud6.css
+++ b/css/owncloud6.css
@@ -1,13 +1,4 @@
/* Feeds */
-#app-navigation .add-new input,
-#app-navigation .add-new select {
- width: 170px;
-}
-
-#app-navigation .ui-draggable-dragging {
- width: 299px;
-}
-
#app-navigation .rename-feed > input {
width: 208px;
height: 32px;
@@ -15,7 +6,7 @@
border-radius: 2px;
}
-#app-navigation .progress-icon,
+#app-navigation .progress-icon,
#app-navigation .problem-icon {
width: 299px;
line-height: 44px;
diff --git a/js/Gruntfile.js b/js/Gruntfile.js
index df0afc2ba..5dd29b9fc 100644
--- a/js/Gruntfile.js
+++ b/js/Gruntfile.js
@@ -14,7 +14,9 @@ var globals = [
'angular',
// app
'app',
+ // ownCloud
'OC',
+ 'oc_requesttoken',
// angular
'inject',
'module',
@@ -62,9 +64,10 @@ module.exports = function (grunt) {
},
dist: {
src: [
- 'app/app.js',
- 'app/config.js',
- 'app/run.js',
+ 'app/App.js',
+ 'app/Config.js',
+ 'app/Run.js',
+ 'controller/**/*.js',
'filter/**/*.js',
'service/**/*.js',
'directive/**/*.js'
@@ -84,8 +87,8 @@ module.exports = function (grunt) {
dest: '<%= meta.production %>app.js',
options: {
wrapper: [
- '(function(angular, $, OC, undefined){\n\n\'use strict\';\n\n',
- '\n})(angular, jQuery, OC);'
+ '(function(angular, $, OC, oc_requesttoken, undefined){\n\n\'use strict\';\n\n',
+ '\n})(angular, jQuery, OC, oc_requesttoken);'
]
}
}
@@ -96,6 +99,7 @@ module.exports = function (grunt) {
'app/**/*.js',
'filter/**/*.js',
'service/**/*.js',
+ 'controller/**/*.js',
'directive/**/*.js',
'tests/**/*.js',
'Gruntfile.js',
@@ -119,10 +123,10 @@ module.exports = function (grunt) {
'service/**/*.js',
'../templates/**/*.php'
],
+ tasks: ['default'],
options: {
livereload: true
- },
- tasks: ['default']
+ }
},
phpunit: {
files: [
@@ -189,7 +193,9 @@ module.exports = function (grunt) {
// make tasks available under simpler commands
grunt.registerTask('default', ['jslint', 'concat', 'ngmin', 'wrap']);
+ grunt.registerTask('dev', ['watch:concat']);
grunt.registerTask('test', ['karma:unit']);
+ grunt.registerTask('phpunit', ['watch:phpunit']);
grunt.registerTask('e2e', ['protractor_webdriver', 'connect', 'protractor:chrome']);
grunt.registerTask('ci-unit', ['default', 'karma:continuous']);
grunt.registerTask('ci-e2e', ['protractor_webdriver', 'connect', 'protractor:phantomjs']);
diff --git a/js/README.md b/js/README.md
index a1b5f4139..db6dafc2e 100644
--- a/js/README.md
+++ b/js/README.md
@@ -10,7 +10,7 @@ then run:
## Building
Watch mode:
- grunt watch
+ grunt dev
Single run mode:
@@ -19,7 +19,7 @@ Single run mode:
## Testing
Watch mode:
- grunt watch:phpunit
+ grunt phpunit
grunt test
Single run mode:
diff --git a/js/app/app.js b/js/app/App.js
index 947a68a2e..947a68a2e 100644
--- a/js/app/app.js
+++ b/js/app/App.js
diff --git a/js/app/Config.js b/js/app/Config.js
new file mode 100644
index 000000000..67a5e7215
--- /dev/null
+++ b/js/app/Config.js
@@ -0,0 +1,65 @@
+/**
+ * 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, $httpProvider) {
+ 'use strict';
+
+ // constants
+ $provide.constant('BASE_URL', OC.generateUrl('/apps/news'));
+
+ $provide.constant('FEED_TYPE', {
+ FEED: 0,
+ FOLDER: 1,
+ STARRED: 2,
+ SUBSCRIPTIONS: 3,
+ SHARED: 4
+ });
+
+ // make sure that the CSRF header is only sent to the ownCloud domain
+ $provide.factory('CSRFInterceptor', function ($q, BASE_URL) {
+ return {
+ request: function (config) {
+ if (config.url.indexOf(BASE_URL) === 0) {
+ config.headers.requesttoken = oc_requesttoken;
+ }
+
+ return config || $q.when(config);
+ }
+ };
+ });
+ $httpProvider.interceptors.push('CSRFInterceptor');
+
+ // routing
+ $routeProvider
+ .when('/items', {
+ controller: 'ItemsController',
+ templateUrl: 'content.html',
+ resolve: {}
+ })
+ .when('/items/starred', {
+ controller: 'StarredController',
+ templateUrl: 'content.html',
+ resolve: {}
+ })
+ .when('/items/feeds/:id', {
+ controller: 'FeedController',
+ templateUrl: 'content.html',
+ resolve: {}
+ })
+ .when('/items/folders/:id', {
+ controller: 'FolderController',
+ 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..936a03b9d
--- /dev/null
+++ b/js/app/Run.js
@@ -0,0 +1,78 @@
+/**
+ * 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, $http, $q, Loading, Item, Feed, Folder,
+ Settings, Publisher, BASE_URL, FEED_TYPE) {
+ 'use strict';
+
+ // show Loading screen
+ Loading.setLoading('global', true);
+
+ // listen to keys in returned queries to automatically distribute the
+ // incoming values to models
+ Publisher.subscribe(Item).toChannel('items');
+ Publisher.subscribe(Folder).toChannel('folders');
+ Publisher.subscribe(Feed).toChannel('feeds');
+ Publisher.subscribe(Settings).toChannel('settings');
+
+ // load feeds, settings and last read feed
+ var settingsDeferred,
+ activeFeedDeferred;
+
+ settingsDeferred = $q.defer();
+ $http.get(BASE_URL + '/settings').then(function (data) {
+ Publisher.publishAll(data);
+ settingsDeferred.resolve();
+ });
+
+ activeFeedDeferred = $q.defer();
+ $http.get(BASE_URL + '/feeds/active').then(function (data) {
+ var url;
+
+ switch (data.type) {
+
+ case FEED_TYPE.FEED:
+ url = '/items/feeds/' + data.id;
+ break;
+
+ case FEED_TYPE.FOLDER:
+ url = '/items/folders/' + data.id;
+ break;
+
+ case FEED_TYPE.STARRED:
+ url = '/items/starred';
+ break;
+
+ default:
+ url = '/items';
+ }
+
+ $location.path(url);
+ activeFeedDeferred.resolve();
+ });
+
+
+ $q.all([settingsDeferred.promise, activeFeedDeferred.promise]).then(function () {
+ Loading.setLoading('global', false);
+ });
+
+
+ $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
diff --git a/js/app/config.js b/js/app/config.js
deleted file mode 100644
index 776f4ee92..000000000
--- a/js/app/config.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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
deleted file mode 100644
index f91d908f2..000000000
--- a/js/app/run.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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, Item, Feed, Folder,
- Publisher, Settings) {
- 'use strict';
-
- // listen to keys in returned queries to automatically distribute the
- // incoming values to models
- Publisher.subscribe(Item).toChannel('items');
- Publisher.subscribe(Folder).toChannel('folders');
- Publisher.subscribe(Feed).toChannel('feeds');
- Publisher.subscribe(Settings).toChannel('settings');
-
- // 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
diff --git a/js/build/app.js b/js/build/app.js
index 3a72dc277..a20648bd5 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -1,4 +1,4 @@
-(function(angular, $, OC, undefined){
+(function(angular, $, OC, oc_requesttoken, undefined){
'use strict';
@@ -11,23 +11,45 @@ var app = angular.module('News', [
app.config([
'$routeProvider',
'$provide',
- function ($routeProvider, $provide) {
+ '$httpProvider',
+ function ($routeProvider, $provide, $httpProvider) {
'use strict';
- $provide.constant('baseUrl', OC.generateUrl(''));
+ // constants
+ $provide.constant('BASE_URL', OC.generateUrl('/apps/news'));
+ $provide.constant('FEED_TYPE', {
+ FEED: 0,
+ FOLDER: 1,
+ STARRED: 2,
+ SUBSCRIPTIONS: 3,
+ SHARED: 4
+ });
+ // make sure that the CSRF header is only sent to the ownCloud domain
+ $provide.factory('CSRFInterceptor', function ($q, BASE_URL) {
+ return {
+ request: function (config) {
+ if (config.url.indexOf(BASE_URL) === 0) {
+ config.headers.requesttoken = oc_requesttoken;
+ }
+ return config || $q.when(config);
+ }
+ };
+ });
+ $httpProvider.interceptors.push('CSRFInterceptor');
+ // routing
$routeProvider.when('/items', {
- controller: 'AllItemsController',
+ controller: 'ItemsController',
templateUrl: 'content.html',
resolve: {}
}).when('/items/starred', {
- controller: 'StarredItemsController',
+ controller: 'StarredController',
templateUrl: 'content.html',
resolve: {}
}).when('/items/feeds/:id', {
- controller: 'FeedItemsController',
+ controller: 'FeedController',
templateUrl: 'content.html',
resolve: {}
}).when('/items/folders/:id', {
- controller: 'FolderItemsController',
+ controller: 'FolderController',
templateUrl: 'content.html',
resolve: {}
}).otherwise({ redirectTo: '/items' });
@@ -36,15 +58,20 @@ app.config([
app.run([
'$rootScope',
'$location',
+ '$http',
+ '$q',
'Loading',
- 'Setup',
'Item',
'Feed',
'Folder',
- 'Publisher',
'Settings',
- function ($rootScope, $location, Loading, Setup, Item, Feed, Folder, Publisher, Settings) {
+ 'Publisher',
+ 'BASE_URL',
+ 'FEED_TYPE',
+ function ($rootScope, $location, $http, $q, Loading, Item, Feed, Folder, Settings, Publisher, BASE_URL, FEED_TYPE) {
'use strict';
+ // show Loading screen
+ Loading.setLoading('global', true);
// listen to keys in returned queries to automatically distribute the
// incoming values to models
Publisher.subscribe(Item).toChannel('items');
@@ -52,7 +79,37 @@ app.run([
Publisher.subscribe(Feed).toChannel('feeds');
Publisher.subscribe(Settings).toChannel('settings');
// load feeds, settings and last read feed
- Setup.load();
+ var settingsDeferred, activeFeedDeferred;
+ settingsDeferred = $q.defer();
+ $http.get(BASE_URL + '/settings').then(function (data) {
+ Publisher.publishAll(data);
+ settingsDeferred.resolve();
+ });
+ activeFeedDeferred = $q.defer();
+ $http.get(BASE_URL + '/feeds/active').then(function (data) {
+ var url;
+ switch (data.type) {
+ case FEED_TYPE.FEED:
+ url = '/items/feeds/' + data.id;
+ break;
+ case FEED_TYPE.FOLDER:
+ url = '/items/folders/' + data.id;
+ break;
+ case FEED_TYPE.STARRED:
+ url = '/items/starred';
+ break;
+ default:
+ url = '/items';
+ }
+ $location.path(url);
+ activeFeedDeferred.resolve();
+ });
+ $q.all([
+ settingsDeferred.promise,
+ activeFeedDeferred.promise
+ ]).then(function () {
+ Loading.setLoading('global', false);
+ });
$rootScope.$on('$routeChangeStart', function () {
Loading.setLoading('content', true);
});
@@ -65,6 +122,30 @@ app.run([
});
}
]);
+app.controller('AppController', [
+ 'Loading',
+ 'Feed',
+ 'Folder',
+ function (Loading, Feed, Folder) {
+ 'use strict';
+ this.loading = Loading;
+ this.isFirstRun = function () {
+ return Feed.size() === 0 && Folder.size() === 0;
+ };
+ }
+]);
+app.controller('ItemsController', function () {
+ 'use strict';
+ console.log('here');
+});
+app.controller('NavigationController', function () {
+ 'use strict';
+ console.log('here');
+});
+app.controller('SettingsController', function () {
+ 'use strict';
+ console.log('here');
+});
app.factory('Feed', [
'Model',
function (Model) {
@@ -102,7 +183,8 @@ app.service('Loading', function () {
'use strict';
this.loading = {
global: false,
- content: false
+ content: false,
+ autopaging: false
};
this.setLoading = function (area, isLoading) {
this.loading[area] = isLoading;
@@ -189,7 +271,7 @@ app.service('Publisher', function () {
this.publishAll = function (data) {
var channel, counter;
for (channel in data) {
- if (data.hasOwnProperty(channel)) {
+ if (data.hasOwnProperty(channel) && this.channels[channel] !== undefined) {
for (counter = 0; counter < this.channels[channel].length; counter += 1) {
this.channels[channel][counter].receive(data[channel]);
}
@@ -197,11 +279,23 @@ app.service('Publisher', function () {
}
};
});
-app.service('Setup', function () {
+app.service('Settings', function () {
'use strict';
- this.load = function () {
- console.log('init');
+ this.settings = {};
+ this.receive = function (data) {
+ var key;
+ for (key in data) {
+ if (data.hasOwnProperty(key)) {
+ this.settings[key] = data[key];
+ }
+ }
+ };
+ this.get = function (key) {
+ return this.settings[key];
+ };
+ this.set = function (key, value) {
+ this.settings[key] = value;
};
});
-})(angular, jQuery, OC); \ No newline at end of file
+})(angular, jQuery, OC, oc_requesttoken); \ No newline at end of file
diff --git a/js/controller/AppController.js b/js/controller/AppController.js
new file mode 100644
index 000000000..ee8115c84
--- /dev/null
+++ b/js/controller/AppController.js
@@ -0,0 +1,19 @@
+/**
+ * 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