Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Created December 15, 2011 08:55
Show Gist options
  • Save luckyruby/1480419 to your computer and use it in GitHub Desktop.
Save luckyruby/1480419 to your computer and use it in GitHub Desktop.
$('#location_fee_form').dialog({modal: true, autoOpen:false, title:'Fee', width: '450px'})
$('#location_fee_form').html("<%= escape_javascript(render 'form') %>")
$('#location_fee_pricing, #location_fee_min_fee_pricing').chosen()
$('#location_fee_form').dialog('open')
$('#location_fee_name').focus()
$('.button').button()
show_if_min_fee_apply = ->
if $('#location_fee_min_fee_apply').is(':checked')
$('.show_if_min_fee_apply').show()
else
$('.show_if_min_fee_apply').hide()
show_if_max_fee_apply = ->
if $('#location_fee_max_fee_apply').is(':checked')
$('.show_if_max_fee_apply').show()
else
$('.show_if_max_fee_apply').hide()
show_if_percent = ->
if $('#location_fee_pricing :selected').val() == 'percent'
$('.show_if_pricing_is_percent').show()
else
$('.show_if_pricing_is_percent').hide()
$ ->
show_if_max_fee_apply()
show_if_min_fee_apply()
show_if_percent()
$("#location_fee_max_fee_apply").live "change", (event) -> show_if_max_fee_apply()
$("#location_fee_min_fee_apply").live "change", (event) -> show_if_min_fee_apply()
$("#location_fee_pricing").live "change", (event) -> show_if_percent()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment