diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/Gruntfile.coffee | 2 | ||||
-rw-r--r-- | js/app/services/persistence.coffee | 64 | ||||
-rw-r--r-- | js/tests/services/persistenceSpec.coffee | 64 |
3 files changed, 66 insertions, 64 deletions
diff --git a/js/Gruntfile.coffee b/js/Gruntfile.coffee index b5e65ccff..e7b25cc6a 100644 --- a/js/Gruntfile.coffee +++ b/js/Gruntfile.coffee @@ -82,6 +82,8 @@ module.exports = (grunt) -> 'level': 'ignore' 'no_trailing_whitespace': 'level': 'warn' + 'max_line_length': + 'level': 'ignore' watch: concat: diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee index 7aee915a2..78daac9ca 100644 --- a/js/app/services/persistence.coffee +++ b/js/app/services/persistence.coffee @@ -101,7 +101,7 @@ $rootScope, $q) -> onFailure: failureCallbackWrapper if not @_preventUselessAutoPageRequest - @_request.get 'news_items', params + @_request.get '/apps/news/items', params else # this case happens if an autopage request is prevented if when # there are no new items. we still have to remove the loading @@ -121,7 +121,7 @@ $rootScope, $q) -> onSuccess: onSuccess onFailure: onSuccess - @_request.get 'news_items_new', params + @_request.get '/apps/news/items/new', params starItem: (feedId, guidHash) -> @@ -133,7 +133,7 @@ $rootScope, $q) -> feedId: feedId guidHash: guidHash - @_request.post 'news_items_star', params + @_request.post '/apps/news/items/{feedId}/{guidHash}/star', params unstarItem: (feedId, guidHash) -> @@ -145,7 +145,7 @@ $rootScope, $q) -> feedId: feedId guidHash: guidHash - @_request.post 'news_items_unstar', params + @_request.post '/apps/news/items/{feedId}/{guidHash}/unstar', params readItem: (itemId) -> @@ -156,7 +156,7 @@ $rootScope, $q) -> routeParams: itemId: itemId - @_request.post 'news_items_read', params + @_request.post '/apps/news/items/{itemId}/read', params @@ -168,7 +168,7 @@ $rootScope, $q) -> routeParams: itemId: itemId - @_request.post 'news_items_unread', params + @_request.post '/apps/news/items/{itemId}/unread', params setAllRead: (highestItemId) -> @@ -179,7 +179,7 @@ $rootScope, $q) -> data: highestItemId: highestItemId - @_request.post 'news_items_all_read', params + @_request.post '/apps/news/items/read', params ### @@ -205,7 +205,7 @@ $rootScope, $q) -> onSuccess: successCallbackWrapper onFailure: failureCallbackWrapper - @_request.get 'news_feeds', params + @_request.get '/apps/news/feeds', params getActiveFeed: (onSuccess) -> @@ -221,7 +221,7 @@ $rootScope, $q) -> onSuccess: successCallbackWrapper onFailure: failureCallbackWrapper - @_request.get 'news_feeds_active', params + @_request.get '/apps/news/feeds/active', params createFeed: (url, parentFolderId, onSuccess=null, onFailure=null) -> @@ -234,7 +234,7 @@ $rootScope, $q) -> onSuccess: onSuccess onFailure: onFailure - @_request.post 'news_feeds_create', params + @_request.post '/apps/news/feeds', params deleteFeed: (feedId) -> @@ -242,7 +242,7 @@ $rootScope, $q) -> routeParams: feedId: feedId - @_request.delete 'news_feeds_delete', params + @_request.delete '/apps/news/feeds/{feedId}', params restoreFeed: (feedId, onSuccess=null) -> @@ -252,7 +252,7 @@ $rootScope, $q) -> routeParams: feedId: feedId - @_request.post 'news_feeds_restore', params + @_request.post '/apps/news/feeds/{feedId}/restore', params moveFeed: (feedId, folderId) -> @@ -265,7 +265,7 @@ $rootScope, $q) -> data: parentFolderId: folderId - @_request.post 'news_feeds_move', params + @_request.post '/apps/news/feeds/{feedId}/move', params renameFeed: (feedId, feedTitle) -> @@ -278,7 +278,7 @@ $rootScope, $q) -> data: feedTitle: feedTitle - @_request.post 'news_feeds_rename', params + @_request.post '/apps/news/feeds/{feedId}/rename', params setFeedRead: (feedId, highestItemId) -> @@ -291,7 +291,7 @@ $rootScope, $q) -> data: highestItemId: highestItemId - @_request.post 'news_feeds_read', params + @_request.post '/apps/news/feeds/{feedId}/read', params updateFeed: (feedId) -> @@ -302,7 +302,7 @@ $rootScope, $q) -> routeParams: feedId: feedId - @_request.post 'news_feeds_update', params + @_request.post '/apps/news/feeds/{feedId}/update', params importArticles: (json, onSuccess) -> @@ -313,7 +313,7 @@ $rootScope, $q) -> @getAllFeeds() onSuccess() - @_request.post 'news_feeds_import_articles', params + @_request.post '/apps/news/feeds/import/articles', params ### @@ -341,7 +341,7 @@ $rootScope, $q) -> onSuccess: successCallbackWrapper onFailure: failureCallbackWrapper - @_request.get 'news_folders', params + @_request.get '/apps/news/folders', params openFolder: (folderId) -> @@ -352,7 +352,7 @@ $rootScope, $q) -> routeParams: folderId: folderId - @_request.post 'news_folders_open', params + @_request.post '/apps/news/folders/{folderId}/open', params collapseFolder: (folderId) -> @@ -363,7 +363,7 @@ $rootScope, $q) -> routeParams: folderId: folderId - @_request.post 'news_folders_collapse', params + @_request.post '/apps/news/folders/{folderId}/collapse', params createFolder: (folderName, parentFolderId=0, onSuccess=null, @@ -378,7 +378,7 @@ $rootScope, $q) -> onSuccess: onSuccess onFailure: onFailure - @_request.post 'news_folders_create', params + @_request.post '/apps/news/folders/create', params deleteFolder: (folderId) -> @@ -389,7 +389,7 @@ $rootScope, $q) -> routeParams: folderId: folderId - @_request.delete 'news_folders_delete', params + @_request.delete '/apps/news/folders/{folderId}', params restoreFolder: (folderId, onSuccess=null) -> @@ -399,7 +399,7 @@ $rootScope, $q) -> routeParams: folderId: folderId - @_request.post 'news_folders_restore', params + @_request.post '/apps/news/folders/{folderId}/restore', params renameFolder: (folderId, folderName) -> @@ -412,7 +412,7 @@ $rootScope, $q) -> data: folderName: folderName - @_request.post 'news_folders_rename', params + @_request.post '/apps/news/folders/{folderId}/rename', params setFolderRead: (folderId, highestItemId) -> @@ -425,7 +425,7 @@ $rootScope, $q) -> data: highestItemId: highestItemId - @_request.post 'news_folders_read', params + @_request.post '/apps/news/folders/{folderId}/read', params @@ -436,7 +436,7 @@ $rootScope, $q) -> ### Prompts for an OPML download ### - @_request.get 'news_export_opml' + @_request.get '/apps/news/export/opml' ### @@ -460,7 +460,7 @@ $rootScope, $q) -> onSuccess: successCallbackWrapper onFailure: failureCallbackWrapper - @_request.get 'news_usersettings_read', params + @_request.get '/apps/news/usersettings/read', params userSettingsReadShow: (callback) -> @@ -469,7 +469,7 @@ $rootScope, $q) -> ### data = onSuccess: callback - @_request.post 'news_usersettings_read_show', data + @_request.post '/apps/news/usersettings/read/show', data userSettingsReadHide: (callback) -> @@ -478,7 +478,7 @@ $rootScope, $q) -> ### data = onSuccess: callback - @_request.post 'news_usersettings_read_hide', data + @_request.post '/apps/news/usersettings/read/hide', data userSettingsLanguage: (onSuccess=null) -> @@ -496,11 +496,11 @@ $rootScope, $q) -> onSuccess: successCallbackWrapper onFailure: failureCallbackWrapper - @_request.get 'news_usersettings_language', data + @_request.get '/apps/news/usersettings/language', data userSettingsIsCompact: -> - @_request.get 'news_usersettings_iscompact' + @_request.get '/apps/news/usersettings/compact' userSettingsSetCompact: (isCompact) -> @@ -511,7 +511,7 @@ $rootScope, $q) -> data: compact: isCompact - @_request.post 'news_usersettings_setcompact', params + @_request.post '/apps/news/usersettings/compact', params _triggerHideRead: -> diff --git a/js/tests/services/persistenceSpec.coffee b/js/tests/services/persistenceSpec.coffee index 707c1e2fa..a8902bc23 100644 --- a/js/tests/services/persistenceSpec.coffee +++ b/js/tests/services/persistenceSpec.coffee @@ -71,7 +71,7 @@ describe 'Persistence', -> limit: @config.itemBatchSize offset: 3 - expect(@req.get).toHaveBeenCalledWith('news_items', expected) + expect(@req.get).toHaveBeenCalledWith('/apps/news/items', expected) it 'should reset the autopage lock when loading a new feed', => @@ -124,7 +124,7 @@ describe 'Persistence', -> @Persistence.getNewItems(params.data.type, params.data.id, params.data.lastModified, success) - expect(@req.get).toHaveBeenCalledWith('news_items_new', params) + expect(@req.get).toHaveBeenCalledWith('/apps/news/items/new', params) it 'send a correct star item request', => @@ -135,7 +135,7 @@ describe 'Persistence', -> @Persistence.starItem(params.routeParams.feedId, params.routeParams.guidHash) - expect(@req.post).toHaveBeenCalledWith('news_items_star', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/items/{feedId}/{guidHash}/star', params) it 'send a correct unstar item request', => @@ -147,7 +147,7 @@ describe 'Persistence', -> @Persistence.unstarItem(params.routeParams.feedId, params.routeParams.guidHash) - expect(@req.post).toHaveBeenCalledWith('news_items_unstar', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/items/{feedId}/{guidHash}/unstar', params) it 'send a correct read item request', => @@ -158,7 +158,7 @@ describe 'Persistence', -> @Persistence.readItem(params.routeParams.itemId) - expect(@req.post).toHaveBeenCalledWith('news_items_read', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/items/{itemId}/read', params) it 'send a correct unread item request', => @@ -168,10 +168,10 @@ describe 'Persistence', -> @Persistence.unreadItem(params.routeParams.itemId) - expect(@req.post).toHaveBeenCalledWith('news_items_unread', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/items/{itemId}/unread', params) - it 'shoud send a correct request for marking all items read', => + it 'should send a correct request for marking all items read', => params = data: highestItemId: 4 @@ -194,7 +194,7 @@ describe 'Persistence', -> onSuccess: jasmine.any(Function) onFailure: jasmine.any(Function) - expect(@req.get).toHaveBeenCalledWith('news_feeds', expected) + expect(@req.get).toHaveBeenCalledWith('/apps/news/feeds', expected) it 'should not show loading sign if disabled', => @@ -212,7 +212,7 @@ describe 'Persistence', -> @Persistence.moveFeed(params.routeParams.feedId, params.data.parentFolderId) - expect(@req.post).toHaveBeenCalledWith('news_feeds_move', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/feeds/{feedId}/move', params) it 'create a correct request for renaming a feed', => @@ -224,7 +224,7 @@ describe 'Persistence', -> @Persistence.renameFeed(params.routeParams.feedId, params.data.feedTitle) - expect(@req.post).toHaveBeenCalledWith('news_feeds_rename', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/feeds/{feedId}/rename', params) it 'shoud send a correct request for marking all items of a feed read', => @@ -237,7 +237,7 @@ describe 'Persistence', -> @Persistence.setFeedRead(params.routeParams.feedId, params.data.highestItemId) - expect(@req.post).toHaveBeenCalledWith('news_feeds_read', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/feeds/{feedId}/read', params) it 'send a correct feed update request', => @@ -247,7 +247,7 @@ describe 'Persistence', -> @Persistence.updateFeed(params.routeParams.feedId) - expect(@req.post).toHaveBeenCalledWith('news_feeds_update', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/feeds/{feedId}/update', params) it 'send a correct get active feed request', => @@ -260,7 +260,7 @@ describe 'Persistence', -> onSuccess: jasmine.any(Function) onFailure: jasmine.any(Function) - expect(@req.get).toHaveBeenCalledWith('news_feeds_active', expected) + expect(@req.get).toHaveBeenCalledWith('/apps/news/feeds/active', expected) it 'send a correct feed delete request', => @@ -270,7 +270,7 @@ describe 'Persistence', -> @Persistence.deleteFeed(params.routeParams.feedId) - expect(@req.delete).toHaveBeenCalledWith('news_feeds_delete', params) + expect(@req.delete).toHaveBeenCalledWith('/apps/news/feeds/{feedId}', params) it 'send a correct feed restore request', => @@ -281,7 +281,7 @@ describe 'Persistence', -> @Persistence.restoreFeed(params.routeParams.feedId, params.onSuccess) - expect(@req.post).toHaveBeenCalledWith('news_feeds_restore', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/feeds/{feedId}/restore', params) it 'send a correct feed create request', => @@ -295,7 +295,7 @@ describe 'Persistence', -> @Persistence.createFeed(params.data.url, params.data.parentFolderId, params.onSuccess, params.onFailure) - expect(@req.post).toHaveBeenCalledWith('news_feeds_create', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/feeds', params) it 'should do a proper import articles request', => @@ -307,7 +307,7 @@ describe 'Persistence', -> @Persistence.importArticles(params.data.json, ->) - expect(@req.post).toHaveBeenCalledWith('news_feeds_import_articles', + expect(@req.post).toHaveBeenCalledWith('/apps/news/feeds/import/articles', params) @@ -324,7 +324,7 @@ describe 'Persistence', -> onSuccess: jasmine.any(Function) onFailure: jasmine.any(Function) - expect(@req.get).toHaveBeenCalledWith('news_folders', expected) + expect(@req.get).toHaveBeenCalledWith('/apps/news/folders', expected) it 'send a correct collapse folder request', => @@ -334,7 +334,7 @@ describe 'Persistence', -> @Persistence.collapseFolder(params.routeParams.folderId) - expect(@req.post).toHaveBeenCalledWith('news_folders_collapse', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/folders/{folderId}/collapse', params) it 'send a correct open folder request', => @@ -344,7 +344,7 @@ describe 'Persistence', -> @Persistence.openFolder(params.routeParams.folderId) - expect(@req.post).toHaveBeenCalledWith('news_folders_open', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/folders/{folderId}/open', params) it 'should do a proper folder create request', => @@ -358,7 +358,7 @@ describe 'Persistence', -> @Persistence.createFolder(params.data.folderName, params.data.parentFolderId, params.onSuccess, params.onFailure) - expect(@req.post).toHaveBeenCalledWith('news_folders_create', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/folders/create', params) it 'should do a proper folder delete request', => @@ -368,7 +368,7 @@ describe 'Persistence', -> @Persistence.deleteFolder(params.routeParams.folderId) - expect(@req.delete).toHaveBeenCalledWith('news_folders_delete', params) + expect(@req.delete).toHaveBeenCalledWith('/apps/news/folders/{folderId}', params) it 'send a correct folder restore request', => @@ -379,7 +379,7 @@ describe 'Persistence', -> @Persistence.restoreFolder(params.routeParams.folderId, params.onSuccess) - expect(@req.post).toHaveBeenCalledWith('news_folders_restore', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/folders/{folderId}/restore', params) it 'should do a proper folder rename request', => @@ -391,7 +391,7 @@ describe 'Persistence', -> @Persistence.renameFolder(params.routeParams.folderId, params.data.folderName) - expect(@req.post).toHaveBeenCalledWith('news_folders_rename', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/folders/{folderId}/rename', params) it 'shoud send a correct request for marking all items of a folders read', => @@ -405,7 +405,7 @@ describe 'Persistence', -> params.data.highestItemId) - expect(@req.post).toHaveBeenCalledWith('news_folders_read', params) + expect(@req.post).toHaveBeenCalledWith('/apps/news/folders/{folderId}/read', params) ### @@ -414,7 +414,7 @@ describe 'Persistence', -> it 'should have an export request', => @Persistence.exportOPML() - expect(@req.get).toHaveBeenCalledWith('news_export_opml') + expect(@req.get).toHaveBeenCalledWith('/apps/news/export/opml') ### @@ -431,7 +431,7 @@ describe 'Persistence', -> onSuccess: jasmine.any(Function) onFailure: jasmine.any(Function) - expect(@req.get).toHaveBeenCalledWith('news_usersettings_read', expected) + expect(@req.get).toHaveBeenCalledWith('/apps/news/usersettings/read', expected) @@ -441,7 +441,7 @@ describe 'Persistence', -> @Persistence.userSettingsReadShow(params.onSuccess) - expect(@req.post).toHaveBeenCalledWith('news_usersettings_read_show', + expect(@req.post).toHaveBeenCalledWith('/apps/news/usersettings/read/show', params) @@ -450,7 +450,7 @@ describe 'Persistence', -> onSuccess: -> @Persistence.userSettingsReadHide(params.onSuccess) - expect(@req.post).toHaveBeenCalledWith('news_usersettings_read_hide', + expect(@req.post).toHaveBeenCalledWith('/apps/news/usersettings/read/hide', params) @@ -464,14 +464,14 @@ describe 'Persistence', -> onSuccess: jasmine.any(Function) onFailure: jasmine.any(Function) - expect(@req.get).toHaveBeenCalledWith('news_usersettings_language', + expect(@req.get).toHaveBeenCalledWith('/apps/news/usersettings/language', expected) it 'should send a get compact view request', => @Persistence.userSettingsIsCompact() - expect(@req.get).toHaveBeenCalledWith('news_usersettings_iscompact') + expect(@req.get).toHaveBeenCalledWith('/apps/news/usersettings/compact') it 'should send a set compact view request', => @@ -481,7 +481,7 @@ describe 'Persistence', -> data: compact: true - expect(@req.post).toHaveBeenCalledWith('news_usersettings_setcompact', + expect(@req.post).toHaveBeenCalledWith('/apps/news/usersettings/compact', expected) |