forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add agents search input component and show action
- Loading branch information
1 parent
c4e8fcc
commit 3dd7493
Showing
5 changed files
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class AgentSearchInputComponent < ViewComponent::Base | ||
|
||
def initialize(id:, organization_only: false ) | ||
super | ||
@id = id | ||
@organization_only = organization_only | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
app/components/agent_search_input_component/agent_search_input_component.html.haml
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,10 @@ | ||
= render SearchInputComponent.new(name:'agent' + @id, ajax_url: "/ajax/agents?organization_only=#{@organization_only}&name=", | ||
item_base_url:"/agents/fake_id?parent_id=#{@id}&name=", id_key: 'name', | ||
use_cache: false, | ||
actions_links: {create_new_agent: {link: "/agents/new?name=&parent_id=#{@id}&new_agent=false&type=organization", target:'_self'}}) do |s| | ||
- s.template do | ||
%a{href: "LINK", class: "home-search-ontology-content", 'data-turbo-frame': '_self'} | ||
%p#seached-ontology.home-searched-ontology | ||
NAME (IDENTIFIERS) | ||
%p.home-result-type | ||
TYPE |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- if agent.id | ||
= hidden_field_tag agent_field_name(:id, name_prefix), agent.id | ||
= text_field_tag '', agent.name + '(' + agent.identifiers.map {|i| i.schemaAgency+':'+i.notation}.join(', ') + ')', class: "form-control", disabled: true |
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,2 @@ | ||
= turbo_frame_tag params[:parent_id] || 'application_modal_content' do | ||
= render partial: 'agents/agent_show', locals: {agent: @agent, name_prefix: @name_prefix} |