Skip to content

Commit

Permalink
Fixes #36703 - Enhance handling of hash-based actions for single buttons
Browse files Browse the repository at this point in the history
Extend support for hash-based actions within dropdown menus for single buttons.
  • Loading branch information
nofaralfasi committed Aug 27, 2023
1 parent 55b0a9f commit f5f7872
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -664,3 +664,7 @@ td .dropdown-menu > li > a.disabled:hover,
td .dropdown-menu > li > a.disabled:focus {
cursor: pointer;
}

span.btn a.disabled {
color: #8b8d8f;
}
5 changes: 4 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ def action_buttons(*args)
return if args.blank?

# single button
return content_tag(:span, args[0].html_safe, :class => 'btn btn-sm btn-default') if args.length == 1
if args.length == 1
action = args[0].is_a?(Hash) ? args[0][:content] : args[0]
return content_tag(:span, action.html_safe, :class => 'btn btn-sm btn-default')
end

# multiple buttons
primary = args.delete_at(0).html_safe
Expand Down

0 comments on commit f5f7872

Please sign in to comment.