From 07e8710532afc9288dbd406170e0b000670e63e0 Mon Sep 17 00:00:00 2001 From: Anusha Ranganathan <anusha@cottagelabs.com> Date: Sat, 24 Sep 2022 08:54:54 +0100 Subject: [PATCH] Modified metadata display in view --- hyrax/app/assets/stylesheets/rdms.scss | 8 +++ .../crc_datasets/_attribute_rows.html.erb | 49 +++++++++---------- .../crc_datasets/_form_metadata.html.erb | 20 ++++++++ .../hyrax/crc_datasets/_work_description.erb | 29 +++++++++++ hyrax/config/locales/en.yml | 4 ++ 5 files changed, 85 insertions(+), 25 deletions(-) create mode 100644 hyrax/app/views/hyrax/crc_datasets/_form_metadata.html.erb create mode 100644 hyrax/app/views/hyrax/crc_datasets/_work_description.erb diff --git a/hyrax/app/assets/stylesheets/rdms.scss b/hyrax/app/assets/stylesheets/rdms.scss index 29a3a997..1631853a 100644 --- a/hyrax/app/assets/stylesheets/rdms.scss +++ b/hyrax/app/assets/stylesheets/rdms.scss @@ -170,4 +170,12 @@ form .field-wrapper label[required="required"]::after { .sub-collections-wrapper, .works-wrapper { margin-bottom: 10px; +} + +.float-right { + float: right; +} + +.work_description { + text-align: justify; } \ No newline at end of file diff --git a/hyrax/app/views/hyrax/crc_datasets/_attribute_rows.html.erb b/hyrax/app/views/hyrax/crc_datasets/_attribute_rows.html.erb index e4175f8f..17fa130d 100644 --- a/hyrax/app/views/hyrax/crc_datasets/_attribute_rows.html.erb +++ b/hyrax/app/views/hyrax/crc_datasets/_attribute_rows.html.erb @@ -4,39 +4,38 @@ <!-- Description accordion --> <div class="panel panel-default"> <!-- Accordion header --> - <div class="panel-heading" data-toggle="collapse" data-target="#description"> + <div class="panel-heading" data-toggle="collapse" data-target="#metadata"> <h4 class="panel-title edit-work"> - <a class="accordion-toggle">Description</a> - <%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-default' %> + <a class="accordion-toggle">Metadata</a> </h4> </div> <!-- Accordion header --> <!-- Accordion body --> - <div id="description" class="panel-collapse collapse in"> + <div id="metadata" class="panel-collapse collapse in"> <div class="panel-body"> - <%= presenter.attribute_to_html(:doi, label: t('rdms.fields.show.doi'), html_dl: true) %> - <%= presenter.attribute_to_html(:title, label: t('rdms.fields.show.title'), html_dl: true) %> - <%= presenter.attribute_to_html(:alternative_title, label: t('rdms.fields.show.alternative_title'), html_dl: true) %> - <%= presenter.attribute_to_html(:complex_person, render_as: :nested_person, label: t('rdms.fields.show.complex_person'), html_dl: true) %> - <%= presenter.attribute_to_html(:resource_type, render_as: :faceted, html_dl: true) %> - <%= presenter.attribute_to_html(:abstract, render_as: :faceted, html_dl: true) %> - <%= presenter.attribute_to_html(:description, render_as: :faceted, html_dl: true) %> - <%= presenter.attribute_to_html(:crc_resource_type, label: t('rdms.fields.show.crc_resource_type'), render_as: :faceted, html_dl: true) %> - <%= presenter.attribute_to_html(:date_created, render_as: :linked, search_field: 'date_created_tesim', html_dl: true) %> - <%= presenter.attribute_to_html(:date_modified, label: t('hyrax.base.show.last_modified'), html_dl: true) %> - <%= presenter.attribute_to_html(:complex_date, render_as: :nested_date, label: t('rdms.fields.show.complex_date'), html_dl: true) %> - <%= presenter.attribute_to_html(:complex_identifier, render_as: :nested_identifier, label: t('rdms.fields.show.complex_identifier'), html_dl: true) %> - <%= presenter.attribute_to_html(:modality, label: t('rdms.fields.show.modality'), html_dl: true) %> - <%= presenter.attribute_to_html(:complex_subject, render_as: :nested_subject, label: t('rdms.fields.show.complex_subject'), html_dl: true) %> - <%= presenter.attribute_to_html(:approval_number, label: t('rdms.fields.show.approval_number'), html_dl: true) %> - <%= presenter.attribute_to_html(:keyword, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:complex_person, render_as: :nested_person, label: t('rdms.fields.complex_person'), html_dl: true) %> + <%= presenter.attribute_to_html(:coverage, label: t('rdms.fields.coverage'), render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:crc_resource_type, label: t('rdms.fields.crc_resource_type'), render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:modality, label: t('rdms.fields.modality'), html_dl: true) %> + <%= presenter.attribute_to_html(:complex_subject, render_as: :nested_subject, label: t('rdms.fields.complex_subject'), html_dl: true) %> + <%= presenter.attribute_to_html(:approval_number, label: t('rdms.fields.approval_number'), html_dl: true) %> + <%= presenter.attribute_to_html(:complex_identifier, render_as: :nested_identifier, label: t('rdms.fields.complex_identifier'), html_dl: true) %> + <%= presenter.attribute_to_html(:complex_date, render_as: :nested_date, label: t('rdms.fields.complex_date'), html_dl: true) %> <%= presenter.attribute_to_html(:subject, render_as: :faceted, html_dl: true) %> <%= presenter.attribute_to_html(:publisher, render_as: :faceted, html_dl: true) %> <%= presenter.attribute_to_html(:language, render_as: :faceted, html_dl: true) %> - <%= presenter.attribute_to_html(:coverage, label: t('rdms.fields.show.coverage'), render_as: :faceted, html_dl: true) %> - <%= presenter.attribute_to_html(:complex_funding_reference, render_as: :nested_funding_reference, label: t('rdms.fields.show.complex_funding_reference'), html_dl: true) %> - <%= presenter.attribute_to_html(:complex_relation, render_as: :nested_relation, label: t('rdms.fields.show.complex_relation'), html_dl: true) %> - <%= presenter.attribute_to_html(:software_version, label: t('rdms.fields.show.software_version'), html_dl: true) %> - <%= presenter.attribute_to_html(:extra_information, label: t('rdms.fields.show.extra_information'), html_dl: true) %> + <%= presenter.attribute_to_html(:complex_funding_reference, render_as: :nested_funding_reference, label: t('rdms.fields.complex_funding_reference'), html_dl: true) %> + <%= presenter.attribute_to_html(:extra_information, label: t('rdms.fields.extra_information'), html_dl: true) %> + <%= presenter.attribute_to_html(:date_created, render_as: :linked, search_field: 'date_created_tesim', html_dl: true) %> + <%= presenter.attribute_to_html(:date_modified, label: t('hyrax.base.last_modified'), html_dl: true) %> + <%= presenter.attribute_to_html(:alternative_title, label: t('rdms.fields.alternative_title'), html_dl: true) %> + <%= presenter.attribute_to_html(:abstract, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:description, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:keyword, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:resource_type, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:doi, label: t('rdms.fields.doi'), html_dl: true) %> + <%= presenter.attribute_to_html(:complex_relation, render_as: :nested_relation, label: t('rdms.fields.complex_relation'), html_dl: true) %> + <%= presenter.attribute_to_html(:software_version, label: t('rdms.fields.software_version'), html_dl: true) %> + </div> <!-- panel body --> </div> <!-- Accordion body --> </div> <!-- Description accordion --> diff --git a/hyrax/app/views/hyrax/crc_datasets/_form_metadata.html.erb b/hyrax/app/views/hyrax/crc_datasets/_form_metadata.html.erb new file mode 100644 index 00000000..5bf41c71 --- /dev/null +++ b/hyrax/app/views/hyrax/crc_datasets/_form_metadata.html.erb @@ -0,0 +1,20 @@ + <div class="base-terms"> + <% f.object.primary_terms.each do |term| %> + <%= render_edit_field_partial(term, f: f) %> + <% end %> + </div> + <% if f.object.display_additional_fields? %> + <%= link_to t('hyrax.works.form.additional_fields'), + '#extended-terms', + class: 'btn btn-default additional-fields', + data: { toggle: 'collapse' }, + role: "button", + 'aria-expanded'=> "false", + 'aria-controls'=> "extended-terms" %> + <div id="extended-terms" class='collapse'> + <% f.object.secondary_terms.each do |term| %> + <%= render_edit_field_partial(term, f: f) %> + <% end %> + <%= render 'form_media', f: f %> + </div> + <% end %> diff --git a/hyrax/app/views/hyrax/crc_datasets/_work_description.erb b/hyrax/app/views/hyrax/crc_datasets/_work_description.erb new file mode 100644 index 00000000..0b2f7372 --- /dev/null +++ b/hyrax/app/views/hyrax/crc_datasets/_work_description.erb @@ -0,0 +1,29 @@ +<% titles = [] %> +<div class="float-right"> + <%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-default' %> +</div><br/> +<% if presenter.title.present? %> + <% presenter.title.each do |title| %> + <h2 class="work_title"> + <%= presenter.crc_work_type.first.capitalize %>: <%= title %> + </h2> + <% titles.append(title) %> + <% end %> +<% end %> +<% if presenter.experiment_title.present? %> + <% presenter.experiment_title.each do |title| %> + <% unless titles.include? title %> + <h2 class="work_title"><%= title %></h2> + <% end %> + <% end %> +<% end %> +<% if presenter.experiment_description.present? %> + <% presenter.experiment_description.each do |description| %> + <p class="work_description"><%= iconify_auto_link(description) %></p> + <% end %> +<% end %> +<% if presenter.description.present? %> + <% presenter.description.each do |description| %> + <p class="work_description"><%= iconify_auto_link(description) %></p> + <% end %> +<% end %> diff --git a/hyrax/config/locales/en.yml b/hyrax/config/locales/en.yml index ae4051ff..c72b60a9 100644 --- a/hyrax/config/locales/en.yml +++ b/hyrax/config/locales/en.yml @@ -45,7 +45,11 @@ en: complex_subject_type: "Subject type" complex_subject_sex: "Subject sex" complex_subject_age: "Subject age" + coverage: "Coverage" + crc_resource_type: "CRC Resource type" doi: "DOI" + experiment_title: "Experiment title" + experiment_description: "Experiment description" extra_information: "Extra information" first_name: "Given name" full_name: "Full name" -- GitLab