From d65fa8090469286396342ff2299b58b79d83f8f3 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 23 Mar 2013 16:08:39 +0100 Subject: fixed dicontainer and added basic controllers --- js/app/controllers/controllers.coffee | 43 +++++ js/app/controllers/feedcontroller.coffee | 31 ++++ js/app/controllers/itemcontroller.coffee | 31 ++++ js/app/controllers/settingscontroller.coffee | 31 ++++ js/app/services/services.coffee | 11 +- js/public/app.js | 185 ++++++++++++++++++++- js/tests/controllers/feedcontrollerSpec.coffee | 27 +++ js/tests/controllers/itemcontrollerSpec.coffee | 27 +++ js/tests/controllers/settingscontrollerSpec.coffee | 27 +++ 9 files changed, 408 insertions(+), 5 deletions(-) create mode 100644 js/app/controllers/controllers.coffee create mode 100644 js/app/controllers/feedcontroller.coffee create mode 100644 js/app/controllers/itemcontroller.coffee create mode 100644 js/app/controllers/settingscontroller.coffee create mode 100644 js/tests/controllers/feedcontrollerSpec.coffee create mode 100644 js/tests/controllers/itemcontrollerSpec.coffee create mode 100644 js/tests/controllers/settingscontrollerSpec.coffee (limited to 'js') diff --git a/js/app/controllers/controllers.coffee b/js/app/controllers/controllers.coffee new file mode 100644 index 000000000..55566f7d0 --- /dev/null +++ b/js/app/controllers/controllers.coffee @@ -0,0 +1,43 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . + +### + +angular.module('News').controller 'SettingsController', +['$scope', '_SettingsController', +($scope, _SettingsController)-> + + return new _SettingsController($scope) +] + + +angular.module('News').controller 'FeedController', +['$scope', '_FeedController', 'FolderModel', 'FeedModel', +($scope, _FeedController, FolderModel, FeedModel)-> + + return new _FeedController($scope, FolderModel, FeedModel) +] + +angular.module('News').controller 'ItemController', +['$scope', '_ItemController', 'ItemModel', +($scope, _ItemController, ItemModel)-> + + return new _ItemController($scope, ItemModel) +] \ No newline at end of file diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee new file mode 100644 index 000000000..a641a8a9c --- /dev/null +++ b/js/app/controllers/feedcontroller.coffee @@ -0,0 +1,31 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . + +### + + +angular.module('News').factory '_FeedController', -> + + class FeedController + + constructor: (@$scope, @folderModel, @feedModel) -> + + + return FeedController \ No newline at end of file diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee new file mode 100644 index 000000000..3350c674e --- /dev/null +++ b/js/app/controllers/itemcontroller.coffee @@ -0,0 +1,31 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . + +### + + +angular.module('News').factory '_ItemController', -> + + class ItemController + + constructor: (@$scope, @itemModel) -> + + + return ItemController \ No newline at end of file diff --git a/js/app/controllers/settingscontroller.coffee b/js/app/controllers/settingscontroller.coffee new file mode 100644 index 000000000..0383b13fe --- /dev/null +++ b/js/app/controllers/settingscontroller.coffee @@ -0,0 +1,31 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . + +### + + +angular.module('News').factory '_SettingsController', -> + + class SettingsController + + constructor: (@$scope) -> + + + return SettingsController \ No newline at end of file diff --git a/js/app/services/services.coffee b/js/app/services/services.coffee index 31b33871c..08d4d6274 100644 --- a/js/app/services/services.coffee +++ b/js/app/services/services.coffee @@ -23,9 +23,9 @@ License along with this library. If not, see . # request related stuff angular.module('News').factory 'Persistence', ['_Persistence', 'Request', -'Loading', 'Config', '$rootScope', 'ActiveFeed', -(_Persistence, Request, Loading, Config, ActiveFeed, $rootScope) -> - return new _Persistence(Request, Loading, Config, ActiveFeed, $rootScope) +'FeedLoading', 'Config', '$rootScope', 'ActiveFeed', +(_Persistence, Request, FeedLoading, Config, ActiveFeed, $rootScope) -> + return new _Persistence(Request, FeedLoading, Config, ActiveFeed, $rootScope) ] angular.module('News').factory 'Request', @@ -34,6 +34,11 @@ angular.module('News').factory 'Request', return new _Request($http, Publisher, Router) ] +# loading helpers +angular.module('News').factory 'FeedLoading', +['_Loading', (_Loading) -> + return new _Loading() +] # models angular.module('News').factory 'ActiveFeed', ['_ActiveFeed', (_ActiveFeed) -> diff --git a/js/public/app.js b/js/public/app.js index 84953edac..d7b0d2f2a 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -88,6 +88,181 @@ License along with this library. If not, see . */ +(function() { + + angular.module('News').controller('SettingsController', [ + '$scope', '_SettingsController', function($scope, _SettingsController) { + return new _SettingsController($scope); + } + ]); + + angular.module('News').controller('FeedController', [ + '$scope', '_FeedController', 'FolderModel', 'FeedModel', function($scope, _FeedController, FolderModel, FeedModel) { + return new _FeedController($scope, FolderModel, FeedModel); + } + ]); + + angular.module('News').controller('ItemController', [ + '$scope', '_ItemController', 'ItemModel', function($scope, _ItemController, ItemModel) { + return new _ItemController($scope, ItemModel); + } + ]); + +}).call(this); + +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . +*/ + + +(function() { + + angular.module('News').factory('_FeedController', function() { + var FeedController; + FeedController = (function() { + + function FeedController($scope, folderModel, feedModel) { + this.$scope = $scope; + this.folderModel = folderModel; + this.feedModel = feedModel; + } + + return FeedController; + + })(); + return FeedController; + }); + +}).call(this); + +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . +*/ + + +(function() { + + angular.module('News').factory('_ItemController', function() { + var ItemController; + ItemController = (function() { + + function ItemController($scope, itemModel) { + this.$scope = $scope; + this.itemModel = itemModel; + } + + return ItemController; + + })(); + return ItemController; + }); + +}).call(this); + +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . +*/ + + +(function() { + + angular.module('News').factory('_SettingsController', function() { + var SettingsController; + SettingsController = (function() { + + function SettingsController($scope) { + this.$scope = $scope; + } + + return SettingsController; + + })(); + return SettingsController; + }); + +}).call(this); + +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . +*/ + + (function() { angular.module('News').factory('_ActiveFeed', function() { @@ -857,8 +1032,8 @@ License along with this library. If not, see . (function() { angular.module('News').factory('Persistence', [ - '_Persistence', 'Request', 'Loading', 'Config', '$rootScope', 'ActiveFeed', function(_Persistence, Request, Loading, Config, ActiveFeed, $rootScope) { - return new _Persistence(Request, Loading, Config, ActiveFeed, $rootScope); + '_Persistence', 'Request', 'FeedLoading', 'Config', '$rootScope', 'ActiveFeed', function(_Persistence, Request, FeedLoading, Config, ActiveFeed, $rootScope) { + return new _Persistence(Request, FeedLoading, Config, ActiveFeed, $rootScope); } ]); @@ -868,6 +1043,12 @@ License along with this library. If not, see . } ]); + angular.module('News').factory('FeedLoading', [ + '_Loading', function(_Loading) { + return new _Loading(); + } + ]); + angular.module('News').factory('ActiveFeed', [ '_ActiveFeed', function(_ActiveFeed) { return new _ActiveFeed(); diff --git a/js/tests/controllers/feedcontrollerSpec.coffee b/js/tests/controllers/feedcontrollerSpec.coffee new file mode 100644 index 000000000..a8b1df227 --- /dev/null +++ b/js/tests/controllers/feedcontrollerSpec.coffee @@ -0,0 +1,27 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . + +### + + +describe '_FeedController', -> + + + beforeEach module 'News' \ No newline at end of file diff --git a/js/tests/controllers/itemcontrollerSpec.coffee b/js/tests/controllers/itemcontrollerSpec.coffee new file mode 100644 index 000000000..32d6651a7 --- /dev/null +++ b/js/tests/controllers/itemcontrollerSpec.coffee @@ -0,0 +1,27 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . + +### + + +describe '_ItemController', -> + + + beforeEach module 'News' \ No newline at end of file diff --git a/js/tests/controllers/settingscontrollerSpec.coffee b/js/tests/controllers/settingscontrollerSpec.coffee new file mode 100644 index 000000000..aa66b6878 --- /dev/null +++ b/js/tests/controllers/settingscontrollerSpec.coffee @@ -0,0 +1,27 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.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 . + +### + + +describe '_SettingsController', -> + + + beforeEach module 'News' \ No newline at end of file -- cgit v1.2.3