aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/actions
diff options
context:
space:
mode:
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