forked from seek4science/seek
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'seek_ena_upload' of github.com:ELIXIR-Belgium/seek into…
… fairdom_test Pulling in latest commits from 'seek_ena_upload' branch
- Loading branch information
Showing
81 changed files
with
1,282 additions
and
1,253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
...ts/stylesheets/linked_custom_metadata.css → .../stylesheets/linked_extended_metadata.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
.linked_custom_metdata .panel-default .panel-heading { | ||
.linked_extended_metdata .panel-default .panel-heading { | ||
font-weight: bold; | ||
color: #333; | ||
background-color: #ffffff; | ||
border: 0; | ||
padding-left:0px; | ||
} | ||
|
||
.linked_custom_metdata .panel-body { | ||
.linked_extended_metdata .panel-body { | ||
background-color: rgb(248,248,248); | ||
padding: 10px 15px; | ||
border-radius: 5px; | ||
} | ||
|
||
|
||
.linked_custom_metdata .panel { | ||
.linked_extended_metdata .panel { | ||
border: 0; | ||
} | ||
|
||
.linked_custom_metdata_even { | ||
.linked_extended_metdata_even { | ||
background-color: rgb(248,248,248); | ||
padding: 10px 15px 10px 15px; | ||
border-radius: 5px; | ||
} | ||
|
||
.linked_custom_metdata_odd { | ||
.linked_extended_metdata_odd { | ||
background-color: rgb(224,224,224); | ||
|
||
padding: 10px 15px 10px 15px; | ||
border-radius: 5px; | ||
} | ||
|
||
.multi_linked_custom_metdata { | ||
.multi_linked_extended_metdata { | ||
background-color: rgb(246, 246, 246); | ||
padding: 10px 15px 10px 15px; | ||
border-radius: 5px; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.linked_custom_metdata_display .panel-default .panel-heading { | ||
.linked_extended_metdata_display .panel-default .panel-heading { | ||
font-weight: bold; | ||
border: none; | ||
background-color: #ffffff; | ||
padding: 0px 0px; | ||
} | ||
|
||
|
||
.linked_custom_metdata_display .panel { | ||
.linked_extended_metdata_display .panel { | ||
border: none; | ||
box-shadow: none; | ||
margin-bottom: 0px; | ||
} | ||
|
||
.linked_custom_metdata_display .panel-body { | ||
.linked_extended_metdata_display .panel-body { | ||
padding: 0px 0px; | ||
border-radius: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
class ExtendedMetadataTypesController < ApplicationController | ||
respond_to :json | ||
|
||
before_action :find_extended_metadata_type, only: [:show] | ||
|
||
# generated for form, to display fields for selected metadata type | ||
def form_fields | ||
id = params[:id] | ||
parent_resource = params[:parentResource] unless params[:parentResource]&.empty? | ||
respond_to do |format| | ||
if id.blank? | ||
format.html { render html: '' } | ||
else | ||
cm = ExtendedMetadataType.find(id) | ||
resource = safe_class_lookup(cm.supported_type).new | ||
resource.extended_metadata = ExtendedMetadata.new(extended_metadata_type: cm) | ||
format.html do | ||
render partial: 'extended_metadata/extended_metadata_fields', | ||
locals: { extended_metadata_type: cm, resource:, parent_resource: } | ||
end | ||
end | ||
end | ||
end | ||
|
||
def show | ||
respond_to do |format| | ||
format.json {render json: @extended_metadata_type} | ||
end | ||
end | ||
|
||
private | ||
|
||
def find_extended_metadata_type | ||
@extended_metadata_type = ExtendedMetadataType.find(params[:id]) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module ExtendedMetadataHelper | ||
include SamplesHelper | ||
|
||
def extended_metadata_form_field_for_attribute(attribute, resource, parent_resource = nil) | ||
element_class = "extended_metadata_attribute_#{attribute.sample_attribute_type.base_type.downcase}" | ||
|
||
if parent_resource | ||
element_name = "#{parent_resource}[#{resource.class.name.underscore}][extended_metadata_attributes][data][#{attribute.title}]" | ||
else | ||
element_name = "#{resource.class.name.underscore}[extended_metadata_attributes][data][#{attribute.title}]" | ||
end | ||
|
||
if attribute.linked_extended_metadata? || attribute.linked_extended_metadata_multi? | ||
content_tag(:span, class: 'linked_extended_metdata') do | ||
folding_panel(attribute.label, false, id:attribute.title) do | ||
attribute_form_element(attribute, resource.extended_metadata.get_attribute_value(attribute.title), element_name, element_class) | ||
end | ||
end | ||
else | ||
content_tag(:label,attribute.label, class: attribute.required? ? 'required' : '') + | ||
attribute_form_element(attribute, resource.extended_metadata.get_attribute_value(attribute.title), element_name, element_class) | ||
end | ||
end | ||
|
||
def extended_metadata_attribute_description(description) | ||
html = '<p class="help-block">' | ||
html += '<small>'+description+'</small>' | ||
html += '</p>' | ||
html.html_safe | ||
end | ||
|
||
def render_extended_metadata_value(attribute, resource) | ||
|
||
if resource.extended_metadata.data[attribute.title].blank? | ||
return '' # Return an empty string if the extended metadata is blank. | ||
end | ||
|
||
content_tag(:div, class: 'extended_metadata') do | ||
if attribute.linked_extended_metadata? || attribute.linked_extended_metadata_multi? | ||
content_tag(:span, class: 'linked_extended_metdata_display') do | ||
folding_panel(attribute.label, true, id: attribute.title) do | ||
display_attribute(resource.extended_metadata, attribute, link: true) | ||
end | ||
end | ||
else | ||
label_tag("#{attribute.label} : ") + " " + display_attribute(resource.extended_metadata, attribute, link: true) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.