summaryrefslogtreecommitdiffstats
path: root/js/app
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-08 17:56:53 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-08 17:56:53 +0200
commitca0864dbcd2b01a31a997c1db28aa241512dcb5f (patch)
treeb6881722220ae3f47bb3d502091d3d0dc736975a /js/app
parente6d926de620a470a487010f02b47e3932512db93 (diff)
prework for adding folders
Diffstat (limited to 'js/app')
-rw-r--r--js/app/services/bl/folderbl.coffee10
-rw-r--r--js/app/services/existserror.coffee32
2 files changed, 40 insertions, 2 deletions
diff --git a/js/app/services/bl/folderbl.coffee b/js/app/services/bl/folderbl.coffee
index 6085ca50e..68031371a 100644
--- a/js/app/services/bl/folderbl.coffee
+++ b/js/app/services/bl/folderbl.coffee
@@ -23,9 +23,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory 'FolderBl',
['_Bl', 'FolderModel', 'FeedBl', 'Persistence', 'FeedType', 'ActiveFeed',
-'ItemModel', 'ShowAll',
+'ItemModel', 'ShowAll', '_ExistsError',
(_Bl, FolderModel, FeedBl, Persistence, FeedType, ActiveFeed,
-ItemModel, ShowAll)->
+ItemModel, ShowAll, _ExistsError)->
class FolderBl extends _Bl
@@ -81,6 +81,12 @@ ItemModel, ShowAll)->
return @_folderModel.getAll()
+ create: (folderName) ->
+ if @_folderModel.nameExists(folderName)
+ throw new _ExistsError()
+
+
+
return new FolderBl(FolderModel, FeedBl, ShowAll, ActiveFeed, Persistence,
FeedType, ItemModel)
diff --git a/js/app/services/existserror.coffee b/js/app/services/existserror.coffee
new file mode 100644
index 000000000..cb9fab54e
--- /dev/null
+++ b/js/app/services/existserror.coffee
@@ -0,0 +1,32 @@
+###
+
+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 <http://www.gnu.org/licenses/>.
+
+###
+
+
+angular.module('News').factory '_ExistsError', ->
+
+ class ExistsError extends Error
+
+ constructor: (message='') ->
+ super(message)
+
+
+ return ExistsError \ No newline at end of file