Skip to content

Commit

Permalink
fix js error when row doesn't have template (ie: complex datation fie…
Browse files Browse the repository at this point in the history
…lds)
  • Loading branch information
skyporter committed Apr 27, 2024
1 parent efc4cf1 commit 08d3e8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Procfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ web: rails s -p 3000
# - Generate js locales
# - Generate api doc
# - Watch process with webpack to compile the changed files
client: bundle exec rake locales:generate && rails swag:run && sh -c 'rm -rf public/packs/* || true && bin/shakapacker -w'
client: bundle exec rake locales:generate && sh -c 'rm -rf public/packs/* || true && bin/shakapacker -w'

# Start the Sidekiq background job processor
worker: bundle exec sidekiq
#worker: bundle exec sidekiq
11 changes: 6 additions & 5 deletions app/assets/javascripts/application/advanced_searches.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ init = ->

changeInputName = (selectInput) ->
selectedFilter = selectInput.val()
templateField = selectInput.parents(".row").find(".template")
templateField = selectInput.closest(".row").find(".template")

filerFieldName = templateField.attr("name").replace(/__filter__/g, selectedFilter);
filerFieldId = templateField.attr("id").replace(/__filter__/g, selectedFilter);
if templateField.length > 0
filerFieldName = templateField.attr("name").replace(/__filter__/g, selectedFilter);
filerFieldId = templateField.attr("id").replace(/__filter__/g, selectedFilter);

selectInput.closest('.row').find("input.form-control").first().attr("name", filerFieldName)
selectInput.closest('.row').find("input.form-control").first().attr("id", filerFieldId)
selectInput.closest('.row').find("input.form-control").first().attr("name", filerFieldName)
selectInput.closest('.row').find("input.form-control").first().attr("id", filerFieldId)

$(document).ready(init)

0 comments on commit 08d3e8d

Please sign in to comment.