Created
January 4, 2009 02:43
-
-
Save jsmestad/42990 to your computer and use it in GitHub Desktop.
This file contains 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
= 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") | |
This file contains 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
%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) |
This file contains 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
// 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" }); | |
}) | |
}) |
This file contains 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
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