Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Watch select.predicate change event and manipulate 'value' field acco…

…rdingly (hidden with 'true' value for blank or present predicates)
  • Loading branch information...
commit 0a519a9c32b9e7e745986f406a2af65ea1fc4b1a 1 parent 56cf446
Nathan Broadbent ndbroadbent authored
9 app/assets/javascripts/search.js.coffee
@@ -24,4 +24,13 @@
24 24 $(".remove_fields").live "click", ->
25 25 search.remove_fields this
26 26 false
  27 +
  28 + $("select.predicate").live "change", ->
  29 + value_el = $(this).next("span").children("input")
  30 + if $(this).val() == "present" || $(this).val() == "blank"
  31 + value_el.val("true")
  32 + value_el.hide()
  33 + else
  34 + value_el.val("")
  35 + value_el.show()
27 36 ) jQuery
2  app/views/base/_condition_fields.html.haml
@@ -5,7 +5,7 @@
5 5 = f.attribute_fields do |a|
6 6 = render 'attribute_fields', :f => a
7 7
8   - = f.predicate_select :only => [:cont, :not_cont, :blank, :present, :matches, :does_not_match, :eq, :not_eq, :lt, :gt], :compounds => false
  8 + = f.predicate_select({:only => [:cont, :not_cont, :blank, :present, :matches, :does_not_match, :eq, :not_eq, :lt, :gt], :compounds => false}, :class => "predicate")
9 9
10 10 = f.value_fields do |v|
11 11 = render 'value_fields', :f => v

0 comments on commit 0a519a9

Please sign in to comment.
Something went wrong with that request. Please try again.