Skip to content

Commit

Permalink
Fix double pagination on tags questions (publiclab#8689)
Browse files Browse the repository at this point in the history
* fixed double pagination on tags questions

* fix double pagination

* pass tests
  • Loading branch information
Cadreia authored and reginaalyssa committed Oct 16, 2021
1 parent b9a6c50 commit 84ee629
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
3 changes: 1 addition & 2 deletions app/views/questions/_new_question.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,14 @@
<% end %>
</div>
</div>
</div>
<div class="text-center">
<% if @pagy %>
<%== pagy_bootstrap_nav @pagy %>
<% else %>
<%= will_paginate questions, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated || questions.empty? %>
<% end %>
</div>
</div>

<style>

Expand Down
31 changes: 23 additions & 8 deletions app/views/tag/show/_tab_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
<% if @node_type == "questions" %>
<div class="tab-pane active" id="questions">
<div class="tab-pane" id="questions-tab">
<div id="questions-tab">
<div class="btn-group text-center">
<a href="#asked-tab" class="btn btn-outline-secondary active" data-toggle="tab">Asked</a>
<a href="#answered-tab" class="btn btn-outline-secondary" data-toggle="tab">Answered</a>
<a id="asked-tab" class="btn btn-outline-secondary active">Asked</a>
<a id="answered-tab" class="btn btn-outline-secondary">Answered</a>
</div>

<div class="tab-content">
<div class="tab-pane active" id="asked-tab">
<div id="asked-content">
<%= render partial: "questions/new_question" %>
</div>

<div class="tab-pane" id="answered-tab">
<% if @answered_questions %>
<div id="answered-content">
<% if @answered_questions %>
<%= render partial: "users/answered" %>
<% end %>
<% end %>
</div>
</div>
</div>
Expand Down Expand Up @@ -66,6 +66,21 @@
<%= render partial: "tag/contributors" %>
</div>
<% end %>
<br />
<br>

</div>

<script type="text/javascript">
$("#answered-content").hide();
$("#asked-content").show();
$("#asked-tab").on('click', function() {
$("#answered-content").hide();
$("#asked-content").show();
}
)
$("#answered-tab").on('click', function() {
$("#asked-content").hide();
$("#answered-content").show();
}
)
</script>
5 changes: 2 additions & 3 deletions app/views/users/_answered.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@
</script>
<% end %>
</div>
</div>
<div class="text-center">
<div class="text-center">
<% if @pagy %>
<%== pagy_bootstrap_nav @pagy %>
<% else %>
<%= will_paginate @questions, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated || @questions.empty? %>
<% end %>
</div>
</div>

0 comments on commit 84ee629

Please sign in to comment.