diff --git a/.env.template b/.env.template index a42bab38691c00c9633ccdb36afcd2f59c8df67a..8ffbb680f60866e0c74b2e648e4525db00750362 100644 --- a/.env.template +++ b/.env.template @@ -90,6 +90,7 @@ IIIF_TO_SERVE_SSL_URLS=false CRC_FOLDER_IMPORT_PATH=/mnt/rdms_data/RUB/testData # Browse Everything credentials +USE_BROWSE_EVERYTHING=false GOOGLE_DRIVE_CLIENT_ID= GOOGLE_DRIVE_CLIENT_SECRET= BOX_CLIENT_ID= diff --git a/.env.template.development b/.env.template.development index 0623948b58b1a2a02d5de2584d31ae7df82a6a86..42811d4497eb8a32005627bee8aea4824c3d1b43 100644 --- a/.env.template.development +++ b/.env.template.development @@ -93,6 +93,7 @@ IIIF_TO_SERVE_SSL_URLS=false CRC_FOLDER_IMPORT_PATH=/mnt/rdms_data/RUB/testData # Browse Everything credentials +USE_BROWSE_EVERYTHING=false GOOGLE_DRIVE_CLIENT_ID= GOOGLE_DRIVE_CLIENT_SECRET= BOX_CLIENT_ID= diff --git a/hyrax/app/assets/stylesheets/rdms.scss b/hyrax/app/assets/stylesheets/rdms.scss index cc8a6c5f138f35096adc8b643b8870fd60afc60e..b92c592a42cdbdde6f30411c0406927e7fb05415 100644 --- a/hyrax/app/assets/stylesheets/rdms.scss +++ b/hyrax/app/assets/stylesheets/rdms.scss @@ -223,4 +223,9 @@ form .field-wrapper label[required="required"]::after { padding-left: 0px; margin-bottom: 0; } +} + +.controlled_vocabulary .listing .input-group { + width: 90%; + border-radius: 4px; } \ No newline at end of file diff --git a/hyrax/app/forms/hyrax/dataset_form.rb b/hyrax/app/forms/hyrax/dataset_form.rb index 57ff4b298e3b3708a756a7d5a95762d84a2d123d..0474d2ac64bba104a70bbe6f2b8202c11c247418 100644 --- a/hyrax/app/forms/hyrax/dataset_form.rb +++ b/hyrax/app/forms/hyrax/dataset_form.rb @@ -31,15 +31,17 @@ module Hyrax :license, :abstract, :description, - :dataset_method, - :series_information, - :table_of_contents, - :technical_information, + # issue #21 - remove the following fields from form + # :dataset_method, + # :series_information, + # :table_of_contents, + # :technical_information, :based_near, :complex_funding_reference, :complex_identifier, - :publisher, - :doi, + # Issue 23 - remove publisher, DOI (and publication year) + # :publisher, + # :doi, ] self.required_fields -= [ @@ -54,6 +56,38 @@ module Hyrax :title, :complex_person, :abstract, :keyword, :license ] + def tabs + %w[required description references funding dataset_thumbnail files relationships] + end + + def description_tab_terms + # Date, Subject, Language, Location, Version, Resource Type + [ + :alternative_title, + :description, + :complex_date, + :subject, + :language, + :based_near, + :software_version, + :resource_type, + ] + end + + def references_tab_terms + [ + # Related Items, ID + :complex_relation, + :complex_identifier, + ] + end + + def funding_tab_terms + [ + :complex_funding_reference, + ] + end + protected def self.permitted_date_params diff --git a/hyrax/app/inputs/nested_person_input.rb b/hyrax/app/inputs/nested_person_input.rb index 156e1a435bda94fb31f6e20f94834e2ab5e0b35b..f554192c7d244df8f914ed965cc89048e7c9a0e1 100644 --- a/hyrax/app/inputs/nested_person_input.rb +++ b/hyrax/app/inputs/nested_person_input.rb @@ -17,20 +17,37 @@ protected parent_attribute = name_for(attribute_name, index, '', parent)[0..-5] - # --- name - field = :name + # --- first_name + field = :first_name field_name = name_for(attribute_name, index, field, parent) field_id = id_for(attribute_name, index, field, parent) field_value = value.send(field).first out << "<div class='row'>" out << " <div class='col-md-3'>" - out << template.label_tag(field_name, I18n.t('rdms.fields.full_name'), required: required) + out << template.label_tag(field_name, I18n.t('rdms.fields.first_name'), required: required) out << ' </div>' out << " <div class='col-md-9'>" out << @builder.text_field(field_name, - options.merge(value: field_value, name: field_name, id: field_id, required: required, placeholder: "SURNAME, Given Names")) + options.merge(value: field_value, name: field_name, id: field_id, required: required, placeholder: "Alphabets")) + out << ' </div>' + out << '</div>' # row + + # --- last_name + field = :last_name + field_name = name_for(attribute_name, index, field, parent) + field_id = id_for(attribute_name, index, field, parent) + field_value = value.send(field).first + + out << "<div class='row'>" + out << " <div class='col-md-3'>" + out << template.label_tag(field_name, I18n.t('rdms.fields.last_name'), required: required) + out << ' </div>' + + out << " <div class='col-md-9'>" + out << @builder.text_field(field_name, + options.merge(value: field_value, name: field_name, id: field_id, required: required, placeholder: "Alphabets")) out << ' </div>' out << '</div>' # row diff --git a/hyrax/app/presenters/hyrax/dataset_presenter.rb b/hyrax/app/presenters/hyrax/dataset_presenter.rb index 43ab9e6c855079aea8a16e65bd794a548c45cadc..f3e4255ca73f2ac4e34eee43412572c8ef005e01 100644 --- a/hyrax/app/presenters/hyrax/dataset_presenter.rb +++ b/hyrax/app/presenters/hyrax/dataset_presenter.rb @@ -3,7 +3,7 @@ module Hyrax class DatasetPresenter < Hyrax::WorkShowPresenter delegate :complex_person, :complex_date, :complex_relation, :software_version, :dataset_method, :series_information, - :table_of_contents, :technical_information, :complex_funding_reference, :complex_identifier, :doi, + :table_of_contents, :technical_information, :based_near_label, :complex_funding_reference, :complex_identifier, :doi, to: :solr_document end end diff --git a/hyrax/app/views/hyrax/datasets/_attribute_rows.html.erb b/hyrax/app/views/hyrax/datasets/_attribute_rows.html.erb index e0fef08600bafc2574cb1000e1c7e401734ecceb..9a22bf8c2e99ea36ec7d9f9cd70a8182b0f6f611 100644 --- a/hyrax/app/views/hyrax/datasets/_attribute_rows.html.erb +++ b/hyrax/app/views/hyrax/datasets/_attribute_rows.html.erb @@ -12,26 +12,31 @@ <!-- Accordion body --> <div id="description" class="panel-collapse collapse in"> <div class="panel-body"> + <!-- required terms --> <%= presenter.attribute_to_html(:title, label: t('Title'), html_dl: true) %> - <%= presenter.attribute_to_html(:alternative_title, label: t('rdms.fields.alternative_title'), 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(:resource_type, render_as: :faceted, html_dl: true) %> - <%= presenter.attribute_to_html(:subject, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:abstract, html_dl: true) %> <%= presenter.attribute_to_html(:keyword, render_as: :faceted, 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(:language, render_as: :faceted, 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, html_dl: true) %> <%= presenter.attribute_to_html(:license, render_as: :faceted, html_dl: true) %> - <%= presenter.attribute_to_html(:abstract, html_dl: true) %> + <!-- description terms --> + <%= presenter.attribute_to_html(:alternative_title, label: t('rdms.fields.alternative_title'), html_dl: true) %> <%= presenter.attribute_to_html(:description, 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(:dataset_method, html_dl: true) %> <%= presenter.attribute_to_html(:series_information, html_dl: true) %> <%= presenter.attribute_to_html(:table_of_contents, html_dl: true) %> <%= presenter.attribute_to_html(:technical_information, html_dl: true) %> - <%= presenter.attribute_to_html(:based_near, 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(:subject, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:language, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:based_near_label, render_as: :faceted, html_dl: true) %> + <%= presenter.attribute_to_html(:software_version, html_dl: true) %> + <%= presenter.attribute_to_html(:resource_type, render_as: :faceted, html_dl: true) %> + <!-- references terms --> + <%= presenter.attribute_to_html(:complex_relation, render_as: :nested_relation, label: t('rdms.fields.complex_relation'), html_dl: true) %> <%= presenter.attribute_to_html(:complex_identifier, render_as: :nested_identifier, label: t('rdms.fields.complex_identifier'), html_dl: true) %> + <!-- funding terms --> + <%= presenter.attribute_to_html(:complex_funding_reference, render_as: :nested_funding_reference, label: t('rdms.fields.complex_funding_reference'), html_dl: true) %> + <!-- published terms --> <%= presenter.attribute_to_html(:publisher, render_as: :faceted, html_dl: true) %> <%= presenter.attribute_to_html(:doi, label: 'DOI', html_dl: true) %> <%= presenter.attribute_to_html(:date_created, render_as: :linked, search_field: 'date_created_tesim', html_dl: true) %> diff --git a/hyrax/app/views/hyrax/datasets/_form.html.erb b/hyrax/app/views/hyrax/datasets/_form.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..4d0f5080fea782a9b52f60aad1b05e8e86803b99 --- /dev/null +++ b/hyrax/app/views/hyrax/datasets/_form.html.erb @@ -0,0 +1,36 @@ +<%= simple_form_for [main_app, @form], + html: { + data: { behavior: 'work-form', + 'param-key' => @form.model_name.param_key }, + multipart: true + } do |f| %> + <% if f.object.errors.any? %> + <div class="alert alert-danger alert-dismissable" role="alert"> + <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> + <%= f.object.errors.full_messages_for(:base).send(SimpleForm.error_method) %> + <%= render 'form_in_works_error', f: f %> + <%= render 'form_ordered_members_error', f: f %> + <%= render 'form_collections_error', f: f %> + <%= render 'form_visibility_error', f: f %> + </div> + <% end %> + <% if Flipflop.batch_upload? && f.object.new_record? %> + <% provide :metadata_tab do %> + <p class="switch-upload-type"><%= t('.batch_upload_hint') %> <%= link_to t('.batch_link'), hyrax.new_batch_upload_path(payload_concern: @form.model.class) %></p> + <% end %> + <% end %> + <% if f.object.persisted? && f.object.member_ids.present? %> + <% tabs_to_display = f.object.tabs %> + <% else %> + <% tabs_to_display = f.object.tabs - ['dataset_thumbnail'] %> + <% end %> + <%= render 'hyrax/base/guts4form', f: f, tabs: tabs_to_display %> +<% end %> + +<script type="text/javascript"> + Blacklight.onLoad(function() { + <%# This causes the page to switch back to the default template if they've + previously visited the batch download page in this Turbolinks session %> + $("#fileupload").fileupload('option', 'downloadTemplateId', 'template-download') + }); +</script> diff --git a/hyrax/app/views/hyrax/datasets/_form_dataset_thumbnail.html.erb b/hyrax/app/views/hyrax/datasets/_form_dataset_thumbnail.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..a17baedb6e2e43eca8d9c2e772f5c8f283094a02 --- /dev/null +++ b/hyrax/app/views/hyrax/datasets/_form_dataset_thumbnail.html.erb @@ -0,0 +1,3 @@ +<div class="base-terms thumbnail-terms"> + <%= render 'form_media', f: f %> +</div> diff --git a/hyrax/app/views/hyrax/datasets/_form_description.html.erb b/hyrax/app/views/hyrax/datasets/_form_description.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..5bafce222c5fd50ae5d152cceebcaf06369b0a64 --- /dev/null +++ b/hyrax/app/views/hyrax/datasets/_form_description.html.erb @@ -0,0 +1,5 @@ +<div class="base-terms description-terms"> + <% f.object.description_tab_terms.each do |term| %> + <%= render_edit_field_partial(term, f: f) %> + <% end %> +</div> diff --git a/hyrax/app/views/hyrax/datasets/_form_funding.html.erb b/hyrax/app/views/hyrax/datasets/_form_funding.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..48b28aa2306eaf9f4290dc860ac4226e93e6a159 --- /dev/null +++ b/hyrax/app/views/hyrax/datasets/_form_funding.html.erb @@ -0,0 +1,5 @@ +<div class="base-terms funding-terms"> + <% f.object.funding_tab_terms.each do |term| %> + <%= render_edit_field_partial(term, f: f) %> + <% end %> +</div> diff --git a/hyrax/app/views/hyrax/datasets/_form_references.html.erb b/hyrax/app/views/hyrax/datasets/_form_references.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..a24adb6633999106b80c346c7936062b9c901ef8 --- /dev/null +++ b/hyrax/app/views/hyrax/datasets/_form_references.html.erb @@ -0,0 +1,5 @@ +<div class="base-terms references-terms"> + <% f.object.references_tab_terms.each do |term| %> + <%= render_edit_field_partial(term, f: f) %> + <% end %> +</div> diff --git a/hyrax/app/views/hyrax/datasets/_form_required.html.erb b/hyrax/app/views/hyrax/datasets/_form_required.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1c7d6ade1e78d4ff2be2b105df793e068cc47ed8 --- /dev/null +++ b/hyrax/app/views/hyrax/datasets/_form_required.html.erb @@ -0,0 +1,6 @@ +<div class="base-terms"> + <% f.object.primary_terms.each do |term| %> + <%= render_edit_field_partial(term, f: f) %> + <% end %> +</div> + diff --git a/hyrax/config/initializers/hyrax.rb b/hyrax/config/initializers/hyrax.rb index 6429b942cc7f4a474852b8f19740d27964e334fe..de35f0789c44c4f66c851a9a32684e6c0b2b8087 100644 --- a/hyrax/config/initializers/hyrax.rb +++ b/hyrax/config/initializers/hyrax.rb @@ -100,7 +100,7 @@ Hyrax.config do |config| # Location autocomplete uses geonames to search for named regions # Username for connecting to geonames - # config.geonames_username = '' + config.geonames_username = ENV['GEONAMES'] || '' # Should the acceptance of the licence agreement be active (checkbox), or # implied when the save button is pressed? Set to true for active @@ -276,10 +276,11 @@ Hyrax.config do |config| # If browse-everything has been configured, load the configs. Otherwise, set to nil. begin - if defined? BrowseEverything + if defined? BrowseEverything and ENV.fetch('USE_BROWSE_EVERYTHING', 'false') == 'true' config.browse_everything = BrowseEverything.config else - Rails.logger.warn "BrowseEverything is not installed" + config.browse_everything = nil + Rails.logger.warn "BrowseEverything is not installed or configured" end rescue Errno::ENOENT config.browse_everything = nil diff --git a/hyrax/config/locales/dataset.en.yml b/hyrax/config/locales/dataset.en.yml index f0b9492dc34d4009c36edada7a5587df7a54c2d1..9f8c528d19f22fdb3f75afadf56bec0ace4c0462 100644 --- a/hyrax/config/locales/dataset.en.yml +++ b/hyrax/config/locales/dataset.en.yml @@ -6,6 +6,16 @@ en: dataset: description: "Dataset works" name: "Dataset" + works: + form: + tab: + required: "Required" + description: "Description" + references: "References" + funding: "Funding" + dataset_thumbnail: "Thumbnail" + files: "Files" + relationships: "Relationships" simple_form: labels: dataset: @@ -16,3 +26,6 @@ en: complex_relation: "Related items" complex_subject: "Subject" dataset_method: "Method" + hints: + defaults: + description: Free-text notes about the dataset. diff --git a/hyrax/config/locales/en.yml b/hyrax/config/locales/en.yml index 95d15d21d29487a1a296958915261b1e3142bd5a..69723792d79959043e267cbe01eaf1fbce233376 100644 --- a/hyrax/config/locales/en.yml +++ b/hyrax/config/locales/en.yml @@ -62,7 +62,7 @@ en: hints: defaults: title: The title of your work. - abstract: Abstract or a free-text description for the work. + abstract: Abstract, method, table of contents, technical information or a free-text description for the dataset. alternative_title: Alternative title or the title in another language, if applicable. keyword: '<strong>Note:</strong> To enter multiple keywords, click on "Add another Keyword." Do not list them in a single field.' license: License for your work.