From 2c0e17cb977a1e8782799b337df8b1583d019906 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Mon, 12 Oct 2015 22:36:01 +0200 Subject: bootstraping react --- src/web/js/actions/MenuActions.js | 36 +++++++++++++++++++++ src/web/js/actions/MiddlePanelActions.js | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 src/web/js/actions/MenuActions.js create mode 100644 src/web/js/actions/MiddlePanelActions.js (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js new file mode 100644 index 00000000..ce3a1030 --- /dev/null +++ b/src/web/js/actions/MenuActions.js @@ -0,0 +1,36 @@ +var JarrDispatcher = require('../dispatcher/JarrDispatcher'); +var MenuActionTypes = require('../constants/JarrConstants').MenuActionTypes; + + +var MenuActions = { + // PARENT FILTERS + reload: function() { + $.getJSON('/menu', function(payload) { + JarrDispatcher.dispatch({ + type: MenuActionTypes.RELOAD_MENU, + categories: payload.categories, + all_unread_count: payload.all_unread_count, + }); + }); + }, + setFilterMenuAll: function() { + JarrDispatcher.dispatch({ + component: 'menu', + type: MenuActionTypes.MENU_FILTER_ALL, + }); + }, + setFilterMenuUnread: function() { + JarrDispatcher.dispatch({ + component: 'menu', + type: MenuActionTypes.MENU_FILTER_UNREAD, + }); + }, + setFilterMenuError: function() { + JarrDispatcher.dispatch({ + type: MenuActionTypes.MENU_FILTER_ERROR, + }); + }, + +}; + +module.exports = MenuActions; diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js new file mode 100644 index 00000000..9877d0d5 --- /dev/null +++ b/src/web/js/actions/MiddlePanelActions.js @@ -0,0 +1,54 @@ +var JarrDispatcher = require('../dispatcher/JarrDispatcher'); +var MiddlePanelActionTypes = require('../constants/JarrConstants').MiddlePanelActionTypes; + + +var MiddlePanelActions = { + reload: function() { + $.getJSON('/middle_panel', function(payload) { + JarrDispatcher.dispatch({ + type: MiddlePanelActionTypes.RELOAD_MIDDLE_PANEL, + articles: payload.articles, + }); + }); + }, + removeParentFilter: function(parent_type, parent_id) { + JarrDispatcher.dispatch({ + type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, + parent_type: null, + parent_id: null, + }); + }, + setCategoryFilter: function(category_id) { + JarrDispatcher.dispatch({ + type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, + parent_type: 'category', + parent_id: category_id, + }); + }, + setFeedFilter: function(feed_id) { + JarrDispatcher.dispatch({ + type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, + parent_type: 'feed', + parent_id: feed_id, + }); + }, + setFilterMiddlePanelAll: function() { + JarrDispatcher.dispatch({ + component: 'middle_panel', + type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_ALL, + }); + }, + setFilterMiddlePanelUnread: function() { + JarrDispatcher.dispatch({ + component: 'middle_panel', + type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_UNREAD, + }); + }, + setFilterMiddlePanelUnread: function() { + JarrDispatcher.dispatch({ + type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_LIKED, + }); + }, +}; + +module.exports = MiddlePanelActions; -- cgit From 41aea41aaff0886fd6c211f03db2b54863a97165 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Thu, 21 Jan 2016 13:48:06 +0100 Subject: filters are working ! --- src/web/js/actions/MenuActions.js | 4 +++- src/web/js/actions/MiddlePanelActions.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index ce3a1030..f02ea5a0 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -1,11 +1,13 @@ var JarrDispatcher = require('../dispatcher/JarrDispatcher'); var MenuActionTypes = require('../constants/JarrConstants').MenuActionTypes; +var jquery = require('jquery'); + var MenuActions = { // PARENT FILTERS reload: function() { - $.getJSON('/menu', function(payload) { + jquery.getJSON('/menu', function(payload) { JarrDispatcher.dispatch({ type: MenuActionTypes.RELOAD_MENU, categories: payload.categories, diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index 9877d0d5..42c18b58 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -1,10 +1,11 @@ var JarrDispatcher = require('../dispatcher/JarrDispatcher'); var MiddlePanelActionTypes = require('../constants/JarrConstants').MiddlePanelActionTypes; +var jquery = require('jquery'); var MiddlePanelActions = { reload: function() { - $.getJSON('/middle_panel', function(payload) { + jquery.getJSON('/middle_panel', function(payload) { JarrDispatcher.dispatch({ type: MiddlePanelActionTypes.RELOAD_MIDDLE_PANEL, articles: payload.articles, -- cgit From c542f58b99e0bd625f52e1ac9c3d2ad7d9ee4bd5 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 22 Jan 2016 17:26:56 +0100 Subject: adding basic bootstrap --- src/web/js/actions/MenuActions.js | 1 - 1 file changed, 1 deletion(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index f02ea5a0..558bd857 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -3,7 +3,6 @@ var MenuActionTypes = require('../constants/JarrConstants').MenuActionTypes; var jquery = require('jquery'); - var MenuActions = { // PARENT FILTERS reload: function() { -- cgit From ed74f6a2bfc9975092040c4379f459d4c9442d3f Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 22 Jan 2016 19:09:08 +0100 Subject: renaming, proper usage of props and state, filtering left menu --- src/web/js/actions/MenuActions.js | 6 +++--- src/web/js/actions/MiddlePanelActions.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index 558bd857..9502eb6d 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -14,19 +14,19 @@ var MenuActions = { }); }); }, - setFilterMenuAll: function() { + setFilterAll: function() { JarrDispatcher.dispatch({ component: 'menu', type: MenuActionTypes.MENU_FILTER_ALL, }); }, - setFilterMenuUnread: function() { + setFilterUnread: function() { JarrDispatcher.dispatch({ component: 'menu', type: MenuActionTypes.MENU_FILTER_UNREAD, }); }, - setFilterMenuError: function() { + setFilterError: function() { JarrDispatcher.dispatch({ type: MenuActionTypes.MENU_FILTER_ERROR, }); diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index 42c18b58..f750c900 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -33,19 +33,19 @@ var MiddlePanelActions = { parent_id: feed_id, }); }, - setFilterMiddlePanelAll: function() { + setFilterAll: function() { JarrDispatcher.dispatch({ component: 'middle_panel', type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_ALL, }); }, - setFilterMiddlePanelUnread: function() { + setFilterUnread: function() { JarrDispatcher.dispatch({ component: 'middle_panel', type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_UNREAD, }); }, - setFilterMiddlePanelUnread: function() { + setFilterLiked: function() { JarrDispatcher.dispatch({ type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_LIKED, }); -- cgit From 00ba122b5d6b0929ba6078fc7c1d128cf6e5236e Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 22 Jan 2016 23:39:12 +0100 Subject: displaying error --- src/web/js/actions/MenuActions.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index 9502eb6d..c3cc95bc 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -10,6 +10,7 @@ var MenuActions = { JarrDispatcher.dispatch({ type: MenuActionTypes.RELOAD_MENU, categories: payload.categories, + feed_in_error: payload.feed_in_error, all_unread_count: payload.all_unread_count, }); }); -- cgit From 94a18fbdecaa798d67a5bf7ad0f2b8ee4e0c7851 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Sat, 23 Jan 2016 03:21:41 +0100 Subject: meh, kinda works, sleep now --- src/web/js/actions/MiddlePanelActions.js | 77 ++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 19 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index f750c900..159ba91b 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -1,53 +1,92 @@ var JarrDispatcher = require('../dispatcher/JarrDispatcher'); var MiddlePanelActionTypes = require('../constants/JarrConstants').MiddlePanelActionTypes; var jquery = require('jquery'); +var MiddlePanelStore = require('../stores/MiddlePanelStore'); + +var _last_fetched_with = {}; +var shouldFetch = function(filters) { + if(filters.filter != null // undefined means unchanged + && (_last_fetched_with.filter != 'all' + || _last_fetched_with.filter != filters.filter)) { + return true; + } + if(_last_fetched_with.filter_type != null) { + if(_last_fetched_with.filter_type != filters.filter_type) { + return true; + } + if(_last_fetched_with.filter_id != filters.filter_id) { + return true; + } + } + return false; +} +var reloadIfNecessaryAndDispatch = function(dispath_payload) { + if(shouldFetch(dispath_payload)) { + filters = MiddlePanelStore.getRequestFilter(); + for (var key in filters) { + if(dispath_payload[key] != null) { + filters[key] = dispath_payload[key]; + } + } + jquery.getJSON('/middle_panel', dispath_payload, function(payload) { + dispath_payload.articles = payload.articles; + JarrDispatcher.dispatch(dispath_payload); + _last_fetched_with = MiddlePanelStore.getRequestFilter(); + }); + } else { + JarrDispatcher.dispatch(dispath_payload); + } +} var MiddlePanelActions = { reload: function() { - jquery.getJSON('/middle_panel', function(payload) { + filters = MiddlePanelStore.getRequestFilter(); + jquery.getJSON('/middle_panel', filters, function(payload) { + _last_fetched_with = filters; JarrDispatcher.dispatch({ type: MiddlePanelActionTypes.RELOAD_MIDDLE_PANEL, articles: payload.articles, }); }); }, - removeParentFilter: function(parent_type, parent_id) { - JarrDispatcher.dispatch({ + removeParentFilter: function(filter_type, filter_id) { + reloadIfNecessaryAndDispatch({ type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, - parent_type: null, - parent_id: null, + filter_type: null, + filter_id: null, }); }, setCategoryFilter: function(category_id) { - JarrDispatcher.dispatch({ + reloadIfNecessaryAndDispatch({ type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, - parent_type: 'category', - parent_id: category_id, + filter_type: 'category', + filter_id: category_id, }); }, setFeedFilter: function(feed_id) { - JarrDispatcher.dispatch({ + reloadIfNecessaryAndDispatch({ type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, - parent_type: 'feed', - parent_id: feed_id, + filter_type: 'feed', + filter_id: feed_id, }); }, setFilterAll: function() { - JarrDispatcher.dispatch({ - component: 'middle_panel', - type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_ALL, + reloadIfNecessaryAndDispatch({ + type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER, + filter: 'all', }); }, setFilterUnread: function() { - JarrDispatcher.dispatch({ - component: 'middle_panel', - type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_UNREAD, + reloadIfNecessaryAndDispatch({ + type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER, + filter: 'unread', }); }, setFilterLiked: function() { - JarrDispatcher.dispatch({ - type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER_LIKED, + reloadIfNecessaryAndDispatch({ + type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER, + filter: 'liked', }); }, }; -- cgit From 3644d4ef190d2d509c64fdf5c29382cb8a41e235 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Sat, 23 Jan 2016 12:47:18 +0100 Subject: doing some design wip toogle read / like --- src/web/js/actions/MenuActions.js | 11 +++--- src/web/js/actions/MiddlePanelActions.js | 57 ++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 15 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index c3cc95bc..1f1eea01 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -17,19 +17,20 @@ var MenuActions = { }, setFilterAll: function() { JarrDispatcher.dispatch({ - component: 'menu', - type: MenuActionTypes.MENU_FILTER_ALL, + type: MenuActionTypes.MENU_FILTER, + filter: 'all', }); }, setFilterUnread: function() { JarrDispatcher.dispatch({ - component: 'menu', - type: MenuActionTypes.MENU_FILTER_UNREAD, + type: MenuActionTypes.MENU_FILTER, + filter: 'unread', }); }, setFilterError: function() { JarrDispatcher.dispatch({ - type: MenuActionTypes.MENU_FILTER_ERROR, + type: MenuActionTypes.MENU_FILTER, + filter: 'error', }); }, diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index 159ba91b..7a944ecd 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -28,10 +28,11 @@ var reloadIfNecessaryAndDispatch = function(dispath_payload) { filters[key] = dispath_payload[key]; } } - jquery.getJSON('/middle_panel', dispath_payload, function(payload) { - dispath_payload.articles = payload.articles; - JarrDispatcher.dispatch(dispath_payload); - _last_fetched_with = MiddlePanelStore.getRequestFilter(); + jquery.getJSON('/middle_panel', dispath_payload, + function(payload) { + dispath_payload.articles = payload.articles; + JarrDispatcher.dispatch(dispath_payload); + _last_fetched_with = MiddlePanelStore.getRequestFilter(); }); } else { JarrDispatcher.dispatch(dispath_payload); @@ -50,24 +51,24 @@ var MiddlePanelActions = { }); }); }, - removeParentFilter: function(filter_type, filter_id) { + removeParentFilter: function() { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, + type: MiddlePanelActionTypes.PARENT_FILTER, filter_type: null, filter_id: null, }); }, setCategoryFilter: function(category_id) { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, - filter_type: 'category', + type: MiddlePanelActionTypes.PARENT_FILTER, + filter_type: 'category_id', filter_id: category_id, }); }, setFeedFilter: function(feed_id) { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.MIDDLE_PANEL_PARENT_FILTER, - filter_type: 'feed', + type: MiddlePanelActionTypes.PARENT_FILTER, + filter_type: 'feed_id', filter_id: feed_id, }); }, @@ -89,6 +90,42 @@ var MiddlePanelActions = { filter: 'liked', }); }, + changeRead: function(article_id, new_value){ + jquery.ajax({type: 'PUT', + contentType: 'application/json', + data: JSON.stringify({readed: new_value}), + url: "api/v2.0/article/" + article_id, + success: function (result) { + JarrDispatcher.dispatch({ + type: MiddlePanelActionTypes.CHANGE_ATTR, + article_id: article_id, + attribute: 'read', + value: new_value, + }); + }, + error: function(XMLHttpRequest, textStatus, errorThrown){ + console.log(XMLHttpRequest.responseText); + }, + }); + }, + changeLike: function(article_id, new_value){ + jquery.ajax({type: 'PUT', + contentType: 'application/json', + data: JSON.stringify({like: new_value}), + url: "api/v2.0/article/" + article_id, + success: function (result) { + JarrDispatcher.dispatch({ + type: MiddlePanelActionTypes.CHANGE_ATTR, + article_id: article_id, + attribute: 'liked', + value: new_value, + }); + }, + error: function(XMLHttpRequest, textStatus, errorThrown){ + console.log(XMLHttpRequest.responseText); + }, + }); + }, }; module.exports = MiddlePanelActions; -- cgit 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') 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/MenuActions.js | 10 +++--- src/web/js/actions/MiddlePanelActions.js | 57 +++++++++++++++++--------------- src/web/js/actions/RightPanelActions.js | 4 +-- 3 files changed, 38 insertions(+), 33 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index 1f1eea01..bf039fd1 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -1,5 +1,5 @@ var JarrDispatcher = require('../dispatcher/JarrDispatcher'); -var MenuActionTypes = require('../constants/JarrConstants').MenuActionTypes; +var ActionTypes = require('../constants/JarrConstants'); var jquery = require('jquery'); @@ -8,7 +8,7 @@ var MenuActions = { reload: function() { jquery.getJSON('/menu', function(payload) { JarrDispatcher.dispatch({ - type: MenuActionTypes.RELOAD_MENU, + type: ActionTypes.RELOAD_MENU, categories: payload.categories, feed_in_error: payload.feed_in_error, all_unread_count: payload.all_unread_count, @@ -17,19 +17,19 @@ var MenuActions = { }, setFilterAll: function() { JarrDispatcher.dispatch({ - type: MenuActionTypes.MENU_FILTER, + type: ActionTypes.MENU_FILTER, filter: 'all', }); }, setFilterUnread: function() { JarrDispatcher.dispatch({ - type: MenuActionTypes.MENU_FILTER, + type: ActionTypes.MENU_FILTER, filter: 'unread', }); }, setFilterError: function() { JarrDispatcher.dispatch({ - type: MenuActionTypes.MENU_FILTER, + type: ActionTypes.MENU_FILTER, filter: 'error', }); }, diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index 7a944ecd..7c956e85 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -1,24 +1,25 @@ var JarrDispatcher = require('../dispatcher/JarrDispatcher'); -var MiddlePanelActionTypes = require('../constants/JarrConstants').MiddlePanelActionTypes; +var ActionTypes = require('../constants/JarrConstants'); var jquery = require('jquery'); var MiddlePanelStore = require('../stores/MiddlePanelStore'); var _last_fetched_with = {}; var shouldFetch = function(filters) { - if(filters.filter != null // undefined means unchanged - && (_last_fetched_with.filter != 'all' - || _last_fetched_with.filter != filters.filter)) { - return true; - } - if(_last_fetched_with.filter_type != null) { - if(_last_fetched_with.filter_type != filters.filter_type) { - return true; - } - if(_last_fetched_with.filter_id != filters.filter_id) { - return true; - } - } - return false; + return true; // FIXME disabling intelligent fetch for now, no caching better that bad one +// if(filters.filter != null // undefined means unchanged +// && (_last_fetched_with.filter != 'all' +// || _last_fetched_with.filter != filters.filter)) { +// return true; +// } +// if(_last_fetched_with.filter_type != null) { +// if(_last_fetched_with.filter_type != filters.filter_type) { +// return true; +// } +// if(_last_fetched_with.filter_id != filters.filter_id) { +// return true; +// } +// } +// return false; } var reloadIfNecessaryAndDispatch = function(dispath_payload) { if(shouldFetch(dispath_payload)) { @@ -46,59 +47,61 @@ var MiddlePanelActions = { jquery.getJSON('/middle_panel', filters, function(payload) { _last_fetched_with = filters; JarrDispatcher.dispatch({ - type: MiddlePanelActionTypes.RELOAD_MIDDLE_PANEL, + type: ActionTypes.RELOAD_MIDDLE_PANEL, articles: payload.articles, }); }); }, removeParentFilter: function() { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.PARENT_FILTER, + type: ActionTypes.PARENT_FILTER, filter_type: null, filter_id: null, }); }, setCategoryFilter: function(category_id) { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.PARENT_FILTER, + type: ActionTypes.PARENT_FILTER, filter_type: 'category_id', filter_id: category_id, }); }, setFeedFilter: function(feed_id) { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.PARENT_FILTER, + type: ActionTypes.PARENT_FILTER, filter_type: 'feed_id', filter_id: feed_id, }); }, setFilterAll: function() { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER, + type: ActionTypes.MIDDLE_PANEL_FILTER, filter: 'all', }); }, setFilterUnread: function() { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER, + type: ActionTypes.MIDDLE_PANEL_FILTER, filter: 'unread', }); }, setFilterLiked: function() { reloadIfNecessaryAndDispatch({ - type: MiddlePanelActionTypes.MIDDLE_PANEL_FILTER, + type: ActionTypes.MIDDLE_PANEL_FILTER, filter: 'liked', }); }, - changeRead: function(article_id, new_value){ + changeRead: function(category_id, feed_id, article_id, new_value){ jquery.ajax({type: 'PUT', contentType: 'application/json', data: JSON.stringify({readed: new_value}), url: "api/v2.0/article/" + article_id, success: function (result) { JarrDispatcher.dispatch({ - type: MiddlePanelActionTypes.CHANGE_ATTR, + type: ActionTypes.CHANGE_ATTR, article_id: article_id, + category_id: category_id, + feed_id: feed_id, attribute: 'read', value: new_value, }); @@ -108,15 +111,17 @@ var MiddlePanelActions = { }, }); }, - changeLike: function(article_id, new_value){ + changeLike: function(category_id, feed_id, article_id, new_value){ jquery.ajax({type: 'PUT', contentType: 'application/json', data: JSON.stringify({like: new_value}), url: "api/v2.0/article/" + article_id, success: function (result) { JarrDispatcher.dispatch({ - type: MiddlePanelActionTypes.CHANGE_ATTR, + type: ActionTypes.CHANGE_ATTR, article_id: article_id, + category_id: category_id, + feed_id: feed_id, attribute: 'liked', value: new_value, }); 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 df8d1742d7e8ac6a7d238799dda05557fd0d17a9 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Tue, 26 Jan 2016 22:43:18 +0100 Subject: optim on filter, not rerendering --- src/web/js/actions/MenuActions.js | 17 ++--------------- src/web/js/actions/MiddlePanelActions.js | 16 ++-------------- 2 files changed, 4 insertions(+), 29 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index bf039fd1..4266c207 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -15,25 +15,12 @@ var MenuActions = { }); }); }, - setFilterAll: function() { + setFilter: function(filter) { JarrDispatcher.dispatch({ type: ActionTypes.MENU_FILTER, - filter: 'all', + filter: filter, }); }, - setFilterUnread: function() { - JarrDispatcher.dispatch({ - type: ActionTypes.MENU_FILTER, - filter: 'unread', - }); - }, - setFilterError: function() { - JarrDispatcher.dispatch({ - type: ActionTypes.MENU_FILTER, - filter: 'error', - }); - }, - }; module.exports = MenuActions; diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index 7c956e85..47a9958c 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -73,22 +73,10 @@ var MiddlePanelActions = { filter_id: feed_id, }); }, - setFilterAll: function() { + setFilter: function(filter) { reloadIfNecessaryAndDispatch({ type: ActionTypes.MIDDLE_PANEL_FILTER, - filter: 'all', - }); - }, - setFilterUnread: function() { - reloadIfNecessaryAndDispatch({ - type: ActionTypes.MIDDLE_PANEL_FILTER, - filter: 'unread', - }); - }, - setFilterLiked: function() { - reloadIfNecessaryAndDispatch({ - type: ActionTypes.MIDDLE_PANEL_FILTER, - filter: 'liked', + filter: filter, }); }, changeRead: function(category_id, feed_id, article_id, new_value){ -- cgit From f3578d10239ffa716450c0089bcbc8d2826f59fd Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Tue, 26 Jan 2016 23:23:42 +0100 Subject: mark all as read button --- src/web/js/actions/MiddlePanelActions.js | 45 ++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index 47a9958c..ab54217e 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -43,7 +43,7 @@ var reloadIfNecessaryAndDispatch = function(dispath_payload) { var MiddlePanelActions = { reload: function() { - filters = MiddlePanelStore.getRequestFilter(); + var filters = MiddlePanelStore.getRequestFilter(); jquery.getJSON('/middle_panel', filters, function(payload) { _last_fetched_with = filters; JarrDispatcher.dispatch({ @@ -84,19 +84,17 @@ var MiddlePanelActions = { contentType: 'application/json', data: JSON.stringify({readed: new_value}), url: "api/v2.0/article/" + article_id, - success: function (result) { + success: function () { JarrDispatcher.dispatch({ type: ActionTypes.CHANGE_ATTR, - article_id: article_id, - category_id: category_id, - feed_id: feed_id, attribute: 'read', - value: new_value, + value_bool: new_value, + value_num: new_value ? -1 : 1, + articles: [{article_id: article_id, + category_id: category_id, + feed_id: feed_id}], }); }, - error: function(XMLHttpRequest, textStatus, errorThrown){ - console.log(XMLHttpRequest.responseText); - }, }); }, changeLike: function(category_id, feed_id, article_id, new_value){ @@ -104,18 +102,33 @@ var MiddlePanelActions = { contentType: 'application/json', data: JSON.stringify({like: new_value}), url: "api/v2.0/article/" + article_id, - success: function (result) { + success: function () { JarrDispatcher.dispatch({ type: ActionTypes.CHANGE_ATTR, - article_id: article_id, - category_id: category_id, - feed_id: feed_id, attribute: 'liked', - value: new_value, + value_bool: new_value, + value_num: new_value ? -1 : 1, + articles: [{article_id: article_id, + category_id: category_id, + feed_id: feed_id}], }); }, - error: function(XMLHttpRequest, textStatus, errorThrown){ - console.log(XMLHttpRequest.responseText); + }); + }, + markAllAsRead: function() { + var filters = MiddlePanelStore.getRequestFilter(); + jquery.ajax({type: 'PUT', + contentType: 'application/json', + data: JSON.stringify(filters), + url: "/mark_all_as_read", + success: function (payload) { + JarrDispatcher.dispatch({ + type: ActionTypes.CHANGE_ATTR, + attribute: 'read', + value_num: -1, + value_bool: true, + articles: payload.articles, + }); }, }); }, -- cgit From 5c8f9fd0376afc034251a73023e43ada4041aa34 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Thu, 28 Jan 2016 14:36:26 +0100 Subject: implementing search through articles --- src/web/js/actions/MiddlePanelActions.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index ab54217e..e1ced2a2 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -23,13 +23,13 @@ var shouldFetch = function(filters) { } var reloadIfNecessaryAndDispatch = function(dispath_payload) { if(shouldFetch(dispath_payload)) { - filters = MiddlePanelStore.getRequestFilter(); + var filters = MiddlePanelStore.getRequestFilter(); for (var key in filters) { if(dispath_payload[key] != null) { filters[key] = dispath_payload[key]; } } - jquery.getJSON('/middle_panel', dispath_payload, + jquery.getJSON('/middle_panel', filters, function(payload) { dispath_payload.articles = payload.articles; JarrDispatcher.dispatch(dispath_payload); @@ -52,6 +52,17 @@ var MiddlePanelActions = { }); }); }, + search: function(search) { + MiddlePanelStore._datas.display_search = true; + MiddlePanelStore._datas.query = search.query; + MiddlePanelStore._datas.search_content = search.content; + MiddlePanelStore._datas.search_content = search.content; + this.reload(); + }, + search_off: function() { + MiddlePanelStore._datas.display_search = false; + this.reload(); + }, removeParentFilter: function() { reloadIfNecessaryAndDispatch({ type: ActionTypes.PARENT_FILTER, -- cgit From 8e942f6f5695c4788328b4959527b30ff31e771d Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Thu, 28 Jan 2016 22:47:36 +0100 Subject: redoing menu, sorting in place and not in python --- src/web/js/actions/MenuActions.js | 2 +- src/web/js/actions/MiddlePanelActions.js | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index 4266c207..4b17d084 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -9,8 +9,8 @@ var MenuActions = { jquery.getJSON('/menu', function(payload) { JarrDispatcher.dispatch({ type: ActionTypes.RELOAD_MENU, + feeds: payload.feeds, categories: payload.categories, - feed_in_error: payload.feed_in_error, all_unread_count: payload.all_unread_count, }); }); diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index e1ced2a2..ec76d2bc 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -21,14 +21,16 @@ var shouldFetch = function(filters) { // } // return false; } +var key_whitelist = ['filter_id', 'filter_type', + 'query', 'search_title', 'search_content']; var reloadIfNecessaryAndDispatch = function(dispath_payload) { if(shouldFetch(dispath_payload)) { var filters = MiddlePanelStore.getRequestFilter(); - for (var key in filters) { - if(dispath_payload[key] != null) { + key_whitelist.map(function(key) { + if(key in dispath_payload) { filters[key] = dispath_payload[key]; } - } + }); jquery.getJSON('/middle_panel', filters, function(payload) { dispath_payload.articles = payload.articles; @@ -43,13 +45,8 @@ var reloadIfNecessaryAndDispatch = function(dispath_payload) { var MiddlePanelActions = { reload: function() { - var filters = MiddlePanelStore.getRequestFilter(); - jquery.getJSON('/middle_panel', filters, function(payload) { - _last_fetched_with = filters; - JarrDispatcher.dispatch({ - type: ActionTypes.RELOAD_MIDDLE_PANEL, - articles: payload.articles, - }); + reloadIfNecessaryAndDispatch({ + type: ActionTypes.RELOAD_MIDDLE_PANEL, }); }, search: function(search) { -- cgit From 5eae4cb235abed7a6e8c6ab81226def9dddc0af2 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 29 Jan 2016 13:02:49 +0100 Subject: correcting awful middle panel action handling --- src/web/js/actions/MiddlePanelActions.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index ec76d2bc..08510f29 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -21,16 +21,21 @@ var shouldFetch = function(filters) { // } // return false; } -var key_whitelist = ['filter_id', 'filter_type', - 'query', 'search_title', 'search_content']; var reloadIfNecessaryAndDispatch = function(dispath_payload) { if(shouldFetch(dispath_payload)) { - var filters = MiddlePanelStore.getRequestFilter(); - key_whitelist.map(function(key) { + var filters = MiddlePanelStore.getRequestFilter( + dispath_payload.display_search); + MiddlePanelStore.filter_whitelist.map(function(key) { if(key in dispath_payload) { filters[key] = dispath_payload[key]; } + if(filters[key] == null) { + delete filters[key]; + } }); + if('display_search' in filters) { + delete filters['display_search']; + } jquery.getJSON('/middle_panel', filters, function(payload) { dispath_payload.articles = payload.articles; @@ -50,15 +55,19 @@ var MiddlePanelActions = { }); }, search: function(search) { - MiddlePanelStore._datas.display_search = true; - MiddlePanelStore._datas.query = search.query; - MiddlePanelStore._datas.search_content = search.content; - MiddlePanelStore._datas.search_content = search.content; - this.reload(); + reloadIfNecessaryAndDispatch({ + type: ActionTypes.RELOAD_MIDDLE_PANEL, + display_search: true, + query: search.query, + search_title: search.title, + search_content: search.content, + }); }, search_off: function() { - MiddlePanelStore._datas.display_search = false; - this.reload(); + reloadIfNecessaryAndDispatch({ + type: ActionTypes.RELOAD_MIDDLE_PANEL, + display_search: false, + }); }, removeParentFilter: function() { reloadIfNecessaryAndDispatch({ -- 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') 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') 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') 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') 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 9ca6a6989b0c87401f1a3903077723cd9a648a79 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Sun, 31 Jan 2016 02:24:10 +0100 Subject: redoing navbar in react --- src/web/js/actions/MenuActions.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index 4b17d084..fa30474e 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -11,6 +11,8 @@ var MenuActions = { type: ActionTypes.RELOAD_MENU, feeds: payload.feeds, categories: payload.categories, + is_admin: payload.is_admin, + crawling_method: payload.crawling_method, all_unread_count: payload.all_unread_count, }); }); -- 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/MenuActions.js | 2 ++ src/web/js/actions/RightPanelActions.js | 9 +++++++++ 2 files changed, 11 insertions(+) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index fa30474e..027a3d37 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -12,6 +12,8 @@ var MenuActions = { feeds: payload.feeds, categories: payload.categories, is_admin: payload.is_admin, + max_error: payload.max_error, + error_threshold: payload.error_threshold, crawling_method: payload.crawling_method, all_unread_count: payload.all_unread_count, }); 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 db6e918ee5a92429738f2e87afb1af8f024d5053 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Sun, 31 Jan 2016 22:32:10 +0100 Subject: enhancement: ordering categories and hidding empty 'no category' category --- src/web/js/actions/MenuActions.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index 027a3d37..d3a0d25d 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -11,6 +11,7 @@ var MenuActions = { type: ActionTypes.RELOAD_MENU, feeds: payload.feeds, categories: payload.categories, + categories_order: payload.categories_order, is_admin: payload.is_admin, max_error: payload.max_error, error_threshold: payload.error_threshold, -- cgit From ded0971f5691ed2934e690c8d7bd480ed15402f7 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Tue, 2 Feb 2016 21:55:57 +0100 Subject: updating unread count when fetching unread --- src/web/js/actions/MiddlePanelActions.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js index 08510f29..f805b7b1 100644 --- a/src/web/js/actions/MiddlePanelActions.js +++ b/src/web/js/actions/MiddlePanelActions.js @@ -39,6 +39,7 @@ var reloadIfNecessaryAndDispatch = function(dispath_payload) { jquery.getJSON('/middle_panel', filters, function(payload) { dispath_payload.articles = payload.articles; + dispath_payload.filters = filters; JarrDispatcher.dispatch(dispath_payload); _last_fetched_with = MiddlePanelStore.getRequestFilter(); }); -- 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') 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 From 9ad36d04c3a352afc6f9a1322c7401200332877a Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Tue, 2 Feb 2016 23:05:16 +0100 Subject: reload and fold all button --- src/web/js/actions/MenuActions.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/web/js/actions') diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js index d3a0d25d..b9154581 100644 --- a/src/web/js/actions/MenuActions.js +++ b/src/web/js/actions/MenuActions.js @@ -26,6 +26,12 @@ var MenuActions = { filter: filter, }); }, + toggleAllFolding: function(all_folded) { + JarrDispatcher.dispatch({ + type: ActionTypes.TOGGLE_MENU_FOLD, + all_folded: all_folded, + }); + }, }; module.exports = MenuActions; -- cgit