diff --git a/app/components/finder_metadata_summary_card_component.html.erb b/app/components/finder_metadata_summary_card_component.html.erb new file mode 100644 index 000000000..9ba690b5d --- /dev/null +++ b/app/components/finder_metadata_summary_card_component.html.erb @@ -0,0 +1,6 @@ +<%= render "govuk_publishing_components/components/summary_card", { + title: "Finder details", + rows: render_finder_summary_rows, + summary_card_actions: @summary_card_actions, + margin_top: 6, +} %> diff --git a/app/components/finder_metadata_summary_card_component.rb b/app/components/finder_metadata_summary_card_component.rb new file mode 100644 index 000000000..def8bc035 --- /dev/null +++ b/app/components/finder_metadata_summary_card_component.rb @@ -0,0 +1,62 @@ +class FinderMetadataSummaryCardComponent < ViewComponent::Base + def initialize(schema, previous_schema: nil, summary_card_actions: []) + @schema = schema + @previous_schema = previous_schema + @summary_card_actions = summary_card_actions + end + + def render_finder_summary_rows + [ + ({ + key: "Title of the finder", + value: @schema.name + } if @previous_schema.nil? || @schema.name != @previous_schema.name), + ({ + key: "Slug or URL", + value: @schema.base_path + } if @previous_schema.nil? || @schema.base_path != @previous_schema.base_path), + ({ + key: "Organisations the finder should be attached to", + value: (@schema.organisations || []).map { |content_id| helpers.organisation_name(content_id) }.compact.join(",") + } if @previous_schema.nil? || @schema.organisations != @previous_schema.organisations), + ({ + key: "Short description (For search engines)", + value: @schema.description + } if @previous_schema.nil? || @schema.description != @previous_schema.description), + ({ + key: "Summary of the finder (Longer description shown below title)", + value: sanitize("
Link #{index + 1}: #{content_id}
") + end + related_links_content + else + "No" + end + end +end \ No newline at end of file diff --git a/app/views/admin/confirm_metadata.html.erb b/app/views/admin/confirm_metadata.html.erb index 8abd489b0..6ea4be8b8 100644 --- a/app/views/admin/confirm_metadata.html.erb +++ b/app/views/admin/confirm_metadata.html.erb @@ -28,10 +28,7 @@By submitting you are confirming that these changes are required to the specialist finder. diff --git a/app/views/admin/summary.erb b/app/views/admin/summary.erb index c62001c34..afc32f588 100644 --- a/app/views/admin/summary.erb +++ b/app/views/admin/summary.erb @@ -19,8 +19,7 @@