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 3 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 @@ -12,34 +12,33 @@

<%= render(partial: 'launchers/editable_form_fields/edit_fixed_field', locals: { form: form, attrib: attrib, fixed: fixed }) %>

<ol class="list-group text-center col-md-4 mb-3">
<ol class="list-group list-group-flush text-center col-md-4 mb-3">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I like the list-group-flush here - it seems off to me to only have borders on the bottom/top.

It seems like we should actually just deal with the overflow in the span right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also these can flex to grow (to a certain size, maybe ~33%?) but it does seem like we should actually just deal with text-overflow correctly with potential resizing.

<%- 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><%= 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