docbrown/app/views/admin/profile_fields/_ungrouped_profile_fields.html.erb
Ridhwana 3474ffda6d
Profile Admin updates (#10133)
* feat: cater for when there are no profile fields in a group

* feat: add a modal to create a new group

* feat: add a controller and route for the group

* refactor: add group modal

* feat: edit a group

* chore: remove an instance var

* chore: toggle the section using a toggle button

* feat: add the edit button

* chore: update the messaging

* chore: update the class name

* feat: delete the group

* chore: add some css

* chore: use group_name

* chore: rename the file and add the group select to the file

* feat: render the correct partial and add the profile_field_group_id

* feat: add a profile field

* feat: amend the styles on the card header

* feat: add a cursor pointer

* feat: get the form to redirect after an update

* chore:  remove style

* feat: order by created at so that each time we save the order doesn't change

* fix: change the form

* chore: format the options

* feat: show ungrouped fields at the bottom

* feat: add the profile fields length

* chore: remove unused action

* test: add some specs for profile group workflow

* fix: oops

* refactor: grouped profile fields

* refactor: amend the styles

* chore: rename methods

* chore: update headings

* chore: remove changes from my linter

* refactor: suggestions by Michael - upgrade ternary

* refactor: order by name and label
2020-09-02 12:32:25 +02:00

22 lines
1,002 B
Text

<% @ungrouped_profile_fields.each do |field| %>
<div class="row my-3">
<div class="card w-100">
<%= render partial: "admin/configs/card_header",
locals: {
header: field.label,
state: "collapse",
target: "#{field.attribute_name}_container",
expanded: "false"
} %>
<div id="<%= field.attribute_name %>_container" class="card-body collapse hide" aria-labelledby="<%= field.attribute_name %>_container">
<div class="form-group grid p-6 mb-6 gap-1">
<%= form_for [:admin, field] do |form| %>
<%= render "profile_field_form", form: form, group: nil %>
<%= form.submit class: "btn btn-primary" %>
<% end %>
<%= button_to "Delete Profile Field", admin_profile_field_path(field), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-secondary" %>
</div>
</div>
</div>
</div>
<% end %>