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

View File

@ -1,15 +1,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Filter</h3>
</div>
<div class="panel-body">
<% isLatest = session[:sort] == "latest" %>
<% content_for :latest_filter do
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" %>
<% end %>
<%= render'layouts/filter' %>
<%= will_paginate class: "center" %>
<table class="table table-striped authors">
<tr>
<th>Name</th>
@ -33,6 +28,4 @@
</tr>
<% end %>
</table>
<%= 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 %>
<div class="center">
<ul class="pagination">
<ul class="pagination btn-sm">
<% initials.each do |i|
is_cur = (i == session[:initial])
%>

View File

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