Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3436 clean-up PM launcher editable_select interface #3889

Merged
merged 6 commits into from
Oct 24, 2024
Merged
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 @@ -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
Loading