diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-19 16:00:08 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-19 16:00:08 +0200 |
commit | 274034a63374434298204db21e6d6513690e6eaf (patch) | |
tree | 7dcda9aebb41120fc2619248f4609e4df5912fd3 /js | |
parent | 11f0246acd0daab1067eb32099fa26f05a26ea21 (diff) |
put models into seperate folder
Diffstat (limited to 'js')
-rw-r--r-- | js/Gruntfile.js | 3 | ||||
-rw-r--r-- | js/build/app.js | 118 | ||||
-rw-r--r-- | js/karma.conf.js | 1 | ||||
-rw-r--r-- | js/model/Feed.js (renamed from js/service/Feed.js) | 0 | ||||
-rw-r--r-- | js/model/Folder.js (renamed from js/service/Folder.js) | 0 | ||||
-rw-r--r-- | js/model/Item.js (renamed from js/service/Item.js) | 0 | ||||
-rw-r--r-- | js/model/Model.js (renamed from js/service/Model.js) | 0 | ||||
-rw-r--r-- | js/tests/unit/models/ItemSpec.js (renamed from js/tests/unit/service/ItemSpec.js) | 0 | ||||
-rw-r--r-- | js/tests/unit/models/ModelSpec.js (renamed from js/tests/unit/service/ModelSpec.js) | 0 | ||||
-rw-r--r-- | js/tests/unit/service/PublisherSpec.js | 4 |
10 files changed, 65 insertions, 61 deletions
diff --git a/js/Gruntfile.js b/js/Gruntfile.js index 5dd29b9fc..7a4573c6c 100644 --- a/js/Gruntfile.js +++ b/js/Gruntfile.js @@ -70,6 +70,7 @@ module.exports = function (grunt) { 'controller/**/*.js', 'filter/**/*.js', 'service/**/*.js', + 'model/**/*.js', 'directive/**/*.js' ], dest: '<%= meta.production %>app.js' @@ -99,6 +100,7 @@ module.exports = function (grunt) { 'app/**/*.js', 'filter/**/*.js', 'service/**/*.js', + 'model/**/*.js', 'controller/**/*.js', 'directive/**/*.js', 'tests/**/*.js', @@ -118,6 +120,7 @@ module.exports = function (grunt) { 'tests/**/*.js', 'app/**/*.js', 'controller/**/*.js', + 'model/**/*.js', 'directive/**/*.js', 'filter/**/*.js', 'service/**/*.js', diff --git a/js/build/app.js b/js/build/app.js index d2a4e54c1..ffb062350 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -202,6 +202,65 @@ app.controller('SettingsController', function () { 'use strict'; console.log('here'); }); +app.service('Loading', function () { + 'use strict'; + this.loading = { + global: false, + content: false, + autopaging: false + }; + this.setLoading = function (area, isLoading) { + this.loading[area] = isLoading; + }; + this.isLoading = function (area) { + return this.loading[area]; + }; +}); +app.service('Publisher', function () { + 'use strict'; + var self = this; + this.channels = {}; + this.subscribe = function (object) { + return { + toChannels: function () { + var counter, channel; + for (counter = 0; counter < arguments.length; counter += 1) { + channel = arguments[counter]; + self.channels[channel] = self.channels[channel] || []; + self.channels[channel].push(object); + } + } + }; + }; + this.publishAll = function (data) { + var channel, counter; + for (channel in data) { + 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], channel); + } + } + } + }; +}); +app.service('Settings', function () { + 'use strict'; + 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; + }; +}); app.factory('Feed', [ 'Model', function (Model) { @@ -253,20 +312,6 @@ app.factory('Item', [ return new Item(); } ]); -app.service('Loading', function () { - 'use strict'; - this.loading = { - global: false, - content: false, - autopaging: false - }; - this.setLoading = function (area, isLoading) { - this.loading[area] = isLoading; - }; - this.isLoading = function (area) { - return this.loading[area]; - }; -}); app.factory('Model', function () { 'use strict'; var Model = function (id) { @@ -330,50 +375,5 @@ app.factory('Model', function () { }; return Model; }); -app.service('Publisher', function () { - 'use strict'; - var self = this; - this.channels = {}; - this.subscribe = function (object) { - return { - toChannels: function () { - var counter, channel; - for (counter = 0; counter < arguments.length; counter += 1) { - channel = arguments[counter]; - self.channels[channel] = self.channels[channel] || []; - self.channels[channel].push(object); - } - } - }; - }; - this.publishAll = function (data) { - var channel, counter; - for (channel in data) { - 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], channel); - } - } - } - }; -}); -app.service('Settings', function () { - 'use strict'; - 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, oc_requesttoken);
\ No newline at end of file diff --git a/js/karma.conf.js b/js/karma.conf.js index 91118736c..5b33469dd 100644 --- a/js/karma.conf.js +++ b/js/karma.conf.js @@ -29,6 +29,7 @@ module.exports = function (config) { 'controller/**/*.js', 'filter/**/*.js', 'service/**/*.js', + 'model/**/*.js', 'directive/**/*.js', 'tests/unit/**/*Spec.js' ], diff --git a/js/service/Feed.js b/js/model/Feed.js index 9223ca6e7..9223ca6e7 100644 --- a/js/service/Feed.js +++ b/js/model/Feed.js diff --git a/js/service/Folder.js b/js/model/Folder.js index 101b8ec66..101b8ec66 100644 --- a/js/service/Folder.js +++ b/js/model/Folder.js diff --git a/js/service/Item.js b/js/model/Item.js index ec3512f22..ec3512f22 100644 --- a/js/service/Item.js +++ b/js/model/Item.js diff --git a/js/service/Model.js b/js/model/Model.js index dddede788..dddede788 100644 --- a/js/service/Model.js +++ b/js/model/Model.js diff --git a/js/tests/unit/service/ItemSpec.js b/js/tests/unit/models/ItemSpec.js index 85ee5789e..85ee5789e 100644 --- a/js/tests/unit/service/ItemSpec.js +++ b/js/tests/unit/models/ItemSpec.js diff --git a/js/tests/unit/service/ModelSpec.js b/js/tests/unit/models/ModelSpec.js index 57b0f422c..57b0f422c 100644 --- a/js/tests/unit/service/ModelSpec.js +++ b/js/tests/unit/models/ModelSpec.js diff --git a/js/tests/unit/service/PublisherSpec.js b/js/tests/unit/service/PublisherSpec.js index 8d7b65e58..06cd48c6a 100644 --- a/js/tests/unit/service/PublisherSpec.js +++ b/js/tests/unit/service/PublisherSpec.js @@ -13,10 +13,10 @@ describe('Publisher', function () { beforeEach(module('News')); it('should should publish on all possible channels', inject(function (Publisher) { - var obj = { receive: jasmine.createSpy('receive') }; + Publisher.subscribe(obj).toChannels('test'); Publisher.publishAll({ @@ -28,10 +28,10 @@ describe('Publisher', function () { it('should should publish on all possible channels', inject(function (Publisher) { - var obj = { receive: jasmine.createSpy('receive') }; + Publisher.subscribe(obj).toChannels('test', 'tiny'); Publisher.publishAll({ |