mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Merge pull request #553 from apotonick/views-prefix
Fix a bug where :view_paths wouldn't be inherited to nested helpers.
This commit is contained in:
commit
dab326f94d
5 changed files with 8 additions and 5 deletions
|
@ -26,7 +26,7 @@ module Kaminari
|
|||
end
|
||||
@template, @options = template, options
|
||||
@theme = @options.delete(:theme)
|
||||
@views_prefix = @options.delete(:views_prefix)
|
||||
@views_prefix = @options[:views_prefix]
|
||||
@window_options.merge! @options
|
||||
@window_options[:current_page] = @options[:current_page] = PageProxy.new(@window_options, @options[:current_page], nil)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ module Kaminari
|
|||
@template, @options = template, options.dup
|
||||
@param_name = @options.delete(:param_name) || Kaminari.config.param_name
|
||||
@theme = @options.delete(:theme)
|
||||
@views_prefix = @options.delete(:views_prefix)
|
||||
@views_prefix = @options[:views_prefix]
|
||||
@params = template.params.except(*PARAM_KEY_BLACKLIST).merge(@options.delete(:params) || {})
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<b><%= current_page %></b>
|
|
@ -1 +1,3 @@
|
|||
<p><%= current_page %></p>
|
||||
<%= paginator.render do -%>
|
||||
<%= first_page_tag %>
|
||||
<% end -%>
|
||||
|
|
|
@ -18,8 +18,8 @@ describe 'Kaminari::ActionViewExtension', :if => defined?(Rails) do
|
|||
|
||||
context 'accepts :view_prefix option' do
|
||||
before { helper.controller.append_view_path "spec/fake_app/views" }
|
||||
subject { helper.paginate @users, :views_prefix => "alternative/" }
|
||||
it { should eq("<p>1</p>") }
|
||||
subject { helper.paginate @users, :views_prefix => "alternative/", :params => {:controller => 'users', :action => 'index'} }
|
||||
it { should eq(" <b>1</b>\n") }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue