summaryrefslogtreecommitdiff
path: root/views/models_navigation_bottom.haml
diff options
context:
space:
mode:
Diffstat (limited to 'views/models_navigation_bottom.haml')
-rw-r--r--views/models_navigation_bottom.haml42
1 files changed, 42 insertions, 0 deletions
diff --git a/views/models_navigation_bottom.haml b/views/models_navigation_bottom.haml
new file mode 100644
index 0000000..b2425fa
--- /dev/null
+++ b/views/models_navigation_bottom.haml
@@ -0,0 +1,42 @@
+.models_navigation
+ - js = ""
+ - 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