Skip to content

Commit

Permalink
3436 clean-up PM launcher editable_select interface (#3889)
Browse files Browse the repository at this point in the history
Moved 'add' & 'remove' buttons below the 'choice' label in launcher's editable_select partial. This is to help options with long text appear a bit nicer.
  • Loading branch information
euler-room authored Oct 24, 2024
1 parent 569be8a commit 1b076a8
Showing 1 changed file with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,31 @@

<ol class="list-group text-center col-md-4 mb-3">
<%- attrib.select_choices(hide_excludable: false).each do |select_data| %>
<%-
choice = parse_select_data(select_data)
disabled = attrib.exclude_select_choices.include?(choice)
last_option = attrib.exclude_select_choices.length + 1 == attrib.select_choices(hide_excludable: false).length
li_classes = disabled ? 'list-group-item list-group-item-danger text-strike' : 'list-group-item'
add_id = "#{field_id}_add_#{choice}"
remove_id = "#{field_id}_remove_#{choice}"
-%>

<li class="<%= li_classes %>">

<button class="btn btn-info float-start" type="button" id="<%= add_id %>"
data-select-toggler="add" data-select-id="<%= field_id %>"
<%= disabled ? nil : 'disabled="true"' %> >
<%= t('dashboard.add') %>
</button>

<span data-select-value><%= choice %></span>

<button class="btn btn-warning float-end" type="button" id="<%= remove_id %>"
data-select-toggler="remove" data-select-id="<%= field_id %>"
<%= disabled || last_option ? 'disabled="true"'.html_safe : nil %> >
<%= t('dashboard.remove') %>
</button>

</li>
<%-
choice = parse_select_data(select_data)
disabled = attrib.exclude_select_choices.include?(choice)
last_option = attrib.exclude_select_choices.length + 1 == attrib.select_choices(hide_excludable: false).length
li_classes = disabled ? 'list-group-item list-group-item-danger text-strike' : 'list-group-item'
add_id = "#{field_id}_add_#{choice}"
remove_id = "#{field_id}_remove_#{choice}"
-%>

<li class="<%= li_classes %>">

<span data-select-value class="text-break"><%= choice %></span><br/>

<button class="btn btn-info float-start w-45" type="button" id="<%= add_id %>"
data-select-toggler="add" data-select-id="<%= field_id %>"
<%= disabled ? nil : 'disabled="true"' %> >
<%= t('dashboard.add') %>
</button>

<button class="btn btn-warning float-end w-45" type="button" id="<%= remove_id %>"
data-select-toggler="remove" data-select-id="<%= field_id %>"
<%= disabled || last_option ? 'disabled="true"'.html_safe : nil %> >
<%= t('dashboard.remove') %>
</button>
</li>
<%- end -%>
</ol>

Expand Down

0 comments on commit 1b076a8

Please sign in to comment.