From 059c97d810d9717d819ce88783d3510bd18051c4 Mon Sep 17 00:00:00 2001 From: Martin Povolny Date: Tue, 20 Jun 2017 13:41:12 +0200 Subject: [PATCH 1/2] CustomButtons: enable submit_all. --- .../application_controller/buttons.rb | 4 +--- app/views/shared/buttons/_ab_form.html.haml | 17 ++++++++--------- app/views/shared/buttons/_ab_show.html.haml | 11 +++++------ 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/controllers/application_controller/buttons.rb b/app/controllers/application_controller/buttons.rb index 3f050d9de89..8c979bf0998 100644 --- a/app/controllers/application_controller/buttons.rb +++ b/app/controllers/application_controller/buttons.rb @@ -267,9 +267,7 @@ def custom_button_done def custom_buttons_invoke(button, objs) if objs.length > 1 && (button.options && button.options.key?(:submit_how) && button.options[:submit_how].to_s == 'all') - # FIXME: wee need something like this from the core/automate: - # button.invoke(:object_id => objs.map(&:id), :object_type => objs[0].class.base_class.name) - raise "Not implemented." + button.invoke(objs) else objs.each { |obj| button.invoke(obj) } end diff --git a/app/views/shared/buttons/_ab_form.html.haml b/app/views/shared/buttons/_ab_form.html.haml index 4838fd867e9..bb119bd50b1 100644 --- a/app/views/shared/buttons/_ab_form.html.haml +++ b/app/views/shared/buttons/_ab_form.html.haml @@ -72,15 +72,14 @@ = select_tag("display_for", options_for_select([[_('Single entity'), 'single'], [_('List'), 'list'], [_('Single and list'), 'both']], @edit[:new][:display_for]), "data-miq_sparkle_on" => true) - -# TODO: temporary disabled until the backend supports "submit all" - -# .form-group - -# %label.control-label.col-md-2 - -# = _('Submit') - -# .col-md-8 - -# = select_tag("submit_how", - -# options_for_select([[_('Submit all'), 'all'], [_('One by one'), 'one']], @edit[:new][:submit_how]), - -# "data-miq_sparkle_on" => true, - -# ) + .form-group + %label.control-label.col-md-2 + = _('Submit') + .col-md-8 + = select_tag("submit_how", + options_for_select([[_('Submit all'), 'all'], [_('One by one'), 'one']], @edit[:new][:submit_how]), + "data-miq_sparkle_on" => true, + ) = render(:partial => "layouts/ae_resolve_options", :locals => {:resolve => @edit, diff --git a/app/views/shared/buttons/_ab_show.html.haml b/app/views/shared/buttons/_ab_show.html.haml index 9bb911a1243..99900ebf865 100644 --- a/app/views/shared/buttons/_ab_show.html.haml +++ b/app/views/shared/buttons/_ab_show.html.haml @@ -40,12 +40,11 @@ = _('Display for') .col-md-8 = @custom_button.options[:display_for] - -# TODO: temporary disabled until the backend supports "submit all" - -# .form-group - -# %label.control-label.col-md-2 - -# = _('Submit') - -# .col-md-8 - -# = @custom_button.options[:submit_how] + .form-group + %label.control-label.col-md-2 + = _('Submit') + .col-md-8 + = @custom_button.options[:submit_how] %hr %h3 From 4ed5423d574cf5e131bd3e939094f0104a877dc1 Mon Sep 17 00:00:00 2001 From: Martin Povolny Date: Tue, 20 Jun 2017 14:05:53 +0200 Subject: [PATCH 2/2] CustomButtons: nice strings for display_for and submit_how. --- app/views/shared/buttons/_ab_show.html.haml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/shared/buttons/_ab_show.html.haml b/app/views/shared/buttons/_ab_show.html.haml index 99900ebf865..1631bf92037 100644 --- a/app/views/shared/buttons/_ab_show.html.haml +++ b/app/views/shared/buttons/_ab_show.html.haml @@ -39,12 +39,14 @@ %label.control-label.col-md-2 = _('Display for') .col-md-8 - = @custom_button.options[:display_for] + - display_how_map = {'single' => _('Single entity'), 'list' => _('List'), 'both' => _('Single and list')} + = display_how_map[@custom_button.options[:display_for]] .form-group %label.control-label.col-md-2 = _('Submit') .col-md-8 - = @custom_button.options[:submit_how] + - submit_how_map = { 'all' => _('Submit all'), 'one' => _('One by one') } + = submit_how_map[@custom_button.options[:submit_how]] %hr %h3