rughetto-merb_paginate 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/merb_paginate/view_helpers.rb +8 -19
 - metadata +1 -1
 
| 
         @@ -59,7 +59,6 @@ module MerbPaginate 
     | 
|
| 
       59 
59 
     | 
    
         
             
                # * <tt>:outer_window</tt> -- how many links are around the first and the last page (default: 1)
         
     | 
| 
       60 
60 
     | 
    
         
             
                # * <tt>:separator</tt> -- string separator for page HTML elements (default: single space)
         
     | 
| 
       61 
61 
     | 
    
         
             
                # * <tt>:param_name</tt> -- parameter name for page number in URLs (default: <tt>:page</tt>)
         
     | 
| 
       62 
     | 
    
         
            -
                # * <tt>:named_route</tt> -- optional named route used to generate the pagination url
         
     | 
| 
       63 
62 
     | 
    
         
             
                # * <tt>:params</tt> -- additional parameters when generating pagination links
         
     | 
| 
       64 
63 
     | 
    
         
             
                #   (eg. <tt>:controller => "foo", :action => nil</tt>)
         
     | 
| 
       65 
64 
     | 
    
         
             
                # * <tt>:renderer</tt> -- class name of the link renderer (default: WillPaginate::LinkRenderer)
         
     | 
| 
         @@ -226,29 +225,19 @@ module MerbPaginate 
     | 
|
| 
       226 
225 
     | 
    
         
             
                def page_link_or_span(page, span_class = 'current', text = nil)
         
     | 
| 
       227 
226 
     | 
    
         
             
                  text ||= page.to_s
         
     | 
| 
       228 
227 
     | 
    
         
             
                  if page and page != current_page
         
     | 
| 
       229 
     | 
    
         
            -
                    "<a href=\"#{ 
     | 
| 
      
 228 
     | 
    
         
            +
                    "<a href=\"#{url_for_page(page)}\">#{text}</a>"
         
     | 
| 
       230 
229 
     | 
    
         
             
                  else
         
     | 
| 
       231 
230 
     | 
    
         
             
                    "<span class=\"#{span_class}\">#{text}</span>"
         
     | 
| 
       232 
231 
     | 
    
         
             
                  end
         
     | 
| 
       233 
232 
     | 
    
         
             
                end
         
     | 
| 
       234 
233 
     | 
    
         | 
| 
       235 
     | 
    
         
            -
                 
     | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
       237 
     | 
    
         
            -
             
     | 
| 
       238 
     | 
    
         
            -
                   
     | 
| 
       239 
     | 
    
         
            -
                  
         
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
       241 
     | 
    
         
            -
                   
     | 
| 
       242 
     | 
    
         
            -
                  options.rec_merge!(@options[:params]) if @options[:params]
         
     | 
| 
       243 
     | 
    
         
            -
                  return options
         
     | 
| 
       244 
     | 
    
         
            -
                end
         
     | 
| 
       245 
     | 
    
         
            -
                
         
     | 
| 
       246 
     | 
    
         
            -
                def url_options_string(page)
         
     | 
| 
       247 
     | 
    
         
            -
                  if @options[:named_route]
         
     | 
| 
       248 
     | 
    
         
            -
                    @template.url(@options[:named_route], url_options(page))
         
     | 
| 
       249 
     | 
    
         
            -
                  else
         
     | 
| 
       250 
     | 
    
         
            -
                    @template.url(url_options(page))
         
     | 
| 
       251 
     | 
    
         
            -
                  end
         
     | 
| 
      
 234 
     | 
    
         
            +
                def url_for_page(page)
         
     | 
| 
      
 235 
     | 
    
         
            +
                  # Include all query params when constructing new paging URL
         
     | 
| 
      
 236 
     | 
    
         
            +
                  params = @template.params.to_a.reject{|i| ['namespace', 'controller', 'action', 'format'].include?(i[0]) }
         
     | 
| 
      
 237 
     | 
    
         
            +
                  params << [param_name, page]
         
     | 
| 
      
 238 
     | 
    
         
            +
                  params = params.map{|i| i.join('=')}.join('&')
         
     | 
| 
      
 239 
     | 
    
         
            +
             
     | 
| 
      
 240 
     | 
    
         
            +
                  @template.request.path + "?" + params
         
     | 
| 
       252 
241 
     | 
    
         
             
                end
         
     | 
| 
       253 
242 
     | 
    
         | 
| 
       254 
243 
     | 
    
         
             
              private
         
     |