Skip to content

Commit

Permalink
Merge b33dbb8 into bef6f02
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Maguire committed Apr 15, 2014
2 parents bef6f02 + b33dbb8 commit 7ff2dd1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/helpers/rails_admin/application_helper.rb
Expand Up @@ -116,9 +116,11 @@ def menu_for(parent, abstract_model = nil, object = nil, only_icon = false) # pe
actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) }
actions.collect do |action|
wording = wording_for(:menu, action)
confirm = action.confirmation_required ? "data-confirm=\"#{t("admin.actions.confirm_prompt")}\"" : ""
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))
%(
<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.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))}">
<a class="#{action.pjax? ? 'pjax' : ''}" #{confirm} href="#{href}">
<i class="#{action.link_icon}"></i>
<span#{only_icon ? " style='display:none'" : ""}>#{wording}</span>
</a>
Expand Down
1 change: 1 addition & 0 deletions config/locales/rails_admin.en.yml
Expand Up @@ -58,6 +58,7 @@ en:
item: "Item"
message: "Message"
actions:
confirm_prompt: "Are you sure?"
dashboard:
title: "Site Administration"
menu: "Dashboard"
Expand Down
5 changes: 5 additions & 0 deletions lib/rails_admin/config/actions/base.rb
Expand Up @@ -18,6 +18,11 @@ class Base
[]
end

# Should the action show a confirmation (using jquery_ujs) before performing this action
register_instance_option :confirmation_required do
false
end

# http://twitter.github.com/bootstrap/base-css.html#icons
register_instance_option :link_icon do
'icon-question-sign'
Expand Down

0 comments on commit 7ff2dd1

Please sign in to comment.