factorize filter

This commit is contained in:
Meutel 2015-08-03 11:54:44 +02:00
parent 21a6fb98dc
commit afa911284c
5 changed files with 23 additions and 22 deletions

View File

@ -1,6 +1,6 @@
<%= render 'layouts/initials' %> <%= render'layouts/filter' %>
<%= will_paginate class: "center" %>
<%= will_paginate class: "center" %>
<table class="table table-striped authors"> <table class="table table-striped authors">
<tr> <tr>
<th>Name</th> <th>Name</th>
@ -13,6 +13,4 @@
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= will_paginate class: "center" %> <%= will_paginate class: "center" %>
<%= render 'layouts/perpage' %>

View File

@ -1,15 +1,10 @@
<div class="panel panel-default"> <% content_for :latest_filter do
<div class="panel-heading"> isLatest = session[:sort] == "latest" %>
<h3 class="panel-title">Filter</h3> <%= link_to "Latest", url_for(sort: (isLatest ? "alpha" : "latest")), class: "btn btn-default btn-sm " + (isLatest ? " active" : ""), remote: true %>
</div> <% end %>
<div class="panel-body"> <%= render'layouts/filter' %>
<% isLatest = session[:sort] == "latest" %>
<%= link_to "Latest", url_for(sort: (isLatest ? "alpha" : "latest")), class: "btn btn-default btn-sm " + (isLatest ? " active" : ""), remote: true %>
<%= render'layouts/initials' %>
</div>
</div>
<%= will_paginate class: "center" %>
<%= will_paginate class: "center" %>
<table class="table table-striped authors"> <table class="table table-striped authors">
<tr> <tr>
<th>Name</th> <th>Name</th>
@ -33,6 +28,4 @@
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= will_paginate class: "center" %> <%= will_paginate class: "center" %>
<%= render'layouts/perpage' %>

View File

@ -0,0 +1,12 @@
<div class="panel panel-default">
<div class="panel-heading">
<%= link_to "#filterContent", data: { toggle: "collapse" } do %>
<h3 class="panel-title"> Filter </h3>
<% end %>
</div>
<div class="panel-body collapse" id="filterContent">
<%= yield(:latest_filter) %>
<%= render'layouts/initials' %>
<%= render'layouts/perpage' %>
</div>
</div>

View File

@ -1,6 +1,6 @@
<% initials = ['0'] + ('A'..'Z').to_a %> <% initials = ['0'] + ('A'..'Z').to_a %>
<div class="center"> <div class="center">
<ul class="pagination"> <ul class="pagination btn-sm">
<% initials.each do |i| <% initials.each do |i|
is_cur = (i == session[:initial]) is_cur = (i == session[:initial])
%> %>

View File

@ -1,6 +1,6 @@
<%= render'layouts/initials' %> <%= render'layouts/filter' %>
<%= will_paginate class: "center" %>
<%= will_paginate class: "center" %>
<table class="table table-striped series"> <table class="table table-striped series">
<tr> <tr>
<th>Name</th> <th>Name</th>
@ -30,6 +30,4 @@
</tr> </tr>
<% end %> <% end %>
</table> </table>
<%= will_paginate class: "center" %> <%= will_paginate class: "center" %>
<%= render'layouts/perpage' %>