Skip to content

Instantly share code, notes, and snippets.

@jsmestad
Created January 4, 2009 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jsmestad/42990 to your computer and use it in GitHub Desktop.
Save jsmestad/42990 to your computer and use it in GitHub Desktop.
= link_to(image_tag('thumbs_up_48.png'), resource(refactor.snippet, refactor, :votes, :new), :class => "vote_up")
= link_to(image_tag('thumbs_down_48.png'), resource(refactor.snippet, refactor, :votes, :new), :class => "vote_down")
%tr
%td
%div
%h3= refactor.author.login
%ul
%li= refactor.author.created_on
%li= "Refactors: #{refactor.author.refactors.count}"
%div
= partial "votes/form", :refactor => refactor
= find_and_preserve(CodeRay.scan(refactor.code, :ruby).html.numerize.div)
// Common JavaScript code across your application goes here.
jQuery.ajaxSetup({
'beforeSend': function(xhr) { xhr.setRequestHeader("Accept", "text/javascript") }
})
$(document).ready(fuction() {
$("a.vote_up").click(function(){
$.post($this, { 'vote[]': "1" });
})
})
def create(vote)
@vote = Vote.new(vote)
if @vote.save
redirect resource(@vote), :message => {:notice => "Vote was successfully created"}
else
message[:error] = "Vote failed to be created"
render :new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment