Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1407 add "Extended Metadata" to other resources in SEEK #1663

Merged
merged 18 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def collection_params
params.require(:collection).permit(:title, :description, { project_ids: [] }, :license, *creator_related_params,
{ special_auth_codes_attributes: [:code, :expiration_date, :id, :_destroy] },
{ publication_ids: [] },
{ extended_metadata_attributes: determine_extended_metadata_keys },
{ items_attributes: [:id, :asset_type, :asset_id, :order, :comment, :_destroy]})
end

Expand Down
1 change: 1 addition & 0 deletions app/controllers/data_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ def data_file_params
:file_template_id,
{ data_format_annotations: [] }, { data_type_annotations: [] },
{ publication_ids: [] }, { workflow_ids: [] },
{ extended_metadata_attributes: determine_extended_metadata_keys },
{ workflow_data_files_attributes:[:id, :workflow_id, :workflow_data_file_relationship_id, :_destroy] },
discussion_links_attributes:[:id, :url, :label, :_destroy])
end
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def document_params
{ special_auth_codes_attributes: [:code, :expiration_date, :id, :_destroy] },
{ assay_assets_attributes: [:assay_id] },
{ publication_ids: [] }, { event_ids: [] }, { workflow_ids: [] },
discussion_links_attributes:[:id, :url, :label, :_destroy])
{ extended_metadata_attributes: determine_extended_metadata_keys },
discussion_links_attributes:[:id, :url, :label, :_destroy])
end

alias_method :asset_params, :document_params
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ def event_params
params.require(:event).permit(:title, :description, :start_date, :end_date, :url, :address, :city, :country, :time_zone,
{ project_ids: [] }, { publication_ids: [] }, { presentation_ids: [] },
{ special_auth_codes_attributes: [:code, :expiration_date, :id, :_destroy] },
{ data_file_ids: [] },{document_ids: []}, { publication_ids: [] })
{ data_file_ids: [] },{document_ids: []}, { publication_ids: [] }, { extended_metadata_attributes: determine_extended_metadata_keys } )
end
end
1 change: 1 addition & 0 deletions app/controllers/models_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def model_params
*creator_related_params,
{ special_auth_codes_attributes: [:code, :expiration_date, :id, :_destroy] },
{ assay_assets_attributes: [:assay_id] }, { publication_ids: [] },
{ extended_metadata_attributes: determine_extended_metadata_keys },
discussion_links_attributes:[:id, :url, :label, :_destroy])
end

Expand Down
1 change: 1 addition & 0 deletions app/controllers/presentations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def presentation_params
{ event_ids: [] }, { project_ids: [] },
{ special_auth_codes_attributes: [:code, :expiration_date, :id, :_destroy] },
{ publication_ids: [] }, { workflow_ids: [] },
{ extended_metadata_attributes: determine_extended_metadata_keys },
discussion_links_attributes:[:id, :url, :label, :_destroy])
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def project_params
permitted_params = [:title, :web_page, :wiki_page, :description, { organism_ids: [] }, :parent_id, :start_date,
:end_date,
{ funding_codes: [] }, { human_disease_ids: [] }, topic_annotations: [],
discussion_links_attributes:[:id, :url, :label, :_destroy]]
discussion_links_attributes:[:id, :url, :label, :_destroy], extended_metadata_attributes: determine_extended_metadata_keys ]

if User.admin_logged_in?
permitted_params += [:site_root_uri, :site_username, :site_password, :nels_enabled]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/sops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def sop_params
{ special_auth_codes_attributes: [:code, :expiration_date, :id, :_destroy] },
{ assay_assets_attributes: [:assay_id] },
{ publication_ids: [] }, {workflow_ids: []},
{ extended_metadata_attributes: determine_extended_metadata_keys },
discussion_links_attributes:[:id, :url, :label, :_destroy])
end

Expand Down
1 change: 1 addition & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Event < ApplicationRecord
acts_as_authorized
acts_as_uniquely_identifiable
acts_as_favouritable
has_extended_metadata

# load the configuration for the pagination
grouped_pagination
Expand Down
1 change: 1 addition & 0 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Project < ApplicationRecord

acts_as_yellow_pages
title_trimmer
has_extended_metadata

has_and_belongs_to_many :investigations
has_many :studies, through: :investigations
Expand Down
3 changes: 3 additions & 0 deletions app/views/collections/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<%= f.text_area :description, :class=>"form-control rich-text-edit", :rows => 5 -%>
</div>

<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => f,:resource => @collection } %>
whomingbird marked this conversation as resolved.
Show resolved Hide resolved
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => f, :resource => @collection } %>

<%= panel('Items') do %>
<p class="help-block">Items can be re-arranged by clicking and dragging the button on the left-hand side of each row.</p>
<table class="table" id="items-table">
Expand Down
5 changes: 5 additions & 0 deletions app/views/collections/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<%= text_area_tag 'collection[description]', collection_description_value, :class=>"form-control rich-text-edit" -%>
</div>

<%= fields_for(@collection) do |collection_fields| %>
<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => collection_fields,:resource => @collection } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => collection_fields, :resource => @collection } %>
<% end %>

whomingbird marked this conversation as resolved.
Show resolved Hide resolved
<%= render :partial => "projects/project_selector", :locals => { :resource => @collection } %>

<%= render :partial => 'assets/license_selector', :locals => { :resource => @collection } %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/collections/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
</div>
</div>

<%= render partial: 'extended_metadata/extended_metadata_attribute_values', locals: { resource: @collection } %>

<div class="row">
<div class="col-md-12">
<%= panel('Items') do %>
Expand Down
5 changes: 4 additions & 1 deletion app/views/data_files/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<%= f.text_area :description, :class=>"form-control rich-text-edit", :rows => 5 -%>
</div>

<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f=> f,:resource => @data_file } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f=> f, :resource => @data_file } %>

whomingbird marked this conversation as resolved.
Show resolved Hide resolved
<div class="form-group">
<div class='help-block'>Check this box if this data is the result of a model simulation</div>
<label>
Expand All @@ -29,7 +32,7 @@
:templates => authorised_assets(FileTemplate, nil, 'edit') } %>
<% end %>

<%= render partial: 'assets/controlled_vocab_annotations_form_properties', :locals => { :resource => (@data_file ? @data_file : DataFile.new) } -%>
<%= render :partial => 'assets/controlled_vocab_annotations_form_properties', :locals => { :resource => (@data_file ? @data_file : DataFile.new) } -%>
whomingbird marked this conversation as resolved.
Show resolved Hide resolved

<%= render :partial => 'assets/license_selector', :locals => { :resource => @data_file } %>

Expand Down
4 changes: 4 additions & 0 deletions app/views/data_files/multi-steps/_basic_metadata.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<label>Description</label>
<%= f.text_area :description, :class => 'form-control rich-text-edit', :rows => 5 -%>
</div>

<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => f,:resource => @data_file } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => f, :resource => @data_file } %>

<div class='form-group'>
<div class='help-block'>Check this box if this data is the result of a model simulation</div>
<label>
Expand Down
4 changes: 3 additions & 1 deletion app/views/data_files/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

<%= render :partial => "assets/asset_doi", :locals => {:displayed_resource=>@display_data_file} %>

<%= render partial: 'nels/data_sheet', locals: { displayed_resource: @display_data_file } if @data_file.nels? %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_values', :locals => {:resource => @data_file} %>

<%= render :partial => 'nels/data_sheet', locals: { displayed_resource: @display_data_file } if @data_file.nels? %>
</div>
</div>
<%= render :partial=>"general/isa_graph", :locals => {:root_item => @data_file, :deep => true, :include_parents => true} %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/documents/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<%= f.text_area :description, :class=>"form-control rich-text-edit", :rows => 5 -%>
</div>

<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => f,:resource => @document } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => f, :resource => @document } %>

<%= render :partial => 'assets/license_selector', :locals => { :resource => @document } %>

