Skip to content
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 @@ -160,7 +160,7 @@ def bulk_menu(abstract_model = @abstract_model)
content_tag(:ul, class: 'dropdown-menu', style: 'left:auto; right:0;') do
actions.collect do |action|
content_tag :li do
link_to wording_for(:bulk_link, action), '#', onclick: "jQuery('#bulk_action').val('#{action.action_name}'); jQuery('#bulk_form').submit(); return false;"
link_to wording_for(:bulk_link, action, abstract_model), '#', onclick: "jQuery('#bulk_action').val('#{action.action_name}'); jQuery('#bulk_form').submit(); return false;"
end
end.join.html_safe
end
Expand Down
19 changes: 16 additions & 3 deletions spec/helpers/rails_admin/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,25 @@ def initialize(_user)
end
end
end
@action = RailsAdmin::Config::Actions.find :index
result = helper.bulk_menu(RailsAdmin::AbstractModel.new(Team))
en = {admin: {actions: {
zorg: {bulk_link: 'Zorg all these %{model_label_plural}'},
blub: {bulk_link: 'Blub all these %{model_label_plural}'},
}}}
I18n.backend.store_translations(:en, en)

@abstract_model = RailsAdmin::AbstractModel.new(Team)
result = helper.bulk_menu

expect(result).to match('zorg_action')
expect(result).to match('Zorg all these Teams')
expect(result).to match('blub')
expect(result).to match('Blub all these Teams')

expect(helper.bulk_menu(RailsAdmin::AbstractModel.new(Player))).not_to match('blub')
result_2 = helper.bulk_menu(RailsAdmin::AbstractModel.new(Player))
expect(result_2).to match('zorg_action')
expect(result_2).to match('Zorg all these Players')
expect(result_2).not_to match('blub')
expect(result_2).not_to match('Blub all these Players')
end
end

Expand Down