Skip to content

Commit

Permalink
re-organize the submission form key properties
Browse files Browse the repository at this point in the history
Added hasCreator, to add hasCreator, description, alternative, publication, released, hasFormalityLevel
  • Loading branch information
syphax-bouazzouni committed Jul 24, 2023
1 parent f7b9da9 commit 6a48422
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 41 deletions.
11 changes: 1 addition & 10 deletions app/controllers/concerns/submission_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,7 @@ def convert_values_to_types(new_submission_hash)
new_submission_hash[:contact] = new_submission_hash[:contact].values
new_submission_hash[:contact].delete_if { |c| c[:name].empty? || c[:email].empty? }
end

new_submission_hash[:titles] = new_submission_hash[:titles].values unless new_submission_hash[:titles].nil?
unless new_submission_hash[:creators].nil?
new_submission_hash[:creators] = new_submission_hash[:creators].values

new_submission_hash[:creators].each do |c|
c[:creatorIdentifiers] = c[:creatorIdentifiers].values unless c[:creatorIdentifiers].nil?
c[:affiliations] = c[:affiliations].values unless c[:affiliations].nil?
end
end


# Convert metadata that needs to be integer to int
@metadata.map do |hash|
Expand Down
56 changes: 25 additions & 31 deletions app/views/submissions/_form_content.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,36 @@
= metadata_section('key-properties', 'Key properties', collapsed: false) do
= form_group_attribute("URI", required: true)
= render partial: 'submissions/submission_identifier_form'
%div.agents-inputs
= attribute_form_group_container("hasCreator", required: true) do
= render NestedAgentSearchInputComponent.new(agents: @submission.hasCreator , agent_type: 'person', name_prefix: object_name+'[hasCreator]',
parent_id: '')
%div.agents-inputs
= attribute_form_group_container("publisher", required: true) do
= render NestedAgentSearchInputComponent.new(agents: @submission.publisher , agent_type: '', name_prefix: object_name+'[publisher]',
parent_id: '')

= form_group_attribute("deprecated")
= form_group_attribute("hasOntologySyntax") do
%p
Properties taken from
= link_to "W3C URIs for file format", "https://www.w3.org/ns/formats/", target: "_blank"
= form_group_attribute('hasCreator', required: true)
= form_group_attribute('publisher', required: true)

= attribute_form_group_container('description', required: true) do |c|
= text_area c.name, c.method_name, rows: 5, value: @submission.description, required: true, class: "form-control"

= form_group_attribute('alternative', required: true)

= form_group_attribute("hasFormalityLevel") do
-# Publications page
= attribute_text_field_container('publication', required: true) do |c|
- c.help do
Enter a URL for a page that lists publications about your ontology.

= form_group_attribute("released", default: Date.today, required: true)

= form_group_attribute("hasFormalityLevel", required: true) do
%p
Properties taken from
= link_to "DCMI KOS type vocabularies", "http://wiki.dublincore.org/index.php/NKOS_Vocabularies#KOS_Types_Vocabulary", target: "_blank"

%div#description-card.mt-4
= metadata_section('more-description-details', 'More description details', parent_id: "description-card") do
= form_group_attribute("deprecated")
= form_group_attribute("isOfType")
= form_group_attribute("hasOntologySyntax") do
%p
Properties taken from
= link_to "W3C URIs for file format", "https://www.w3.org/ns/formats/", target: "_blank"

= form_group_attribute("naturalLanguage") do
%p
Consider using a
Expand All @@ -62,12 +71,6 @@
%br
e.g.: http://lexvo.org/id/iso639-3/eng

%div#description-card.mt-4
= metadata_section('description', 'Description', collapsed: !@required_only || [email protected]?) do
-# Description
= attribute_form_group_container('description', required: true) do |c|
= text_area c.name, c.method_name, rows: 5, value: @submission.description, required: true, class: "form-control"

-# Home page
= attribute_text_field_container('homepage') do |c|
- c.help do
Expand All @@ -78,18 +81,11 @@
- c.help do
Enter a URL for a page that provides ontology documentation.

= form_group_attribute('alternative', required: true)

-# Publications page
= attribute_text_field_container('publication', required: true) do |c|
- c.help do
Enter a URL for a page that lists publications about your ontology.

-# Used ontology engineering tool
= form_group_attribute("usedOntologyEngineeringTool")

= metadata_section('more-description-details', 'More description details', parent_id: "description-card") do
- for attr_name in %w[abstract notes keywords alternative]
- for attr_name in %w[abstract notes keywords]
= form_group_attribute(attr_name)

- data = sections
Expand All @@ -100,10 +96,8 @@
= form_group_attribute(attr["attribute"])

%div#ontology-dates-card.mt-4
= metadata_section('ontology-dates', 'Dates', collapsed: !@required_only || [email protected]?) do
= form_group_attribute("released", default: Date.today, required: true)
= form_group_attribute("modificationDate")
= metadata_section('more-dates', 'More dates', parent_id: "ontology-dates-card") do
= form_group_attribute("modificationDate")
- for attr in @metadata.select { |m| m['category'] == 'dates' }
= form_group_attribute(attr["attribute"])

Expand Down

0 comments on commit 6a48422

Please sign in to comment.