made a help view spec and cleaned up the views a bit.

This commit is contained in:
Richard 2013-11-07 15:56:22 +01:00 committed by Jonne Haß
parent da6b037f24
commit 55efa82756
7 changed files with 105 additions and 11 deletions

View file

@ -59,10 +59,13 @@ app.views.Help = app.views.StaticContentView.extend({
var items = el.data('items').split(" ");
items.forEach(function(item, i){
var qa = {question: this.getText(section, item, true),
answer: this.getText(section, item, false)};
var qa = {
className: "faq_question_" + section,
question: this.getText(section, item, true),
answer: this.getText(section, item, false)
};
item = new app.views.FaqQuestionView(qa);
$('#faq').append(item.render().el);
this.$el.find('#faq').append(item.render().el);
}, this);
this.setInitialVisibility();
@ -74,8 +77,8 @@ app.views.Help = app.views.StaticContentView.extend({
},
setInitialVisibility: function() {
$('#faq .question.collapsible :first').addClass('opened').removeClass('collapsed');
$('#faq .question.collapsible .answer :first').show();
this.$el.find('#faq .question.collapsible :first').addClass('opened').removeClass('collapsed');
this.$el.find('#faq .question.collapsible .answer :first').show();
},
resetMenu: function(initial) {
@ -94,7 +97,7 @@ app.views.Help = app.views.StaticContentView.extend({
},
clearItems: function() {
$('#faq').empty();
this.$el.find('#faq').empty();
},
sectionClicked : function(e) {
@ -106,9 +109,9 @@ app.views.Help = app.views.StaticContentView.extend({
renderStaticSection: function(section, template, subs) {
this.clearItems();
data = Diaspora.I18n.locale[section];
section = new app.views.HelpSectionView( template, data, subs );
$('#faq').append(section.render().el);
data = $.extend(Diaspora.I18n.locale[section], { className: section });
help_section = new app.views.HelpSectionView( template, data, subs );
this.$el.find('#faq').append(help_section.render().el);
},
gettingHelp: function(e) {

View file

@ -1,3 +1,4 @@
<div class='faq_getting_help'>
<h1>diaspora* FAQ</h1>
<br>
<div class='question opened'>
@ -17,4 +18,5 @@
<li>{{{ get_support_a_hashtag }}}</li>
</ul>
</div>
</div>
</div>

View file

@ -1,3 +1,4 @@
<div class='question opened collapsible'>
<a class='toggle' href='#'>
<h4>{{ hide_posts_q }}</h4>

View file

@ -1,3 +1,4 @@
<div class='question opened collapsible'>
<a class='toggle' href='#'>
<h4>{{ question }}</h4>

View file

@ -1,3 +1,4 @@
<div class='faq_sharing'>
<div class='question opened collapsible'>
<a class='toggle' href='#'>
<h4>{{ add_to_aspect_q }}</h4>
@ -33,4 +34,5 @@
<h4>{{ see_old_posts_q }}</h4>
</a>
<div class='answer hideable'>{{ see_old_posts_a }}</div>
</div>
</div>

View file

@ -6,11 +6,11 @@
<div id='faq_nav'>
<ul>
<li>
<a href="" class="section-unselected faq-link-getting-help" data-section="getting_help" data-items="">{{ title_getting_help }}</a>
<a href="#" class="section-unselected faq-link-getting-help" data-section="getting_help" data-items="">{{ title_getting_help }}</a>
<span class="section-selected">{{ title_getting_help }}</span>
</li>
<li>
<a href="" class="section-unselected faq-link" data-section="account_and_data_management" data-items="move_pods download_data close_account data_visible_to_podmin data_other_podmins">{{ title_account_and_data_management }}</a>
<a href="#" class="section-unselected faq-link" data-section="account_and_data_management" data-items="move_pods download_data close_account data_visible_to_podmin data_other_podmins">{{ title_account_and_data_management }}</a>
<span class="section-selected">{{ title_account_and_data_management }}</span>
</li>
<li>

File diff suppressed because one or more lines are too long