Sha256: 2e065509648b73fa2f7b004646816cb5814679be2850d68e99480d554d3ac07a

Contents?: true

Size: 652 Bytes

Versions: 13

Compression:

Stored size: 652 Bytes

Contents

# A custom WillPaginate LinkRenderer Class for scoping the urls.
require 'will_paginate/view_helpers/action_view'

module Alchemy
	class ScopedPaginationLinkRenderer < WillPaginate::ActionView::LinkRenderer

		def url(page)
			@base_url_params ||= begin
				url_params = merge_get_params(default_url_params)
				merge_optional_params(url_params)
			end

			url_params = @base_url_params.dup
			add_current_page_param(url_params, page)

			if url_params[:scope]
				scope = url_params[:scope]
				url_params.delete(:scope)
				url_params.delete(:controller)
				scope.url_for(url_params)
			else
				@template.url_for(url_params)
			end
		end

	end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
alchemy_cms-2.1.6 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.5 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.4 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.3 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.2 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.1 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.rc6 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.rc5 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.rc4 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.rc3 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.rc2 lib/alchemy/scoped_pagination_link_renderer.rb
alchemy_cms-2.1.beta6 lib/alchemy/scoped_pagination_link_renderer.rb