fix bug initial/pagination
This commit is contained in:
parent
308f43b967
commit
7da655e0b2
@ -9,7 +9,7 @@ module PreferencesHelper
|
|||||||
def preferences
|
def preferences
|
||||||
session[:current_per_page] = params[:per_page] ? params[:per_page].to_i : (session[:current_per_page] || WillPaginate.per_page)
|
session[:current_per_page] = params[:per_page] ? params[:per_page].to_i : (session[:current_per_page] || WillPaginate.per_page)
|
||||||
if params[:initial]
|
if params[:initial]
|
||||||
session[:initial] = (session[:initial] == params[:initial] ? nil : params[:initial])
|
session[:initial] = (params[:initial] == "reset" ? nil : params[:initial])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<% initials = ['0'] + ('A'..'Z').to_a %>
|
<% initials = ['0'] + ('A'..'Z').to_a %>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<% initials.each do |i| %>
|
<% initials.each do |i|
|
||||||
<%= content_tag :li, class: (i == session[:initial] ? "active": nil) do %>
|
is_cur = (i == session[:initial])
|
||||||
<%= link_to i, url_for(initial: i), remote: true %>
|
%>
|
||||||
|
<%= content_tag :li, class: (is_cur ? "active": nil) do %>
|
||||||
|
<%= link_to i, url_for(initial: ( is_cur ? "reset" : i)), remote: true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user