lib/tabulatr/tabulatr/paginator.rb in tabulatr-0.2.0 vs lib/tabulatr/tabulatr/paginator.rb in tabulatr-0.3.0

- old
+ new

@@ -33,21 +33,15 @@ pagesize = pparams[:pagesize].to_i pagesizes = pparams[:pagesizes].map &:to_i # render the 'wrapping' div make_tag(:div, :class => @table_options[:paginator_div_class]) do # << Page Left - if page > 1 - make_tag(:input, :type => 'image', - :src => File.join(@table_options[:image_path_prefix], @table_options[:pager_left_button]), - :class => @table_options[:page_left_class], - :id => "#{pagination_name}_page_left", - :name => "#{pagination_name}[page_left]") - else - make_tag(:img, - :src => File.join(@table_options[:image_path_prefix], @table_options[:pager_left_button_inactive]), - :class => @table_options[:page_left_class]) - end # page > 1 + make_image_button(@table_options[page > 1 ? :pager_left_button : :pager_left_button_inactive], + :class => @table_options[:page_left_class], + :id => "#{pagination_name}_page_left", + :name => "#{pagination_name}[page_left]", + :inactive => (page <= 1)) # current page number concat(make_tag(:input, :type => :hidden, :name => "#{pagination_name}[current_page]", :value => page)) @@ -56,19 +50,14 @@ :size => pages.to_s.length, :name => "#{pagination_name}[page]", :value => page)) concat("/#{pages}") # >> Page Right - if page < pages - make_tag(:input, :type => 'image', - :src => File.join(@table_options[:image_path_prefix], @table_options[:pager_right_button]), - :class => @table_options[:page_right_class], - :id => "#{pagination_name}_page_right", - :name => "#{pagination_name}[page_right]") - else - make_tag(:img, :src => File.join(@table_options[:image_path_prefix], @table_options[:pager_right_button_inactive]), - :class => @table_options[:page_right_class]) - end # page < pages + make_image_button(@table_options[page < pages ? :pager_right_button : :pager_right_button_inactive], + :class => @table_options[:page_right_class], + :id => "#{pagination_name}_page_right", + :name => "#{pagination_name}[page_right]", + :inactive => (page >= pages)) if pagesizes.length > 1 make_tag(:select, :name => "#{pagination_name}[pagesize]", :class => @table_options[:pagesize_select_class]) do pagesizes.each do |n| make_tag(:option, (n.to_i==pagesize ? {:selected => :selected} : {}).merge(:value => n)) do concat(n.to_s) \ No newline at end of file