Skip to content

Commit

Permalink
Merge pull request #1572 from martinpovolny/custom_button_submit_all
Browse files Browse the repository at this point in the history
Custom button submit all
  • Loading branch information
h-kataria authored Jun 21, 2017
2 parents 80facbc + 4ed5423 commit aa86166
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
4 changes: 1 addition & 3 deletions app/controllers/application_controller/buttons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 8 additions & 9 deletions app/views/shared/buttons/_ab_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 8 additions & 7 deletions app/views/shared/buttons/_ab_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@
%label.control-label.col-md-2
= _('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]
- 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
- submit_how_map = { 'all' => _('Submit all'), 'one' => _('One by one') }
= submit_how_map[@custom_button.options[:submit_how]]
%hr

%h3
Expand Down

0 comments on commit aa86166

Please sign in to comment.