aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/actions
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-10-12 22:36:01 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-26 23:46:32 +0100
commit2c0e17cb977a1e8782799b337df8b1583d019906 (patch)
tree75563e440e9eac14950fa1a71a83e64df20e52d0 /src/web/js/actions
parentfixing sqlalchemy resolving warning (diff)
downloadnewspipe-2c0e17cb977a1e8782799b337df8b1583d019906.tar.gz
newspipe-2c0e17cb977a1e8782799b337df8b1583d019906.tar.bz2
newspipe-2c0e17cb977a1e8782799b337df8b1583d019906.zip
bootstraping react
Diffstat (limited to 'src/web/js/actions')
-rw-r--r--src/web/js/actions/MenuActions.js36
-rw-r--r--src/web/js/actions/MiddlePanelActions.js54
2 files changed, 90 insertions, 0 deletions
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;
bgstack15