<%= render :partial=> "assets/discussion_links_form", :locals=>{:resource => @document} -%>
Expand Down
6 changes: 6 additions & 0 deletions app/views/documents/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
<%= text_area_tag 'document[description]', document_description_value, :class=>"form-control rich-text-edit" -%>
</div>

<%= fields_for(@document) do |document_fields| %>
<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => document_fields,:resource => @document } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => document_fields, :resource => @document } %>
<% end %>


<%= render :partial => "projects/project_selector", :locals => { :resource => @document } %>

<%= render :partial => 'assets/license_selector', :locals => { :resource => @document } %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/documents/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<%= render :partial => "assets/asset_doi", :locals => {:displayed_resource=>@display_document} %>
</div>
</div>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_values', :locals => {:resource => @document} %>

<%= render :partial=>"general/isa_graph", :locals => {:root_item => @document, :deep => true, :include_parents => true} %>
</div>

Expand Down
5 changes: 5 additions & 0 deletions app/views/events/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
<%= f.country_select :country, { include_blank: 'Please select...' }, class: 'form-control' -%>
</div>

<div class="form-group">
<%= render partial: 'extended_metadata/extended_metadata_type_selection', locals: { f: f, resource: @event } %>
<%= render partial: 'extended_metadata/extended_metadata_attribute_input', locals: { f: f, resource: @event } %>
</div>

<% if show_form_manage_specific_attributes? && @event.can_manage? %>
<%= render :partial => "projects/project_selector", locals: {resource: @event } -%>
<% end %>
Expand Down
4 changes: 4 additions & 0 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
</p>
</div>
</div>


<%= render :partial => 'extended_metadata/extended_metadata_attribute_values', :locals => {:resource => @event} %>
whomingbird marked this conversation as resolved.
Show resolved Hide resolved

<%= render :partial=>"general/isa_graph", :locals => {:root_item => @event, :deep => true, :include_parents => true} %>

<%= render :partial => "assets/special_auth_code_display", :locals => {:resource => @event}%>
Expand Down
3 changes: 3 additions & 0 deletions app/views/models/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<%= f.text_area :description, :class=>"form-control rich-text-edit", :rows => 5 -%>
</div>

<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f=> f,:resource => @model } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f=> f, :resource => @model } %>

whomingbird marked this conversation as resolved.
Show resolved Hide resolved
<%= render :partial => 'assets/license_selector', :locals => { :resource => @model } %>

<%= render :partial=> "assets/discussion_links_form", :locals=>{:resource => @model} -%>
Expand Down
5 changes: 5 additions & 0 deletions app/views/models/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<%= text_area_tag 'model[description]', model_description_value, :class=>"form-control rich-text-edit" -%>
</div>

<%= fields_for(@model) do |model_fields| %>
<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f=> model_fields,:resource => @model } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f=> model_fields, :resource => @model } %>
<% end %>

whomingbird marked this conversation as resolved.
Show resolved Hide resolved
<%= render partial: "projects/project_selector", locals: { resource: @model } -%>

<%= render partial: 'assets/license_selector', locals: { resource: @model } %>
Expand Down
1 change: 1 addition & 0 deletions app/views/models/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<%= render :partial => "model_visualisation" -%>

<%= render :partial => "import_details", :object => @display_model %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_values', :locals => {:resource => @model} %>

<%= render :partial => "general/isa_graph", :locals => { :root_item => @model, :deep => true, :include_parents => true } %>
</div>
Expand Down
3 changes: 3 additions & 0 deletions app/views/presentations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<%= f.text_area :description, :class=>"form-control rich-text-edit", :rows => 5 -%>
</div>

<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => f,:resource => @presentation } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => f, :resource => @presentation } %>s

<%# only the owner should get to see this option (ability to reload defaults remain in 'edit' action, but project selector is disabled) -%>
<% if @presentation.can_manage? -%>
<%= render :partial => "projects/project_selector", :locals => { :resource => @presentation } -%>
Expand Down
5 changes: 5 additions & 0 deletions app/views/presentations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<%= text_area_tag "presentation[description]", presentation_description_value,:class=>"form-control rich-text-edit" -%>
</div>

