refactored a bit in help section views. using backbone jquery selector shorthand and jquery each.
This commit is contained in:
parent
1561690303
commit
a132b6c1b5
3 changed files with 16 additions and 16 deletions
|
|
@ -19,9 +19,8 @@ app.views.FaqQuestionView = app.views.Base.extend({
|
||||||
var section = app.views.Base.prototype.render.apply(this, arguments);
|
var section = app.views.Base.prototype.render.apply(this, arguments);
|
||||||
|
|
||||||
// After render actions
|
// After render actions
|
||||||
var el = $(this.el);
|
this.$('.question.collapsible').removeClass('opened').addClass('collapsed');
|
||||||
el.find('.question.collapsible').removeClass('opened').addClass('collapsed');
|
this.$('.answer').hide();
|
||||||
el.find('.answer').hide();
|
|
||||||
|
|
||||||
return section;
|
return section;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ app.views.HelpSectionView = app.views.StaticContentView.extend({
|
||||||
var section = app.views.Base.prototype.render.apply(this, arguments);
|
var section = app.views.Base.prototype.render.apply(this, arguments);
|
||||||
|
|
||||||
// After render actions
|
// After render actions
|
||||||
$(this.el).find('.question.collapsible').removeClass('opened').addClass('collapsed');
|
this.$('.question.collapsible').removeClass('opened').addClass('collapsed');
|
||||||
$(this.el).find('.answer.hideable').hide();
|
this.$('.answer.hideable').hide();
|
||||||
$(this.el).find('.question.collapsible :first').addClass('opened').removeClass('collapsed');
|
this.$('.question.collapsible :first').addClass('opened').removeClass('collapsed');
|
||||||
$(this.el).find('.answer.hideable :first').show();
|
this.$('.answer.hideable :first').show();
|
||||||
|
|
||||||
return section;
|
return section;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -59,16 +59,17 @@ app.views.Help = app.views.StaticContentView.extend({
|
||||||
this.clearItems();
|
this.clearItems();
|
||||||
var section = el.data('section');
|
var section = el.data('section');
|
||||||
var items = el.data('items').split(" ");
|
var items = el.data('items').split(" ");
|
||||||
|
var self = this;
|
||||||
|
|
||||||
items.forEach(function(item, i){
|
$.each(items, function(i, item){
|
||||||
var qa = {
|
var qa = {
|
||||||
className: "faq_question_" + section,
|
className: "faq_question_" + section,
|
||||||
question: this.getText(section, item, true),
|
question: self.getText(section, item, true),
|
||||||
answer: this.getText(section, item, false)
|
answer: self.getText(section, item, false)
|
||||||
};
|
};
|
||||||
item = new app.views.FaqQuestionView(qa);
|
item = new app.views.FaqQuestionView(qa);
|
||||||
this.$el.find('#faq').append(item.render().el);
|
self.$('#faq').append(item.render().el);
|
||||||
}, this);
|
});
|
||||||
|
|
||||||
this.setInitialVisibility();
|
this.setInitialVisibility();
|
||||||
},
|
},
|
||||||
|
|
@ -79,8 +80,8 @@ app.views.Help = app.views.StaticContentView.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
setInitialVisibility: function() {
|
setInitialVisibility: function() {
|
||||||
this.$el.find('#faq .question.collapsible :first').addClass('opened').removeClass('collapsed');
|
this.$('#faq .question.collapsible :first').addClass('opened').removeClass('collapsed');
|
||||||
this.$el.find('#faq .question.collapsible .answer :first').show();
|
this.$('#faq .question.collapsible .answer :first').show();
|
||||||
},
|
},
|
||||||
|
|
||||||
resetMenu: function(initial) {
|
resetMenu: function(initial) {
|
||||||
|
|
@ -99,7 +100,7 @@ app.views.Help = app.views.StaticContentView.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
clearItems: function() {
|
clearItems: function() {
|
||||||
this.$el.find('#faq').empty();
|
this.$('#faq').empty();
|
||||||
},
|
},
|
||||||
|
|
||||||
sectionClicked : function(e) {
|
sectionClicked : function(e) {
|
||||||
|
|
@ -113,7 +114,7 @@ app.views.Help = app.views.StaticContentView.extend({
|
||||||
this.clearItems();
|
this.clearItems();
|
||||||
data = $.extend(Diaspora.I18n.locale[section], { className: section });
|
data = $.extend(Diaspora.I18n.locale[section], { className: section });
|
||||||
help_section = new app.views.HelpSectionView( template, data, subs );
|
help_section = new app.views.HelpSectionView( template, data, subs );
|
||||||
this.$el.find('#faq').append(help_section.render().el);
|
this.$('#faq').append(help_section.render().el);
|
||||||
},
|
},
|
||||||
|
|
||||||
gettingHelp: function(e) {
|
gettingHelp: function(e) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue