From 145ba6a487657c9864500c94dd3a89d9af8f4a87 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 15 May 2014 14:17:55 +0200 Subject: add some notes --- .scrutinizer.yml | 4 ++-- js/Gruntfile.js | 23 ++++++++++++++++++----- js/config/config.js | 4 ++-- js/config/run.js | 9 ++++++--- js/notes.md | 35 +++++++++++++++++++++++++++++++++++ js/service/loading.js | 13 ++++++++----- js/service/setup.js | 17 +++++++++++++++++ js/tests/unit/service/LoadingSpec.js | 7 ++++--- 8 files changed, 92 insertions(+), 20 deletions(-) create mode 100644 js/notes.md create mode 100644 js/service/setup.js 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 * @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 + * @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 -- cgit v1.2.3