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: Auto fill ontology viw of input when we click the '+' button in summary page #512

Merged
merged 3 commits into from
Feb 27, 2024
Merged
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
2 changes: 1 addition & 1 deletion app/components/layout/reveal_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Layout::RevealComponent < ViewComponent::Base

def initialize(selected: nil, possible_values: [], hidden_class: 'd-none', toggle: false)
@hidden_class = hidden_class
@possible_values = possible_values
@possible_values = toggle && possible_values.empty? ? [true] : possible_values
@selected = selected
@toggle = toggle
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def mappings

def new
@ontology = LinkedData::Client::Models::Ontology.new
@ontology.viewOf = params.dig(:ontology, :viewOf)
@submission = LinkedData::Client::Models::OntologySubmission.new
@submission.hasOntologyLanguage = 'OWL'
@ontologies = LinkedData::Client::Models::Ontology.all(include: 'acronym', include_views: true, display_links: false, display_context: false)
Expand Down
13 changes: 6 additions & 7 deletions app/helpers/submission_inputs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,15 @@ def ontology_visibility_input(ontology = @ontology)
end

def ontology_view_of_input(ontology = @ontology)
render Layout::RevealComponent.new(selected: !ontology.view?, toggle: true) do |c|
render Layout::RevealComponent.new(selected: ontology.view?, toggle: true) do |c|
c.button do
content_tag(:span, class: 'd-flex') do
content_tag(:span, class: 'd-flex mb-2') do
switch_input(id: 'ontology_isView', name: 'ontology[isView]', label: 'Is this ontology a view of another ontology?', checked: ontology.view?, style: 'font-size: 14px;')
end

c.container do
content_tag(:div) do
render partial: "shared/ontology_picker_single", locals: { placeholder: "", field_name: "viewOf", selected: ontology.viewOf }
end
end
c.container do
content_tag(:div) do
render partial: "shared/ontology_picker_single", locals: { placeholder: "", field_name: "viewOf", selected: ontology.viewOf}
end
end
end
Expand Down
Loading