Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def scoped_collection_actions_sidebar_section
b_data[:inputs] = options[:form].is_a?(Proc) ? options[:form].call : options[:form]
end
b_data[:confirm] = options.fetch(:confirm, I18n.t('active_admin_scoped_collection_actions.confirm_action_message'))
b_data[:confirm] = b_data[:confirm].call if b_data[:confirm].is_a?(Proc)
b_options[:data] = b_data.to_json
button b_title, b_options
end
Expand Down
12 changes: 12 additions & 0 deletions spec/posts_actions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@
end
end

context 'scoped collection action DELETE' do
before do
page.find('#collection_actions_sidebar_section button', text: 'Delete').click
end

context 'title' do
it 'has predefined confirmation title' do
expect(page).to have_css('.active_admin_dialog_mass_update_by_filter', text: 'Custom text for confirm delete all?')
end
end
end

end
3 changes: 3 additions & 0 deletions spec/support/admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def add_post_resource(options = {}, &block)
author_id: Author.all.map { |author| [author.name, author.id] }
}
}
scoped_collection_action :scoped_collection_destroy,
title: 'Delete',
confirm: -> { 'Custom text for confirm delete all?' }
end

Rails.application.reload_routes!
Expand Down