Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pjax? option to Actions::Base #1295

Merged
merged 1 commit into from
Feb 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/helpers/rails_admin/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,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>
Expand Down
5 changes: 5 additions & 0 deletions lib/rails_admin/config/actions/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,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
Expand Down
4 changes: 4 additions & 0 deletions lib/rails_admin/config/actions/show_in_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down