diff options
Diffstat (limited to 'views/models_navigation_bottom.haml')
-rw-r--r-- | views/models_navigation_bottom.haml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/views/models_navigation_bottom.haml b/views/models_navigation_bottom.haml new file mode 100644 index 0000000..abea2d4 --- /dev/null +++ b/views/models_navigation_bottom.haml @@ -0,0 +1,47 @@ +.models_navigation + - js = "" + %form{:name => "nav_bottom", :action => url_for('/models'), :method => "get", :id => "nav"} + %input{:type => :hidden, :name => :sort_by, :id => "sort_by", :value => params[:sort_by]} + %input{:type => :hidden, :name => :order, :id => "order", :value => params[:order]} + %input{:type => :hidden, :name => :page, :id => "page", :value => params[:page]} + + - if @models.size > 5 + Models: + - if @models.size < 5*@page+5 + - last = @models.size + - else + - last = 5*@page+5 + = "#{5*@page+1}-#{last} / #{@models.size}" + | Page: + - unless @page.to_i == 0 + #prevbot{:class => "link"} + %img{:src => "arrow_left.png", :alt => 'previous', :title => 'previous'}/ + -else + %img{:src => "arrow_left_inactive.png", :alt => '', :title => ''}/ + + - (0..(@models.size/5).to_f.ceil-1).each do |p| + -if p != @page.to_f + %a{:href => '#', :id => "page_linkbot_#{p}", :class => "page page_link"} #{p+1} + - js += "$('#page_linkbot_#{p}').click(function() \{ \n" + - js += " $('#page').val('#{p}');\n" + - js += " $('#nav').submit();\n" + - js += "});\n" + -else + %span{:class => "page page_active"} #{p+1} + + - unless 5*@page.to_i+5 >= @models.size + #nextbot{:class => "link"} + %img{:src => "arrow_right.png", :alt => 'next', :title => 'next'}/ + -else + %img{:src => "arrow_right_inactive.png", :alt => '', :title => ''}/ + + :javascript + $("#prevbot").click(function() { + $("#page").val(#{@page-1}); + $("#nav").submit(); + }); + $("#nextbot").click(function() { + $("#page").val(#{@page+1}); + $("#nav").submit(); + }); + #{js}
\ No newline at end of file |