diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js
index f1e82a144..fb504f1bd 100644
--- a/app/assets/javascripts/posts.js
+++ b/app/assets/javascripts/posts.js
@@ -480,14 +480,6 @@
Danbooru.Post.initialize_title_for($post);
}
- Danbooru.Post.vote = function(score, id) {
- Danbooru.notice("Voting...");
-
- $.post("/posts/" + id + "/votes.js", {
- score: score
- });
- }
-
Danbooru.Post.update = function(post_id, params) {
Danbooru.Post.notice_update("inc");
diff --git a/app/controllers/comment_votes_controller.rb b/app/controllers/comment_votes_controller.rb
index 17efbf86e..835412677 100644
--- a/app/controllers/comment_votes_controller.rb
+++ b/app/controllers/comment_votes_controller.rb
@@ -13,7 +13,7 @@ class CommentVotesController < ApplicationController
def destroy
@comment = Comment.find(params[:comment_id])
- @comment.unvote!(params[:score])
+ @comment.unvote!
rescue CommentVote::Error => x
@error = x
render status: 500
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index c224ed61e..3a8b1f8b8 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -70,13 +70,6 @@ class CommentsController < ApplicationController
end
end
- def unvote
- @comment = Comment.find(params[:id])
- @comment.unvote!
- rescue CommentVote::Error => x
- @error = x
- end
-
private
def index_for_post
@post = Post.find(params[:post_id])
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index 96bc614d3..5ae49cd15 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -83,13 +83,6 @@ class PostsController < ApplicationController
end
end
- def unvote
- @post = Post.find(params[:id])
- @post.unvote!
- rescue PostVote::Error => x
- @error = x
- end
-
def home
if CurrentUser.user.is_anonymous?
redirect_to intro_explore_posts_path
diff --git a/app/views/comment_votes/destroy.js.erb b/app/views/comment_votes/destroy.js.erb
index e99eb4a71..754b5568a 100644
--- a/app/views/comment_votes/destroy.js.erb
+++ b/app/views/comment_votes/destroy.js.erb
@@ -1,7 +1,7 @@
<% if @error %>
Danbooru.error("<%= j @error.to_s %>");
<% else %>
- <% if @comment_vote.is_negative? %>
- $(".comment[data-comment-id=<%= @comment.id %>]").remove();
- <% end %>
-<% end %>
\ No newline at end of file
+ $("#comment-vote-up-link-for-<%= @comment.id %>").show();
+ $("#comment-vote-down-link-for-<%= @comment.id %>").show();
+ $("#comment-unvote-link-for-<%= @comment.id %>").hide();
+<% end %>
diff --git a/app/views/comments/partials/show/_comment.html.erb b/app/views/comments/partials/show/_comment.html.erb
index dd27351f6..501a6a8a6 100644
--- a/app/views/comments/partials/show/_comment.html.erb
+++ b/app/views/comments/partials/show/_comment.html.erb
@@ -35,7 +35,7 @@
<% end %>
-
+
<% end %>
<% if comment.editable_by?(CurrentUser.user) %>
diff --git a/app/views/comments/unvote.js.erb b/app/views/comments/unvote.js.erb
deleted file mode 100644
index 754b5568a..000000000
--- a/app/views/comments/unvote.js.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-<% if @error %>
- Danbooru.error("<%= j @error.to_s %>");
-<% else %>
- $("#comment-vote-up-link-for-<%= @comment.id %>").show();
- $("#comment-vote-down-link-for-<%= @comment.id %>").show();
- $("#comment-unvote-link-for-<%= @comment.id %>").hide();
-<% end %>
diff --git a/app/views/posts/unvote.js.erb b/app/views/post_votes/destroy.js.erb
similarity index 82%
rename from app/views/posts/unvote.js.erb
rename to app/views/post_votes/destroy.js.erb
index 7b0f62421..32985c457 100644
--- a/app/views/posts/unvote.js.erb
+++ b/app/views/post_votes/destroy.js.erb
@@ -5,4 +5,4 @@
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
<% end %>
$("#vote-links-for-post-<%= @post.id %>").show();
-$("#unvote-link-for-post-<%= @post.id %>").hide();
\ No newline at end of file
+$("#unvote-link-for-post-<%= @post.id %>").hide();
diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb
index eb04d4383..5a6ab8ade 100644
--- a/app/views/posts/partials/show/_information.html.erb
+++ b/app/views/posts/partials/show/_information.html.erb
@@ -16,7 +16,7 @@
Source: <%= post_source_tag(post) %>
Rating: <%= post.pretty_rating %>
- Score: <%= post.score %> <% if CurrentUser.is_voter? %>(vote <%= link_to "up", post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %>/<%= link_to "down", post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %><%= link_to "undo vote", unvote_post_path(post), :remote => true, :method => :put, :id => "unvote-link-for-post-#{post.id}", :class => "unvote-post-link" %>)<% end %>
+ Score: <%= post.score %> <% if CurrentUser.is_voter? %>(vote <%= link_to "up", post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %>/<%= link_to "down", post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %><%= link_to "undo vote", post_votes_path(post), :remote => true, :method => :delete, :id => "unvote-link-for-post-#{post.id}", :class => "unvote-post-link" %>)<% end %>
Favorites: <%= post.fav_count %>
<% if CurrentUser.is_gold? %>
<%= link_to "Show »".html_safe, "#", :id => "show-favlist-link" %>
diff --git a/config/routes.rb b/config/routes.rb
index c7ba163a0..d0db5e0df 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -99,12 +99,11 @@ Rails.application.routes.draw do
end
end
resources :comments do
- resources :votes, :controller => "comment_votes", :only => [:create, :destroy]
+ resource :votes, :controller => "comment_votes", :only => [:create, :destroy]
collection do
get :search
end
member do
- put :unvote
post :undelete
end
end
@@ -196,7 +195,7 @@ Rails.application.routes.draw do
collection { put :create_or_update }
member { put :revert }
end
- resources :votes, :controller => "post_votes", :only => [:create, :destroy]
+ resource :votes, :controller => "post_votes", :only => [:create, :destroy]
collection do
get :home
get :random
@@ -205,7 +204,6 @@ Rails.application.routes.draw do
put :revert
put :copy_notes
get :show_seq
- put :unvote
put :mark_as_translated
end
end