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