Skip to content

Commit

Permalink
remove agents search logic from UI side and limit it to only name, ac…
Browse files Browse the repository at this point in the history
…ronym and identifiers
  • Loading branch information
Bilelkihal committed Jul 18, 2024
1 parent 705b6d2 commit 5e82b7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= hidden_field_tag "#{@name_prefix}[#{@id}]"
= render SearchInputComponent.new(id: 'agent' + @id, name:'agent' + @id, ajax_url: "/ajax/agents?agent_type=#{@agent_type}&name=", display_all: true,
= render SearchInputComponent.new(id: 'agent' + @id, name:'agent' + @id, ajax_url: "/ajax/agents?query=", display_all: true,
item_base_url:"/agents/#{@id}?parent_id=#{@parent_id}&edit_on_modal=#{@edit_on_modal}&name_prefix=#{@name_prefix}&deletable=#{@deletable}&agent_id=", id_key: 'id',
use_cache: true,
use_cache: false,
actions_links: {create_new_agent: {link: "/agents/new?name=&id=#{@id}&parent_id=#{@parent_id}&type=#{@agent_type}&show_affiliations=#{@show_affiliations}&deletable=#{@deletable}&edit_on_modal=#{@edit_on_modal}&name_prefix=#{@name_prefix}[#{@id}]", target:'_self'}}) do |s|
- s.template do
%a{href: "LINK", class: "search-content", 'data-turbo-frame': '_self'}
Expand Down
8 changes: 3 additions & 5 deletions app/controllers/agents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ def show
end

def ajax_agents
@agents = LinkedData::Client::Models::Agent.all
filters = { query: params[:query]}
@agents = LinkedData::Client::Models::Agent.all(filters)
agents_json = @agents.map do |x|
{
id: x.id,
name: x.name,
type: x.agentType,
identifiers: x.identifiers.map { |i| "#{i.schemaAgency}:#{i.notation}" }.join(', '),
acronym: x.acronym,
affiliations: x.affiliations.to_s,
email: x.email,
homepage: x.homepage
acronym: x.acronym
}
end

Expand Down

0 comments on commit 5e82b7a

Please sign in to comment.