Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1295 from stympy/master

Added pjax? option to Actions::Base
  • Loading branch information...
commit ed8d18c5b37eb61e47ae895130183f3259bf94fb 2 parents 95f8bf2 + 115f20c
@bbenezech bbenezech authored
View
2  app/helpers/rails_admin/application_helper.rb
@@ -118,7 +118,7 @@ def menu_for(parent, abstract_model = nil, object = nil, only_icon = false) # pe
wording = wording_for(:menu, action)
%{
<li title="#{wording if only_icon}" rel="#{'tooltip' if only_icon}" class="icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}">
- <a class="#{action.key == :show_in_app ? '' : 'pjax'}" href="#{url_for({ :action => action.action_name, :controller => 'rails_admin/main', :model_name => abstract_model.try(:to_param), :id => (object.try(:persisted?) && object.try(:id) || nil) })}">
+ <a class="#{action.pjax? ? 'pjax' : ''}" href="#{url_for({ :action => action.action_name, :controller => 'rails_admin/main', :model_name => abstract_model.try(:to_param), :id => (object.try(:persisted?) && object.try(:id) || nil) })}">
<i class="#{action.link_icon}"></i>
<span#{only_icon ? " style='display:none'" : ""}>#{wording}</span>
</a>
View
5 lib/rails_admin/config/actions/base.rb
@@ -54,6 +54,11 @@ class Base
false
end
+ # Render via pjax?
+ register_instance_option :pjax? do
+ true
+ end
+
# This block is evaluated in the context of the controller when action is called
# You can access:
# - @objects if you're on a model scope
View
4 lib/rails_admin/config/actions/show_in_app.rb
@@ -21,6 +21,10 @@ class ShowInApp < RailsAdmin::Config::Actions::Base
register_instance_option :link_icon do
'icon-eye-open'
end
+
+ register_instance_option :pjax? do
+ false
+ end
end
end
end

1 comment on commit ed8d18c

@helphop

I have tried the code above but my collection action is still being submitted with pjax

Please sign in to comment.
Something went wrong with that request. Please try again.