dont show loading sign when updating feeds and folders, fix #153

This commit is contained in:
Bernhard Posselt 2013-05-06 11:50:50 +02:00
Родитель 17356ec05f
Коммит 5981406dc0
3 изменённых файлов: 37 добавлений и 20 удалений

Просмотреть файл

@ -39,8 +39,8 @@ angular.module('News').run ['Persistence', 'Config',
Persistence.init() Persistence.init()
setInterval -> setInterval ->
Persistence.getAllFeeds() Persistence.getAllFeeds(null, false)
Persistence.getAllFolders() Persistence.getAllFolders(null, false)
, Config.feedUpdateInterval , Config.feedUpdateInterval
] ]

Просмотреть файл

@ -238,16 +238,23 @@ $rootScope) ->
### ###
FOLDER CONTROLLER FOLDER CONTROLLER
### ###
getAllFolders: (onSuccess) -> getAllFolders: (onSuccess, showLoading=true) ->
onSuccess or= -> onSuccess or= ->
# loading sign handling # loading sign handling
@_feedLoading.increase() if showLoading
successCallbackWrapper = (data) => @_feedLoading.increase()
onSuccess() successCallbackWrapper = (data) =>
@_feedLoading.decrease() onSuccess()
failureCallbackWrapper = (data) => @_feedLoading.decrease()
@_feedLoading.decrease() failureCallbackWrapper = (data) =>
@_feedLoading.decrease()
else
successCallbackWrapper = (data) =>
onSuccess()
failureCallbackWrapper = (data) =>
params = params =
onSuccess: successCallbackWrapper onSuccess: successCallbackWrapper

Просмотреть файл

@ -51,8 +51,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
'Persistence', 'Config', function(Persistence, Config) { 'Persistence', 'Config', function(Persistence, Config) {
Persistence.init(); Persistence.init();
return setInterval(function() { return setInterval(function() {
Persistence.getAllFeeds(); Persistence.getAllFeeds(null, false);
return Persistence.getAllFolders(); return Persistence.getAllFolders(null, false);
}, Config.feedUpdateInterval); }, Config.feedUpdateInterval);
} }
]); ]);
@ -2682,19 +2682,29 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/ */
Persistence.prototype.getAllFolders = function(onSuccess) { Persistence.prototype.getAllFolders = function(onSuccess, showLoading) {
var failureCallbackWrapper, params, successCallbackWrapper, var failureCallbackWrapper, params, successCallbackWrapper,
_this = this; _this = this;
if (showLoading == null) {
showLoading = true;
}
onSuccess || (onSuccess = function() {}); onSuccess || (onSuccess = function() {});
this._feedLoading.increase(); if (showLoading) {
successCallbackWrapper = function(data) { this._feedLoading.increase();
onSuccess(); successCallbackWrapper = function(data) {
return _this._feedLoading.decrease(); onSuccess();
}; return _this._feedLoading.decrease();
failureCallbackWrapper = function(data) { };
return _this._feedLoading.decrease(); failureCallbackWrapper = function(data) {
}; return _this._feedLoading.decrease();
};
} else {
successCallbackWrapper = function(data) {
return onSuccess();
};
failureCallbackWrapper = function(data) {};
}
params = { params = {
onSuccess: successCallbackWrapper, onSuccess: successCallbackWrapper,
onFailure: failureCallbackWrapper onFailure: failureCallbackWrapper