summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-15 14:17:55 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-15 14:17:55 +0200
commit145ba6a487657c9864500c94dd3a89d9af8f4a87 (patch)
tree0f529b63d82e4f391dc64fb9ec1b9add497759e7
parent9d3de6d0959e73096ce0fa0ad9f6f7c702b0e0a8 (diff)
add some notes
-rw-r--r--.scrutinizer.yml4
-rw-r--r--js/Gruntfile.js23
-rw-r--r--js/config/config.js4
-rw-r--r--js/config/run.js9
-rw-r--r--js/notes.md35
-rw-r--r--js/service/loading.js13
-rw-r--r--js/service/setup.js17
-rw-r--r--js/tests/unit/service/LoadingSpec.js7
8 files changed, 92 insertions, 20 deletions
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index e0c858af6..abac30f4d 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -2,13 +2,13 @@ filter:
excluded_paths:
- '3rdparty/*'
- 'js/vendor/*'
- - 'js/public/*'
+ - 'js/build/*'
- 'l10n/*'
- 'templates/*'
- 'img/*'
- 'css/*'
- 'bin/*'
-
+
imports:
- javascript
- php
diff --git a/js/Gruntfile.js b/js/Gruntfile.js
index b5e13b074..4bc803072 100644
--- a/js/Gruntfile.js
+++ b/js/Gruntfile.js
@@ -8,6 +8,23 @@
* @copyright Bernhard Posselt 2012, 2014
*/
+var globals = [
+ '$',
+ 'angular',
+ 'app',
+ 'OC',
+ 'protractor',
+ 'describe',
+ 'beforeEach',
+ 'module',
+ 'it',
+ 'browser',
+ 'expect',
+ 'By',
+ 'inject',
+ 'console'
+];
+
module.exports = function(grunt) {
// load needed modules
@@ -78,11 +95,7 @@ module.exports = function(grunt) {
],
directives: {
browser: true,
- predef: [
- '$', 'angular', 'app', 'OC',
- 'protractor', 'describe', 'beforeEach', 'module', 'it',
- 'browser', 'expect', 'By', 'inject'
- ]
+ predef: globals
}
}
},
diff --git a/js/config/config.js b/js/config/config.js
index 1abaede89..88c965856 100644
--- a/js/config/config.js
+++ b/js/config/config.js
@@ -23,12 +23,12 @@ app.config(function ($routeProvider, $provide) {
templateUrl: 'content.html',
resolve: {}
})
- .when('/items/feed/:feedId', {
+ .when('/items/feeds/:id', {
controller: 'FeedItemsController',
templateUrl: 'content.html',
resolve: {}
})
- .when('/items/folder/:folderId', {
+ .when('/items/folders/:id', {
controller: 'FolderItemsController',
templateUrl: 'content.html',
resolve: {}
diff --git a/js/config/run.js b/js/config/run.js
index 1c87228fe..2bf9de7d6 100644
--- a/js/config/run.js
+++ b/js/config/run.js
@@ -7,15 +7,18 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2012, 2014
*/
-app.run(function ($rootScope, $location, Loading) {
+app.run(function ($rootScope, $location, Loading, Setup) {
'use strict';
+ // load feeds, settings and last read feed
+ Setup.load();
+
$rootScope.$on('$routeChangeStart', function () {
- Loading.isActive = true;
+ Loading.setLoading('content', true);
});
$rootScope.$on('$routeChangeSuccess', function () {
- Loading.isActive = false;
+ Loading.setLoading('content', false);
});
// in case of wrong id etc show all items
diff --git a/js/notes.md b/js/notes.md
new file mode 100644
index 000000000..59e84aad3
--- /dev/null
+++ b/js/notes.md
@@ -0,0 +1,35 @@
+# TODO
+Plans and notes how stuff should be set up
+
+## Urls
+* **/items**
+* **/items/starred**
+* **/items/feeds/:id**
+* **/items/folders/:id**
+
+## Controllers
+Left navigation:
+
+* NavigationController
+
+Right content:
+
+* AllItemsController
+* FeedItemsController
+* FolderItemsController
+* StarredItemsController
+
+## Settings
+* preventReadOnScroll
+* languageCode
+* compact
+* oldestFirst: needs reload
+* showAll: needs reload
+
+## On start
+* show global loading, load feeds, load settings, load last used feed -> service Setup.load()
+* handle route events (in Setup?)
+* redirect to last used feed (in Setup?)
+
+## Compact view
+* use ng-if to prevent registering tons of listeners? Using ng-class made previous interface slower, but also leads to duplication. Then again more freedom \ No newline at end of file
diff --git a/js/service/loading.js b/js/service/loading.js
index 1b6ecffd0..e15d0fd7a 100644
--- a/js/service/loading.js
+++ b/js/service/loading.js
@@ -10,14 +10,17 @@
app.service('Loading', function () {
'use strict';
- this.loading = false;
+ this.loading = {
+ global: false,
+ content: false
+ };
- this.setLoading = function (isLoading) {
- this.loading = isLoading;
+ this.setLoading = function (area, isLoading) {
+ this.loading[area] = isLoading;
};
- this.isLoading = function () {
- return this.loading;
+ this.isLoading = function (area) {
+ return this.loading[area];
};
}); \ No newline at end of file
diff --git a/js/service/setup.js b/js/service/setup.js
new file mode 100644
index 000000000..07f4c605f
--- /dev/null
+++ b/js/service/setup.js
@@ -0,0 +1,17 @@
+/**
+ * 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 2012, 2014
+ */
+app.service('Setup', function () {
+ 'use strict';
+
+ this.load = function () {
+ console.log('init');
+ };
+
+}); \ No newline at end of file
diff --git a/js/tests/unit/service/LoadingSpec.js b/js/tests/unit/service/LoadingSpec.js
index cae049c99..0067b6015 100644
--- a/js/tests/unit/service/LoadingSpec.js
+++ b/js/tests/unit/service/LoadingSpec.js
@@ -13,12 +13,13 @@ describe('Loading', function () {
beforeEach(module('News'));
it('should be not load by default', inject(function (Loading) {
- expect(Loading.isLoading()).toBe(false);
+ expect(Loading.isLoading('global')).toBe(false);
+ expect(Loading.isLoading('content')).toBe(false);
}));
it('should set loading', inject(function (Loading) {
- Loading.setLoading(true);
- expect(Loading.isLoading()).toBe(true);
+ Loading.setLoading('global', true);
+ expect(Loading.isLoading('global')).toBe(true);
}));
}); \ No newline at end of file