@@ -45,17 +47,25 @@
|
<%= select_tag "#{field_name_prefix}[sample_attribute_type_id]",
options_for_select(SampleAttributeType.all.sort_by(&:title).sort_by { |t| t.default? ? 0 : 1 }.map do |t|
- [t.title, t.id,{'data-is-cv': t.controlled_vocab?,'data-is-seek-sample': t.seek_sample? || t.seek_sample_multi? }]
+ [t.title, t.id,{'data-use-cv': t.controlled_vocab?,'data-is-seek-sample': t.seek_sample? || t.seek_sample_multi? }]
end, attribute_type_id),
class: 'form-control sample-type-attribute-type', data: {attr: "type"} %>
-
+
<%= select_tag "#{field_name_prefix}[sample_controlled_vocab_id]",
options_for_select(SampleControlledVocab.all.map { |scv| [scv.title, scv.id, {'data-editable': scv.can_edit?}] },
sample_controlled_vocab_id),include_blank: true,
class: 'form-control controlled-vocab-selection', data: {attr: "cv_id"} %>
+
+
+
+
<%= button_link_to('Edit', 'edit', '#', class:'cv-edit-button', disabled: true, target: :_blank) %>
<%= create_sample_controlled_vocab_modal_button %>
@@ -73,7 +83,7 @@
end
%>
<%= select_tag "#{field_name_prefix}[linked_sample_type_id]",
- grouped_options_for_select(options, nil),
+ grouped_options_for_select(options, linked_sample_type_id),
include_blank: true,
class: 'form-control linked-sample-type-selection' %>
diff --git a/app/views/templates/edit.html.erb b/app/views/templates/edit.html.erb
index 3fe83a434e..70f37c2266 100644
--- a/app/views/templates/edit.html.erb
+++ b/app/views/templates/edit.html.erb
@@ -13,7 +13,7 @@
.addClass('hidden'); // Hide the row
// Update the ISA tag select
- const attribute_row = "#new-attribute-row"
+ const attribute_row = ".sample-attribute";
updateIsaTagSelect("<%= @template.level %>", attribute_row);
});
diff --git a/app/views/templates/new.html.erb b/app/views/templates/new.html.erb
index a0b617a870..aaa65faa53 100644
--- a/app/views/templates/new.html.erb
+++ b/app/views/templates/new.html.erb
@@ -5,8 +5,7 @@
Templates can be defined manually through the form below or based on repository templates.
-
-
+
<%= render partial: 'templates/form', locals: { tab: tab } %>
@@ -22,7 +21,7 @@
.addClass('hidden'); // Hide the row
// Update the ISA tag select
- const attribute_row = "#new-attribute-row"
+ const attribute_row = ".sample-attribute";
updateIsaTagSelect("<%= @template.level %>", attribute_row);
});
diff --git a/db/migrate/20231218133053_add_linked_sample_type_to_templates.rb b/db/migrate/20231218133053_add_linked_sample_type_to_templates.rb
new file mode 100644
index 0000000000..e6d6da6ff5
--- /dev/null
+++ b/db/migrate/20231218133053_add_linked_sample_type_to_templates.rb
@@ -0,0 +1,5 @@
+class AddLinkedSampleTypeToTemplates < ActiveRecord::Migration[6.1]
+ def change
+ add_column :template_attributes, :linked_sample_type_id, :integer
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index fb7fd16c3c..22e12632eb 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2023_12_18_113249) do
+ActiveRecord::Schema.define(version: 2023_12_18_133053) do
create_table "activity_logs", id: :integer, force: :cascade do |t|
t.string "action"
@@ -2098,6 +2098,7 @@
t.integer "isa_tag_id"
t.string "pid"
t.boolean "allow_cv_free_text", default: false
+ t.integer "linked_sample_type_id"
t.index ["template_id", "title"], name: "index_template_id_asset_id_title"
end
diff --git a/db/seeds/008_miappe_custom_metadata.seeds.rb b/db/seeds/008_miappe_extended_metadata.seeds.rb
similarity index 64%
rename from db/seeds/008_miappe_custom_metadata.seeds.rb
rename to db/seeds/008_miappe_extended_metadata.seeds.rb
index c314b5dd50..c44742422d 100644
--- a/db/seeds/008_miappe_custom_metadata.seeds.rb
+++ b/db/seeds/008_miappe_extended_metadata.seeds.rb
@@ -1,40 +1,40 @@
unless ExtendedMetadataType.where(title:'MIAPPE metadata v1.1', supported_type:'Investigation').any?
- cmt = ExtendedMetadataType.new(title: 'MIAPPE metadata v1.1', supported_type:'Investigation')
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'id', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'submission_date', sample_attribute_type: SampleAttributeType.where(title:'Date').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'license', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'miappe_version', required:true, sample_attribute_type: SampleAttributeType.where(title:'Integer').first)
- cmt.save!
+ emt = ExtendedMetadataType.new(title: 'MIAPPE metadata v1.1', supported_type:'Investigation')
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'id', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'submission_date', sample_attribute_type: SampleAttributeType.where(title:'Date').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'license', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'miappe_version', required:true, sample_attribute_type: SampleAttributeType.where(title:'Integer').first)
+ emt.save!
puts 'Seeded Investigation extended metadata for MIAPPE v1.1'
end
unless ExtendedMetadataType.where(title:'MIAPPE metadata v1.1', supported_type:'Study').any?
- cmt = ExtendedMetadataType.new(title: 'MIAPPE metadata v1.1', supported_type:'Study')
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'id', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'study_start_date', required:true, sample_attribute_type: SampleAttributeType.where(title:'Date').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'study_end_date', sample_attribute_type: SampleAttributeType.where(title:'Date').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'contact_institution', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'geographic_location_country', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'experimental_site_name', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'latitude', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'longitude', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'altitude', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'description_of_the_experimental_design', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'type_of_experimental_design', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'observation_unit_level_hierarchy', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'observation_unit_description', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'description_of_growth_facility', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'type_of_growth_facility', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'cultural_practices', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt = ExtendedMetadataType.new(title: 'MIAPPE metadata v1.1', supported_type:'Study')
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'id', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'study_start_date', required:true, sample_attribute_type: SampleAttributeType.where(title:'Date').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'study_end_date', sample_attribute_type: SampleAttributeType.where(title:'Date').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'contact_institution', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'geographic_location_country', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'experimental_site_name', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'latitude', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'longitude', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'altitude', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'description_of_the_experimental_design', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'type_of_experimental_design', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'observation_unit_level_hierarchy', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'observation_unit_description', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'description_of_growth_facility', required:true, sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'type_of_growth_facility', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'cultural_practices', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.save!
+ emt.save!
puts 'Seeded Study extended metadata for MIAPPE v1.1'
end
unless ExtendedMetadataType.where(title:'MIAPPE metadata v1.1', supported_type:'Assay').any?
- cmt = ExtendedMetadataType.new(title: 'MIAPPE metadata v1.1', supported_type: 'Assay')
- cmt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'level', sample_attribute_type: SampleAttributeType.where(title:'String').first)
- cmt.save!
+ emt = ExtendedMetadataType.new(title: 'MIAPPE metadata v1.1', supported_type: 'Assay')
+ emt.extended_metadata_attributes << ExtendedMetadataAttribute.new(title: 'level', sample_attribute_type: SampleAttributeType.where(title:'String').first)
+ emt.save!
puts 'Seeded Assay extended metadata for MIAPPE v1.1'
end
\ No newline at end of file
|