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

Option to display resource lists as html unordered lists #22

Closed
Show file tree
Hide file tree
Changes from all 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
17 changes: 15 additions & 2 deletions app/helpers/resource_list_item_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,24 @@ def list_item_tag_list(resource)
list_item_simple_list(resource.annotations.collect(&:value), 'Tags') { |i| link_for_ann(i) }
end

def list_item_simple_list(items, attribute, hide_if_blank=false)
def list_item_simple_list(items, attribute, hide_if_blank=false, ul=false)
return '' if hide_if_blank && items.blank?
html = "<p class=\"list_item_attribute\"><b>#{attribute}:</b> "
if items.empty?
html << "<span class='none_text'>Not specified</span>"
else
if (ul)
html << "<ul>"
items.each_with_index do |i, idx|
value = if block_given?
yield(i)
else
(link_to get_object_title(i), show_resource_path(i))
end
html << "<li>" << value << "</li>"
end
html << "</ul>"
else
items.each_with_index do |i, idx|
value = if block_given?
yield(i)
Expand All @@ -110,7 +122,8 @@ def list_item_simple_list(items, attribute, hide_if_blank=false)
end
html << value + (idx == (items.length - 1) ? '' : ', ')
end
end
end
end
html += '</p>'
html.html_safe
end
Expand Down
6 changes: 2 additions & 4 deletions app/helpers/samples_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ def linked_custom_metadata_attribute_display(value, attribute)
v = value ? value[attr.title.to_s] : nil
html += '<li>'
if attr.linked_custom_metadata? || attr.linked_custom_metadata_multi?
html += content_tag(:span, class: 'linked_custom_metdata_display') do
html += content_tag(:div, class: 'linked_custom_metdata_display') do
folding_panel(attr.label, true, id:attr.title) do
display_attribute_value(v, attr)
end
end
else
html += '<label>'+attr.title+'</label>'+' : '
html += '<label>'+attr.label+'</label>'+' : '
html += display_attribute_value(v, attr)
end
html += '</li>'
Expand Down Expand Up @@ -355,5 +355,3 @@ def attribute_form_element(attribute, value, element_name, element_class, depth=
end

end


14 changes: 0 additions & 14 deletions app/views/homes/funding.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,3 @@
</div>
</div>
</div>

<div class='row funder-row'>
<div class='col-md-2'>
<%= image 'programme-denbi',:class=>'funder-logo' %>
</div>
<div class="col-md-10">
<%= link_to 'German Network for Bioinformatics Infrastructure – de.NBI', 'https://www.denbi.de/', target:'_blank' %>
- A national, academic and non-profit infrastructure supported by the Federal Ministry of Education and Research providing bioinformatics services to users in life sciences research and biomedicine
in Germany and Europe. The partners organize training events, courses and summer schools on tools, standards and compute services provided by de.NBI to assist researchers to more effectively exploit their data.


</div>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/people/_resource_list_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% cache "rli_#{person.cache_key}_#{hide_contact_details?(resource)}", skip_digest: true do -%>
<div class="row">
<div class="col-sm-6">
<%= list_item_simple_list resource.projects, t('project').pluralize %>
<%= list_item_simple_list resource.projects, t('project').pluralize, true, true %>
<%= list_item_simple_list resource.institutions, t('institution').pluralize %>

<% unless hide_contact_details?(resource) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/programmes/_resource_list_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<% end %>

<% end %>
<%= list_item_simple_list resource.projects, t('project').pluralize %>
<%= list_item_simple_list resource.projects, t('project').pluralize, true, true %>
<%= list_item_optional_attribute "Web page", h(resource.web_page), h(resource.web_page) %>
6 changes: 1 addition & 5 deletions db/seeds/024_MDS_3_2_Study_gen.seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,10 @@ def create_sample_controlled_vocab_terms_attributes(array)
sample_controlled_vocab_terms_attributes: create_sample_controlled_vocab_terms_attributes(
['Certain infectious or parasitic diseases (I)', 'Neoplasms (II)', 'Diseases of the blood or blood-forming organs and certain disorders involving the immune mechanism (III)', 'Endocrine, nutritional and metabolic diseases (IV)', 'Mental and behavioural disorders (V)', 'Diseases of the nervous system (VI)', 'Diseases of the eye and adnexa (VII)', 'Diseases of the ear or mastoid process (VIII)', 'Diseases of the circulatory system (IX)', 'Diseases of the respiratory system (X)', 'Diseases of the digestive system (XI)', 'Diseases of the skin and subcutaneous tissue (XII)', 'Diseases of the musculoskeletal system and connective tissue (XIII)', 'Diseases of the genitourinary system (XIV)', 'Pregnancy, childbirth or the puerperium (XV)', 'Certain conditions originating in the perinatal period (XVI)', 'Congenital malformations, deformations and chromosomal abnormalities (XVII)', 'Symptoms, signs and abnormal clinical and laboratory findings, not elsewhere classified (XVIII)', 'Injury, poisoning and certain other consequences of external causes (XIX)', 'External causes of morbidity or mortality (XX)', 'Factors influencing health status and contact with health services (XXI)', 'Other', 'Not applicable', 'Unknown']))

Design_groupsOfDiseases_conditions_Study_cv = SampleControlledVocab.where(title: 'Design_groupsOfDiseases_conditions_Study').first_or_create!(
sample_controlled_vocab_terms_attributes: create_sample_controlled_vocab_terms_attributes(
['Lower level ICD-10 (https://icd.who.int/browse10/2019/en), with autocomplete']))

unless CustomMetadataType.where(title:'Design_groupsOfDiseases_Study', supported_type:'CustomMetadata').any?
cmt = CustomMetadataType.new(title: 'Design_groupsOfDiseases_Study', supported_type:'CustomMetadata')
cmt.custom_metadata_attributes << CustomMetadataAttribute.new(title: 'Design_groupsOfDiseases_generally_Study', sample_attribute_type: @cv_list_type, sample_controlled_vocab:Design_groupsOfDiseases_generally_Study_cv, description:'Groups of diseases or conditions on which the data were collected in the Study.', label:'Which groups of diseases or conditions were the data collected on?')
cmt.custom_metadata_attributes << CustomMetadataAttribute.new(title: 'Design_groupsOfDiseases_conditions_Study', sample_attribute_type: @cv_type, sample_controlled_vocab:Design_groupsOfDiseases_conditions_Study_cv, description:'Other diseases or conditions on which the data were collected in the Study.', label:'On which other diseases or conditions were the data collected?')
cmt.custom_metadata_attributes << CustomMetadataAttribute.new(title: 'Design_groupsOfDiseases_conditions_Study', sample_attribute_type: @string_type, sample_controlled_vocab: nil, description:'Other diseases or conditions on which the data were collected in the Study.', label:'On which other diseases or conditions were the data collected?')
cmt.save!
end

Expand Down
6 changes: 1 addition & 5 deletions db/seeds/025_MDS_3_2_Investigation_gen.seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,10 @@ def create_sample_controlled_vocab_terms_attributes(array)
sample_controlled_vocab_terms_attributes: create_sample_controlled_vocab_terms_attributes(
['Certain infectious or parasitic diseases (I)', 'Neoplasms (II)', 'Diseases of the blood or blood-forming organs and certain disorders involving the immune mechanism (III)', 'Endocrine, nutritional and metabolic diseases (IV)', 'Mental and behavioural disorders (V)', 'Diseases of the nervous system (VI)', 'Diseases of the eye and adnexa (VII)', 'Diseases of the ear or mastoid process (VIII)', 'Diseases of the circulatory system (IX)', 'Diseases of the respiratory system (X)', 'Diseases of the digestive system (XI)', 'Diseases of the skin and subcutaneous tissue (XII)', 'Diseases of the musculoskeletal system and connective tissue (XIII)', 'Diseases of the genitourinary system (XIV)', 'Pregnancy, childbirth or the puerperium (XV)', 'Certain conditions originating in the perinatal period (XVI)', 'Congenital malformations, deformations and chromosomal abnormalities (XVII)', 'Symptoms, signs and abnormal clinical and laboratory findings, not elsewhere classified (XVIII)', 'Injury, poisoning and certain other consequences of external causes (XIX)', 'External causes of morbidity or mortality (XX)', 'Factors influencing health status and contact with health services (XXI)', 'Other', 'Not applicable', 'Unknown']))

Design_groupsOfDiseases_conditions_Investigation_cv = SampleControlledVocab.where(title: 'Design_groupsOfDiseases_conditions_Investigation').first_or_create!(
sample_controlled_vocab_terms_attributes: create_sample_controlled_vocab_terms_attributes(
['Lower level ICD-10 (https://icd.who.int/browse10/2019/en), with autocomplete']))

unless CustomMetadataType.where(title:'Design_groupsOfDiseases_Investigation', supported_type:'CustomMetadata').any?
cmt = CustomMetadataType.new(title: 'Design_groupsOfDiseases_Investigation', supported_type:'CustomMetadata')
cmt.custom_metadata_attributes << CustomMetadataAttribute.new(title: 'Design_groupsOfDiseases_generally_Investigation', sample_attribute_type: @cv_list_type, sample_controlled_vocab:Design_groupsOfDiseases_generally_Investigation_cv, description:'Groups of diseases or conditions on which the data were collected in the Investigation.', label:'Which groups of diseases or conditions were the data collected on?')
cmt.custom_metadata_attributes << CustomMetadataAttribute.new(title: 'Design_groupsOfDiseases_conditions_Investigation', sample_attribute_type: @cv_type, sample_controlled_vocab:Design_groupsOfDiseases_conditions_Investigation_cv, description:'Other diseases or conditions on which the data were collected in the Investigation.', label:'On which other diseases or conditions were the data collected?')
cmt.custom_metadata_attributes << CustomMetadataAttribute.new(title: 'Design_groupsOfDiseases_conditions_Investigation', sample_attribute_type: @string_type, sample_controlled_vocab:nil, description:'Other diseases or conditions on which the data were collected in the Investigation.', label:'On which other diseases or conditions were the data collected?')
cmt.save!
end

Expand Down