<%= fields_for(@presentation) do |presentation_fields| %>
<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => presentation_fields,:resource => @presentation } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => presentation_fields, :resource => @presentation } %>
<% end %>

<%= render :partial => "projects/project_selector", :locals => { :resource => @presentation } -%>

<%= render :partial => 'assets/license_selector', :locals => { :resource => @presentation } %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/presentations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

<%= rendered_asset_view(@display_presentation) %>

<%= render partial: 'extended_metadata/extended_metadata_attribute_values', locals: { resource: @presentation } %>

<%= render :partial => "general/isa_graph", :locals => { :root_item => @presentation, :deep => true, :include_parents => true } %>
</div>

Expand Down
4 changes: 4 additions & 0 deletions app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<%= f.text_area :description, :rows => 5, :class=>"form-control rich-text-edit" -%>
</div>

<%= render partial: 'extended_metadata/extended_metadata_type_selection', locals: {f: f, resource: @project } %>
<%= render partial: 'extended_metadata/extended_metadata_attribute_input', locals: {f: f, resource: @project } %>


<%= render partial: 'assets/controlled_vocab_annotations_form_properties', locals: { resource: @project } %>

<div class="form-group">
Expand Down
4 changes: 4 additions & 0 deletions app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
</div>
</div>

<div class="form-group">
<%= render :partial => 'extended_metadata/extended_metadata_attribute_values', :locals => {:resource => @project} %>
</div>

</div>

<div class="col-md-3 col-sm-4">
Expand Down
5 changes: 4 additions & 1 deletion app/views/sops/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
<%= f.text_area :description, :class=>"form-control rich-text-edit", :rows => 5 -%>
</div>

<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => f,:resource => @sop } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => f, :resource => @sop } %>s

<%= render :partial => 'assets/license_selector', :locals => { :resource => @sop } %>

<%= render :partial=> "assets/discussion_links_form", :locals=>{:resource => @sop} -%>
<%= render :partial=> "assets/discussion_links_form", :locals=>{ :resource => @sop} -%>

<%= render :partial=>"assets/asset_form_bottom", :locals=> {:show_publications=>false, :f => f}-%>

Expand Down
5 changes: 5 additions & 0 deletions app/views/sops/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<%= text_area_tag 'sop[description]', sop_description_value, :class=>"form-control rich-text-edit" -%>
</div>

<%= fields_for(@sop) do |sop_fields| %>
<%= render :partial => 'extended_metadata/extended_metadata_type_selection', :locals => {:f => sop_fields,:resource => @sop } %>
<%= render :partial => 'extended_metadata/extended_metadata_attribute_input', :locals => {:f => sop_fields, :resource => @sop } %>
<% end %>

<%= render :partial => "projects/project_selector", :locals => { :resource => @sop } %>

<%= render :partial => 'assets/license_selector', :locals => { :resource => @sop } %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/sops/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<%= render :partial => "assets/asset_doi", :locals => {:displayed_resource=>@display_sop} %>
</div>
</div>

<%= render partial: 'extended_metadata/extended_metadata_attribute_values', locals: { resource: @sop } %>

<%= render :partial=>"general/isa_graph", :locals => {:root_item => @sop, :deep => true, :include_parents => true} %>
</div>

Expand Down
1 change: 1 addition & 0 deletions lib/seek/acts_as_asset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def acts_as_asset
acts_as_discussable
grouped_pagination
title_trimmer
has_extended_metadata

attr_writer :original_filename, :content_type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ def test_value(value)
raise 'Not an integer' unless Integer(value.to_f) # the to_f is to allow "1.0" type numbers
raise 'Not an integer' unless (Float(value) % 1).zero?
end

def convert(value)
int_value = Integer(value, exception: false) if value.is_a?(String)
int_value.nil? ? value : int_value
end

end
end
end
Expand Down
Loading