From f0dd6d526160fdb98a5f55b4e45b84652590df58 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Mon, 25 Jan 2016 12:40:23 +0100 Subject: bootstraping right panel --- src/web/js/actions/RightPanelActions.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/web/js/actions/RightPanelActions.js (limited to 'src/web/js/actions/RightPanelActions.js') diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js new file mode 100644 index 00000000..3cd549e5 --- /dev/null +++ b/src/web/js/actions/RightPanelActions.js @@ -0,0 +1,20 @@ +var JarrDispatcher = require('../dispatcher/JarrDispatcher'); +var RightActionTypes = require('../constants/JarrConstants').RightPanelActionTypes; +var jquery = require('jquery'); +var RightPanelStore = require('../stores/RightPanelStore'); + + +var RightPanelActions = { + load: function(obj_type, obj_id) { + filters = MiddlePanelStore.getRequestFilter(); + jquery.getJSON('api/v2.0/' + obj_type + '/' + obj_id, function(payload) { + _last_fetched_with = filters; + JarrDispatcher.dispatch({ + type: RightPanelActionTypes.LOAD_RIGHT_PANEL, + articles: payload.articles, + }); + }); + }, +}; + +module.exports = RightPanelActions; -- cgit From 15c4ed6bebdeb277c24bd92dab5bba900fc90de4 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Mon, 25 Jan 2016 13:14:06 +0100 Subject: redoing constant, handling read / unread in menu, removing bad optim for loading articles --- src/web/js/actions/RightPanelActions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/web/js/actions/RightPanelActions.js') diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js index 3cd549e5..7a7b935a 100644 --- a/src/web/js/actions/RightPanelActions.js +++ b/src/web/js/actions/RightPanelActions.js @@ -1,5 +1,5 @@ var JarrDispatcher = require('../dispatcher/JarrDispatcher'); -var RightActionTypes = require('../constants/JarrConstants').RightPanelActionTypes; +var ActionTypes = require('../constants/JarrConstants'); var jquery = require('jquery'); var RightPanelStore = require('../stores/RightPanelStore'); @@ -10,7 +10,7 @@ var RightPanelActions = { jquery.getJSON('api/v2.0/' + obj_type + '/' + obj_id, function(payload) { _last_fetched_with = filters; JarrDispatcher.dispatch({ - type: RightPanelActionTypes.LOAD_RIGHT_PANEL, + type: ActionTypes.LOAD_RIGHT_PANEL, articles: payload.articles, }); }); -- cgit From 4098a0de815013c521618b6419d91f997c986ef0 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 29 Jan 2016 14:26:02 +0100 Subject: draft displaying article --- src/web/js/actions/RightPanelActions.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/web/js/actions/RightPanelActions.js') diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js index 7a7b935a..6831f9b8 100644 --- a/src/web/js/actions/RightPanelActions.js +++ b/src/web/js/actions/RightPanelActions.js @@ -5,15 +5,16 @@ var RightPanelStore = require('../stores/RightPanelStore'); var RightPanelActions = { - load: function(obj_type, obj_id) { - filters = MiddlePanelStore.getRequestFilter(); - jquery.getJSON('api/v2.0/' + obj_type + '/' + obj_id, function(payload) { - _last_fetched_with = filters; - JarrDispatcher.dispatch({ - type: ActionTypes.LOAD_RIGHT_PANEL, - articles: payload.articles, - }); - }); + loadArticle: function(article_id) { + jquery.getJSON('/getart/' + article_id, + function(payload) { + JarrDispatcher.dispatch({ + type: ActionTypes.LOAD_ARTICLE, + article: payload, + }); + } + ); + }, }; -- cgit From d1760c9c0f4cd23bf81d15f176f371fed08e6255 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 29 Jan 2016 18:05:06 +0100 Subject: cleaning warnings --- src/web/js/actions/RightPanelActions.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/web/js/actions/RightPanelActions.js') diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js index 6831f9b8..6a8d74bd 100644 --- a/src/web/js/actions/RightPanelActions.js +++ b/src/web/js/actions/RightPanelActions.js @@ -1,8 +1,6 @@ var JarrDispatcher = require('../dispatcher/JarrDispatcher'); var ActionTypes = require('../constants/JarrConstants'); var jquery = require('jquery'); -var RightPanelStore = require('../stores/RightPanelStore'); - var RightPanelActions = { loadArticle: function(article_id) { -- cgit From 4c5415754593986d1540820d13dfa34a34ffeed6 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 29 Jan 2016 20:28:10 +0100 Subject: impact on menus when loading article --- src/web/js/actions/RightPanelActions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/web/js/actions/RightPanelActions.js') diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js index 6a8d74bd..c60bffcf 100644 --- a/src/web/js/actions/RightPanelActions.js +++ b/src/web/js/actions/RightPanelActions.js @@ -3,12 +3,13 @@ var ActionTypes = require('../constants/JarrConstants'); var jquery = require('jquery'); var RightPanelActions = { - loadArticle: function(article_id) { + loadArticle: function(article_id, was_read_before) { jquery.getJSON('/getart/' + article_id, function(payload) { JarrDispatcher.dispatch({ type: ActionTypes.LOAD_ARTICLE, article: payload, + was_read_before: was_read_before, }); } ); -- cgit From 678af2747d6414379e81ee6856c7ec2f3cd5a890 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Sat, 30 Jan 2016 23:17:03 +0100 Subject: registering modifications on feeds / categories --- src/web/js/actions/RightPanelActions.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/web/js/actions/RightPanelActions.js') diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js index c60bffcf..838690d1 100644 --- a/src/web/js/actions/RightPanelActions.js +++ b/src/web/js/actions/RightPanelActions.js @@ -1,6 +1,7 @@ +var jquery = require('jquery'); var JarrDispatcher = require('../dispatcher/JarrDispatcher'); var ActionTypes = require('../constants/JarrConstants'); -var jquery = require('jquery'); +var MenuActions = require('../actions/MenuActions'); var RightPanelActions = { loadArticle: function(article_id, was_read_before) { @@ -13,7 +14,19 @@ var RightPanelActions = { }); } ); - + }, + _apiReq: function(meth, id, obj_type, data, success_callback) { + var args = {type: meth, contentType: 'application/json', + url: "api/v2.0/" + obj_type + "/" + id} + if(data) {args.data = JSON.stringify(data);} + if(success_callback) {args.success = success_callback;} + jquery.ajax(args); + }, + putObj: function(id, obj_type, fields) { + this._apiReq('PUT', id, obj_type, fields, MenuActions.reload); + }, + delObj: function(id, obj_type, fields) { + this._apiReq('DELETE', id, obj_type, null, MenuActions.reload); }, }; -- cgit From 64964d2fcfa73e18b1316d788bacd11e2180bb7d Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Sun, 31 Jan 2016 18:59:36 +0100 Subject: handling errors from one page app --- src/web/js/actions/RightPanelActions.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/web/js/actions/RightPanelActions.js') diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js index 838690d1..489abae4 100644 --- a/src/web/js/actions/RightPanelActions.js +++ b/src/web/js/actions/RightPanelActions.js @@ -28,6 +28,15 @@ var RightPanelActions = { delObj: function(id, obj_type, fields) { this._apiReq('DELETE', id, obj_type, null, MenuActions.reload); }, + resetErrors: function(feed_id) { + jquery.ajax({type: 'GET', + url: "feed/reset_errors/" + feed_id, + success: function() { + MenuActions.reload(); + }, + }); + + }, }; module.exports = RightPanelActions; -- cgit From 5625fb1192243b19ceac9621b003df39542c4c51 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Tue, 2 Feb 2016 22:09:18 +0100 Subject: using api and repairing feed page --- src/web/js/actions/RightPanelActions.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/web/js/actions/RightPanelActions.js') diff --git a/src/web/js/actions/RightPanelActions.js b/src/web/js/actions/RightPanelActions.js index 489abae4..47adad79 100644 --- a/src/web/js/actions/RightPanelActions.js +++ b/src/web/js/actions/RightPanelActions.js @@ -29,12 +29,8 @@ var RightPanelActions = { this._apiReq('DELETE', id, obj_type, null, MenuActions.reload); }, resetErrors: function(feed_id) { - jquery.ajax({type: 'GET', - url: "feed/reset_errors/" + feed_id, - success: function() { - MenuActions.reload(); - }, - }); + this._apiReq('PUT', feed_id, 'feed', {error_count: 0, last_error: ''}, + MenuActions.reload); }, }; -- cgit