Created
August 13, 2013 20:36
-
-
Save Will-Sommers/6225434 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#transaction_recipient').on 'change', -> | |
switch $(this).val() | |
when 'artist' then hide_and_slide('artist') | |
when 'venue' then hide_and_slide('venue') | |
when 'affiliate' then hide_and_slide('affiliate') | |
else hide_and_slide('setfm') | |
hide_and_slide = (display_field) -> | |
show_id = "##{display_field}-token-selection" | |
$(show_id).slideDown() | |
field_tags = [] | |
fields = ['artist', 'venue', 'affiliate'] | |
for field in fields when field isnt display_field | |
field_tags.push("##{field}-token-selection") | |
$(".#{field}-tokens-input").tokenInput('clear') if $(".#{field}-tokens-input").length > 0 | |
$(field_tags.join(', ')).slideUp() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment