diff --git a/app/views/organisation_name_changes/_name_history_list.html.erb b/app/views/organisation_name_changes/_name_history_list.html.erb new file mode 100644 index 000000000..9603b6cb0 --- /dev/null +++ b/app/views/organisation_name_changes/_name_history_list.html.erb @@ -0,0 +1,22 @@ +<%= govuk_details(summary_text: "View name history") do %> + <%= govuk_table do |table| %> + <%= table.with_head do |head| %> + <% head.with_row do |row| %> + <% row.with_cell(header: true, text: "Name") %> + <% row.with_cell(header: true, text: "Start Date") %> + <% row.with_cell(header: true, text: "End Date") %> + <% row.with_cell(header: true, text: "Status") %> + <% end %> + <% end %> + <% @previous_name_changes.each do |change| %> + <%= table.with_body do |body| %> + <% body.with_row do |row| %> + <% row.with_cell(text: change[:name]) %> + <% row.with_cell(text: change[:start_date]&.to_formatted_s(:govuk_date)) %> + <% row.with_cell(text: change[:end_date]&.to_formatted_s(:govuk_date) || "None") %> + <% row.with_cell text: status_tag(change[:status].to_sym) %> + <% end %> + <% end %> + <% end %> + <% end %> +<% end %> diff --git a/app/views/organisation_name_changes/new.html.erb b/app/views/organisation_name_changes/new.html.erb index 5537f0a50..075d70eb4 100644 --- a/app/views/organisation_name_changes/new.html.erb +++ b/app/views/organisation_name_changes/new.html.erb @@ -17,28 +17,7 @@
- <%= govuk_details(summary_text: "View name history") do %> - <%= govuk_table do |table| %> - <%= table.with_head do |head| %> - <% head.with_row do |row| %> - <% row.with_cell(header: true, text: "Name") %> - <% row.with_cell(header: true, text: "Start Date") %> - <% row.with_cell(header: true, text: "End Date") %> - <% row.with_cell(header: true, text: "Status") %> - <% end %> - <% end %> - <% @previous_name_changes.each do |change| %> - <%= table.with_body do |body| %> - <% body.with_row do |row| %> - <% row.with_cell(text: change[:name]) %> - <% row.with_cell(text: change[:start_date]&.to_formatted_s(:govuk_date)) %> - <% row.with_cell(text: change[:end_date]&.to_formatted_s(:govuk_date) || "None") %> - <% row.with_cell text: status_tag(change[:status].to_sym) %> - <% end %> - <% end %> - <% end %> - <% end %> - <% end %> + <%= render partial: "organisation_name_changes/name_history_list" %>