lib/neat_pages/helpers.rb in neat-pages-0.1.7 vs lib/neat_pages/helpers.rb in neat-pages-1.0.0
- old
+ new
@@ -1,23 +1,21 @@
+#*************************************************************************************
+# Insert a bunch of helper methods in the ActionView::Base of a Rails project.
+#*************************************************************************************
module NeatPages::Helpers
def neat_pages_ajax_items(partial_path, options={})
- ('<div id="neat-pages-ajax-wrapper" class="first-load">' + render(partial_path, options) + '</div>').html_safe
- end
+ options = { wrapper: :div }.merge(options)
- def neat_pages_base_url
- "#{request.protocol}#{request.host}#{request.port == 80 ? '' : ':' + request.port.to_s}#{request.path_info}"
+ ("<#{options[:wrapper]} id=\"neat-pages-ajax-wrapper\" class=\"first-load\">" + render(partial_path, options) + "</#{options[:wrapper]}>").html_safe
end
- def neat_pages_base_params
- request.env['action_dispatch.request.query_parameters']
- end
-
+ # DEPRECATED : The options parameter is deprecated. I left it here for backward compatibility. (2013-11-20)
def neat_pages_navigation(options={})
- NeatPages::Helpers::Navigation.new(pagination, neat_pages_base_url, neat_pages_base_params).generate(options)
+ NeatPages::Helpers::Navigation.new(pagination, request).generate
end
def neat_pages_status
- NeatPages::Helpers::Status.new(pagination, neat_pages_base_url, neat_pages_base_params).generate
+ NeatPages::Helpers::Status.new(pagination, request).generate
end
::ActionView::Base.send :include, self
end