Skip to content

Commit

Permalink
update agent search input to be more customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Jul 15, 2023
1 parent a78ef1d commit 16e3e93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions app/components/agent_search_input_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

class AgentSearchInputComponent < ViewComponent::Base

def initialize(id:, organization_only: false )
def initialize(id:, agent_type: nil, name_prefix: nil, parent_id: , edit_on_modal: false)
super
@id = id
@organization_only = organization_only
@agent_type = agent_type
@name_prefix = name_prefix
@parent_id = parent_id
@edit_on_modal = edit_on_modal
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= 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',
= render SearchInputComponent.new(name:'agent' + @id, ajax_url: "/ajax/agents?agent_type=#{@agent_type}&name=",
item_base_url:"/agents/#{@id}?parent_id=#{@parent_id}&edit_on_modal=#{@edit_on_modal}&name_prefix=#{@name_prefix}&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|
actions_links: {create_new_agent: {link: "/agents/new?name=&id=#{@id}&parent_id=#{@parent_id}&new_agent=false&type=#{@agent_type}&show_affiliations=false&edit_on_modal=#{@edit_on_modal}&name_prefix=#{@name_prefix}[#{@id}]", 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
Expand Down

0 comments on commit 16e3e93

Please sign in to comment.