Implmented custom autocomplete for customer field

This commit is contained in:
2026-03-18 21:55:55 -04:00
parent 460bcd466f
commit b367687113
8 changed files with 135 additions and 15 deletions

View File

@@ -23,13 +23,13 @@ module RedmineQbo
project = context[:project]
# Customer Name Text Box with database backed autocomplete
# onchange event will update the hidden customer_id field
search_customer = f.autocomplete_field :customer,
autocomplete_customer_name_customers_path,
selected: issue.customer,
update_elements: {
id: '#issue_customer_id',
value: '#issue_customer'
# onchange event will update the hidden customer_id field
search_customer = f.text_field :customer,
placeholder: l(:field_customer),
class: "customer-name",
autocomplete: "off",
data: {
autocomplete_url: "/customers/autocomplete"
}
# We need to handle 3 cases for the onchange event of the customer name field:

View File

@@ -17,8 +17,9 @@ module RedmineQbo
def view_layouts_base_html_head(context = {})
safe_join([
javascript_include_tag( 'application.js', plugin: :redmine_qbo),
javascript_include_tag( 'autocomplete-rails.js', plugin: :redmine_qbo),
javascript_include_tag( 'checkbox_controller.js', plugin: :redmine_qbo)
javascript_include_tag( 'autocomplete.js', plugin: :redmine_qbo),
javascript_include_tag( 'checkbox_controller.js', plugin: :redmine_qbo),
stylesheet_link_tag( 'autocomplete', plugin: :redmine_qbo)
])
end