Skip to content

Instantly share code, notes, and snippets.

@dasibre
Created September 25, 2013 14:14
Show Gist options
  • Save dasibre/6700242 to your computer and use it in GitHub Desktop.
Save dasibre/6700242 to your computer and use it in GitHub Desktop.
javascript form button for each object
#This is my player partial
.w-col.w-col-3.w-col-small-6
= image_tag player.image_url.to_s
h4= player.full_name
= link_to "Pin", { controller: "pinboard_players", action: "new", id: player}, remote: true, class: "pinbutton #{player.full_name}"
player index
.section
.w-container
.w-row
- @players.each do |player|
= render "player", player: player
controller new.js
$('.pinbutton').hide().after('<%= j render("pinboard_select") %>')
@dasibre
Copy link
Author

dasibre commented Sep 25, 2013

ie, send the player id in the ajax request, then use $('.pinboard <%= some_unique_id %>').hide().after(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment