summaryrefslogtreecommitdiffstats
path: root/js/app
diff options
context:
space:
mode:
Diffstat (limited to 'js/app')
-rw-r--r--js/app/app.coffee2
-rw-r--r--js/app/controllers/appcontroller.coffee42
-rw-r--r--js/app/services/businesslayer/feedbusinesslayer.coffee3
-rw-r--r--js/app/services/persistence.coffee15
4 files changed, 56 insertions, 6 deletions
diff --git a/js/app/app.coffee b/js/app/app.coffee
index 9b33812ad..03a25c6c4 100644
--- a/js/app/app.coffee
+++ b/js/app/app.coffee
@@ -37,8 +37,6 @@ angular.module('News', ['OC', 'ui']).config ($provide) ->
angular.module('News').run ['Persistence', 'Config',
(Persistence, Config) ->
- Persistence.init()
-
setInterval ->
Persistence.getAllFeeds(null, false)
Persistence.getAllFolders(null, false)
diff --git a/js/app/controllers/appcontroller.coffee b/js/app/controllers/appcontroller.coffee
new file mode 100644
index 000000000..bcb256077
--- /dev/null
+++ b/js/app/controllers/appcontroller.coffee
@@ -0,0 +1,42 @@
+###
+
+ownCloud - News
+
+@author Alessandro Cosentino
+@copyright 2013 Alessandro Cosentino cosenal@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').controller 'AppController',
+['$scope', 'Persistence', 'FeedBusinessLayer',
+($scope, Persistence, FeedBusinessLayer) ->
+
+ class AppController
+
+ constructor: (@_$scope, @_persistence, @_feedBusinessLayer) ->
+
+ @_$scope.initialized = false
+ @_$scope.feedBusinessLayer = @_feedBusinessLayer
+
+ successCallback = =>
+ @_$scope.initialized = true
+
+ @_persistence.init().then(successCallback)
+
+ return new AppController($scope, Persistence, FeedBusinessLayer)
+
+] \ No newline at end of file
diff --git a/js/app/services/businesslayer/feedbusinesslayer.coffee b/js/app/services/businesslayer/feedbusinesslayer.coffee
index b26806ac8..cff714ac0 100644
--- a/js/app/services/businesslayer/feedbusinesslayer.coffee
+++ b/js/app/services/businesslayer/feedbusinesslayer.coffee
@@ -81,6 +81,9 @@ FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem)->
getNumberOfFeeds: ->
return @_feedModel.size()
+ noFeeds: ->
+ return @getNumberOfFeeds() == 0
+
isVisible: (feedId) ->
if @isActive(feedId) or @_showAll.getShowAll()
diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee
index 59a28489c..e1562fc46 100644
--- a/js/app/services/persistence.coffee
+++ b/js/app/services/persistence.coffee
@@ -22,9 +22,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory 'Persistence',
['Request', 'FeedLoading', 'AutoPageLoading', 'NewLoading', 'Config',
-'ActiveFeed', '$rootScope',
+'ActiveFeed', '$rootScope', '$q'
(Request, FeedLoading, AutoPageLoading, NewLoading, Config, ActiveFeed,
-$rootScope) ->
+$rootScope, $q) ->
class Persistence
@@ -37,15 +37,22 @@ $rootScope) ->
Loads the initial data from the server
###
+ @deferred = $q.defer()
+
# items can only be loaded after the active feed is known
@getActiveFeed =>
@getItems(@_activeFeed.getType(), @_activeFeed.getId())
-
+
@getAllFolders()
- @getAllFeeds()
+
+ successCallback = =>
+ @deferred.resolve()
+
+ @getAllFeeds(successCallback)
@userSettingsRead()
@userSettingsLanguage()
+ @deferred.promise
###
ITEM CONTROLLER