|
| 1 | +<%# Index view for displaying a list of application forms |
| 2 | + Required locals: |
| 3 | + - title: String - Page title |
| 4 | + - intro: String - Introduction text |
| 5 | + - new_button_text: String - Text for the "New" button |
| 6 | + - new_path: String - Path for the "New" button |
| 7 | + - in_progress_applications_heading: String - Heading for the in-progress section |
| 8 | + - application_forms: Array<Hash> - List of application form data with keys: |
| 9 | + - created_at: String |
| 10 | + - path: String |
| 11 | + - status: Symbol |
| 12 | +
|
| 13 | + Example usage: |
| 14 | + render template: "flex/application_forms/index", locals: { |
| 15 | + title: t(".title"), |
| 16 | + intro: t(".intro"), |
| 17 | + new_button_text: t(".new_button"), |
| 18 | + in_progress_applications_heading: t(".in_progress_applications.heading"), |
| 19 | + application_forms: @application_forms.map { |form| { |
| 20 | + created_at: form.created_at.strftime("%B %d, %Y at %I:%M %p"), |
| 21 | + path: application_form_path(form), |
| 22 | + status: form.status |
| 23 | + }} |
| 24 | + } |
| 25 | +%> |
| 26 | + |
| 27 | +<% content_for :title, title %> |
| 28 | + |
| 29 | +<h1> |
| 30 | + <%= title %> |
| 31 | +</h1> |
| 32 | + |
| 33 | +<p class="usa-intro"> |
| 34 | + <%= intro %> |
| 35 | +</p> |
| 36 | + |
| 37 | +<%= link_to new_button_text, new_path, class: class_names("usa-button") %> |
| 38 | + |
| 39 | +<% if not application_forms.empty? %> |
| 40 | + <h2 class="margin-top-6"><%= in_progress_applications_heading %></h2> |
| 41 | + |
| 42 | + <section class="d-flex flex-column flex-md-row gap-4 align-items-start justify-content-between"> |
| 43 | + <table class="usa-table usa-table--borderless width-full"> |
| 44 | + <thead> |
| 45 | + <tr> |
| 46 | + <th scope="col"> |
| 47 | + <%= t("strata.application_forms.index.col_created_at") %> |
| 48 | + </th> |
| 49 | + <th scope="col"> |
| 50 | + <%= t("strata.application_forms.index.col_status") %> |
| 51 | + </th> |
| 52 | + <th scope="col"> |
| 53 | + <%= t("strata.application_forms.index.col_actions") %> |
| 54 | + </th> |
| 55 | + </tr> |
| 56 | + </thead> |
| 57 | + <tbody> |
| 58 | + <% application_forms.each do |application_form| %> |
| 59 | + <% if local_assigns.key?(:row_view) %> |
| 60 | + <%= render partial: row_view, locals: { application_form: } %> |
| 61 | + <% else %> |
| 62 | + <%= render partial: "strata/application_forms/row", locals: { application_form: } %> |
| 63 | + <% end %> |
| 64 | + <% end %> |
| 65 | + </tbody> |
| 66 | + </table> |
| 67 | + </section> |
| 68 | +<% end %> |
0 commit comments