load new feed when it was added

This commit is contained in:
Bernhard Posselt 2013-04-11 19:50:17 +02:00
Родитель aa208e38b6
Коммит f16b8e1d92
4 изменённых файлов: 11 добавлений и 8 удалений

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

@ -55,9 +55,10 @@ angular.module('News').factory '_FeedController',
@_isAddingFeed = true
@_feedBl.create feedUrl, parentFolderId
# on success
, =>
, (data) =>
@_$scope.feedUrl = ''
@_isAddingFeed = false
@_feedBl.load(data['feeds'][0].id)
# on error
, =>
@_isAddingFeed = false

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

@ -153,7 +153,7 @@ NewLoading, _ExistsError) ->
feed.error = response.msg
onFailure()
else
onSuccess()
onSuccess(response.data)
@_persistence.createFeed url, parentId, success

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

@ -296,9 +296,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
_this._$scope.feedExistsError = false;
try {
_this._isAddingFeed = true;
return _this._feedBl.create(feedUrl, parentFolderId, function() {
return _this._feedBl.create(feedUrl, parentFolderId, function(data) {
_this._$scope.feedUrl = '';
return _this._isAddingFeed = false;
_this._isAddingFeed = false;
return _this._feedBl.load(data['feeds'][0].id);
}, function() {
return _this._isAddingFeed = false;
});
@ -764,7 +765,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
feed.error = response.msg;
return onFailure();
} else {
return onSuccess();
return onSuccess(response.data);
}
};
return this._persistence.createFeed(url, parentId, success);

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

@ -283,13 +283,14 @@ describe 'FeedBl', ->
onSuccess = jasmine.createSpy('Success')
@persistence.createFeed = jasmine.createSpy('add feed')
@persistence.createFeed.andCallFake (folderName, parentId, success) =>
response =
@response =
status: 'ok'
success(response)
data: 'hi'
success(@response)
@FeedBl.create(' johns ', 0, onSuccess)
expect(onSuccess).toHaveBeenCalled()
expect(onSuccess).toHaveBeenCalledWith(@response.data)
it 'should call the handle a response error when creating a folder', =>