aboutsummaryrefslogtreecommitdiff
path: root/src/web/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/js')
-rw-r--r--src/web/js/actions/MenuActions.js1
-rw-r--r--src/web/js/components/Menu.react.js8
-rw-r--r--src/web/js/stores/MenuStore.js3
3 files changed, 10 insertions, 2 deletions
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,
diff --git a/src/web/js/components/Menu.react.js b/src/web/js/components/Menu.react.js
index b68a84eb..76304f9a 100644
--- a/src/web/js/components/Menu.react.js
+++ b/src/web/js/components/Menu.react.js
@@ -89,6 +89,10 @@ var CategoryGroup = React.createClass({
return {unfolded: true};
},
render: function() {
+ // hidden the no category if empty
+ if(!this.props.cat_id && !this.props.feeds.length) {
+ return <ul className="hidden" />;
+ }
var filter = this.props.filter;
var a_type = this.props.active_type;
var a_id = this.props.active_id;
@@ -197,7 +201,8 @@ var Menu = React.createClass({
</ul>
);
var categories = [];
- for(var cat_id in this.state.categories) {
+ for(var index in this.state.categories_order) {
+ var cat_id = this.state.categories_order[index];
var feeds = [];
var unread = 0;
this.state.categories[cat_id].feeds.map(function(feed_id) {
@@ -237,6 +242,7 @@ var Menu = React.createClass({
this.setState({filter: datas.filter,
feeds: datas.feeds,
categories: datas.categories,
+ categories_order: datas.categories_order,
active_type: datas.active_type,
active_id: datas.active_id});
},
diff --git a/src/web/js/stores/MenuStore.js b/src/web/js/stores/MenuStore.js
index a68b24de..d3c44355 100644
--- a/src/web/js/stores/MenuStore.js
+++ b/src/web/js/stores/MenuStore.js
@@ -6,7 +6,7 @@ var assign = require('object-assign');
var MenuStore = assign({}, EventEmitter.prototype, {
- _datas: {filter: 'all', feeds: {}, categories: {},
+ _datas: {filter: 'all', feeds: {}, categories: {}, categories_order: [],
active_type: null, active_id: null,
is_admin: false, crawling_method: 'classic',
all_unread_count: 0, max_error: 0, error_threshold: 0},
@@ -46,6 +46,7 @@ MenuStore.dispatchToken = JarrDispatcher.register(function(action) {
case ActionTypes.RELOAD_MENU:
MenuStore._datas['feeds'] = action.feeds;
MenuStore._datas['categories'] = action.categories;
+ MenuStore._datas['categories_order'] = action.categories_order;
MenuStore._datas['is_admin'] = action.is_admin;
MenuStore._datas['max_error'] = action.max_error;
MenuStore._datas['error_threshold'] = action.error_threshold;
bgstack15