sidebar design implemented on search by category and by section page

This commit is contained in:
Edin Dazdarevic
2015-04-19 15:58:08 +02:00
parent 2f809cfbcf
commit 0cdf57d4a9
4 changed files with 123 additions and 98 deletions

View File

@@ -12,16 +12,16 @@ var sectionState = {
};
var loadSections = function() {
var loadSections = function() {
var sections = new SectionCollection();
sections.fetch({success: function() {
sectionState.sections = sections.models;
// change will be called automatically when
// action is run but we need to emit it again
// when the data arive
// when the data arive
// it's a bit "unfluxy" but convenient.
// "true philosophy" would be to run another "data arrived" action
SectionStore.emitChange();
SectionStore.emitChange();
}});
};
@@ -30,6 +30,7 @@ var loadSectionDetails = function(sectionId) {
section.fetch({
success: function() {
_sectionDetails = section;
console.log('section details', _sectionDetails);
SectionStore.emitChange();
}
});
@@ -43,7 +44,7 @@ var setHovered = function(id) {
// Extend SectionStore with EventEmitter to add eventing capabilities
var SectionStore = _.extend({}, EventEmitter.prototype, {
// Return Single Item With Details
// Return Single Item With Details
getState: function() {
return sectionState;
},
@@ -77,7 +78,7 @@ AppDispatcher.register(function(payload) {
// Respond to SELECT_ITEM action
case SectionConstants.LOAD_SECTIONS:
loadSections();
loadSections();
break;
case SectionConstants.SET_SECTION_HOVER: