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

Fix changes in edit submission page #378

Merged
merged 9 commits into from
Nov 3, 2023
3 changes: 2 additions & 1 deletion app/components/switch_input_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
class SwitchInputComponent < ViewComponent::Base


def initialize(id:, name: , label: '', value: '', checked: false, boolean_switch: false)
def initialize(id:, name: , label: '', value: '', checked: false, boolean_switch: false, style: nil)
super
@id = id
@name = name
@label = label
@value = value.nil? || value.empty? ? @name : value
@checked = checked
@boolean_switch = boolean_switch
@style = style
end

def boolean_switch_action
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- if @boolean_switch
= hidden_field_tag @name, @value
- if content || [email protected]?
%p
%p{style: @style}
= content || @label
%label.switch{for: check_box_id}
= check_box_tag check_box_name, @value, @checked, class: '', id: check_box_id, onChange: "#{boolean_switch_action}"
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/inputs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def check_input(id:, name:, value:, label: '', checked: false)
render ChipsComponent.new(name: name, id: id, label: label, value: value, checked: checked)
end

def switch_input(id:, name:, label:, checked: false, value: '', boolean_switch: false)
render SwitchInputComponent.new(id: id, name: name, label: label, checked: checked, value: value, boolean_switch: boolean_switch)
def switch_input(id:, name:, label:, checked: false, value: '', boolean_switch: false, style: nil)
render SwitchInputComponent.new(id: id, name: name, label: label, checked: checked, value: value, boolean_switch: boolean_switch, style: style)
end

def url_input(name:, value:, label: nil, help: nil)
Expand Down
10 changes: 5 additions & 5 deletions app/helpers/submission_inputs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def ontology_administered_by_input(ontology = @ontology, users_list = @user_sele
users_list = LinkedData::Client::Models::User.all(include: "username").map { |u| [u.username, u.id] }
users_list.sort! { |a, b| a[1].downcase <=> b[1].downcase }
end
select_input(label: "Administrator", name: "ontology[administeredBy]", values: users_list, selected: ontology.administeredBy || session[:user].id, multiple: true)
select_input(label: "Administrators", name: "ontology[administeredBy]", values: users_list, selected: ontology.administeredBy || session[:user].id, multiple: true)
end

def ontology_categories_input(ontology = @ontology, categories = @categories)
Expand Down Expand Up @@ -141,7 +141,7 @@ def ontology_visibility_input(ontology = @ontology)
select_input(label: "Visibility", name: "ontology[viewingRestriction]", values: %w[public private], selected: ontology.viewingRestriction )
end
content_tag(:div, class: 'upload-ontology-input-field-container') do
select_input(label: "Add or remove accounts that are allowed to view classes in this ontology using the account name", name: "ontology[acl]", values: @user_select_list, selected: ontology.acl, multiple: true)
select_input(label: "Add or remove accounts that are allowed to see this ontology in #{portal_name}.", name: "ontology[acl]", values: @user_select_list, selected: ontology.acl, multiple: true)
end
end
end
Expand All @@ -150,7 +150,7 @@ def ontology_view_of_input(ontology = @ontology)
render Layout::RevealComponent.new(init_show: ontology.view?) do |c|
c.button do
content_tag(:span, class: 'd-flex') do
switch_input(id: 'ontology_isView', name: 'ontology[isView]', label: 'Is a view of another ontology?', checked: ontology.view?)
switch_input(id: 'ontology_isView', name: 'ontology[isView]', label: 'Is a view of another ontology?', checked: ontology.view?, style: 'font-size: 14px;')
end
end

Expand All @@ -164,9 +164,9 @@ def contact_input(label: '', name: 'Contact', show_help: true)
attr = SubmissionMetadataInput.new(attribute_key: 'contact', attr_metadata: attr_metadata('contact'))
render Input::InputFieldComponent.new(name: '', label: attr_header_label(attr, label, show_tooltip: show_help),
error_message: attribute_error(:contact)) do
render NestedFormInputsComponent.new(object_name: 'Contact', default_empty_row: true) do |c|
render NestedFormInputsComponent.new(object_name: 'contact', default_empty_row: true) do |c|
c.header do
content_tag(:div, "#{name} name", class: 'w-50') + content_tag(:div, "#{name} email", class: 'w-50')
content_tag(:div, "#{name} Name", class: 'w-50') + content_tag(:div, "#{name} Email", class: 'w-50')
end

c.template do
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/submissions_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module SubmissionsHelper
def metadata_help_link
content_tag(:div, class: 'edit-ontology-desc') do
html = content_tag(:span, 'To understand the ontologies metadata:')
html = content_tag(:span, 'Learn more about ontology ')
html += content_tag(:span, style: 'width: 10px; height: 10px') do
link_to(render(ExternalLinkTextComponent.new(text: 'see the Wiki')), "https://github.com/agroportal/documentation/wiki/Ontology-metadata")
link_to(render(ExternalLinkTextComponent.new(text: 'metadata in ' + portal_name + ' here:')), "https://github.com/agroportal/documentation/wiki/Ontology-metadata")
end
html.html_safe
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/ontologies/_submission_location_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%label.title{for: "metadata_only"}
Metadata only (No file)
.upload-ontology-desc.mb-2
Allow users to view and search your ontology metadata, but not its classes and properties.
Allow users to view the metadata of your ontology (Summary) only.
#metadata-only-form

.location-choice
Expand Down
2 changes: 1 addition & 1 deletion app/views/submissions/_submission_format_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

= attribute_form_group_container('hasOntologyLanguage') do
%div{onchange: 'ontologyFormatChange(event)'}
= select_input(label: "Format", name: "submission[hasOntologyLanguage]", values: ["OBO", "OWL", "SKOS", "UMLS"], selected: @submission.hasOntologyLanguage)
= select_input(label: "Representation language", name: "submission[hasOntologyLanguage]", values: ["OBO", "OWL", "SKOS", "UMLS"], selected: @submission.hasOntologyLanguage)
%div#skos_options.upload-ontology-desc{style: "display:#{skos? ? 'block': 'none'}"}
SKOS vocabularies submitted to BioPortal must contain a minimum of one concept scheme and top concept assertion.
Please refer to the NCBO wiki for a more #{link_to 'detailed explanation', 'https://www.bioontology.org/wiki/index.php/SKOSSupport', target: "_blank" }
Expand Down