fixes #25: Voting on posts does not have any effect (also added to post/show)

This commit is contained in:
albert
2011-09-13 18:08:38 -04:00
parent 89a406db33
commit e8d16b2b33
5 changed files with 11 additions and 6 deletions

View File

@@ -8,7 +8,7 @@
} }
Danbooru.j_alert = function(title, msg) { Danbooru.j_alert = function(title, msg) {
$('<div title="' + title + '"></div>').html(msg).dialog(); $('<div title="' + title + '"></div>').html(msg).dialog({modal: true});
} }
Danbooru.j_error = function(msg) { Danbooru.j_error = function(msg) {
@@ -16,7 +16,7 @@
} }
Danbooru.ajax_start = function(target) { Danbooru.ajax_start = function(target) {
$(target).after(' <img src="/images/wait.gif" width="15" height="5" class="wait">'); $(target).after('<img src="/images/wait.gif" width="15" height="5" class="wait">');
} }
Danbooru.ajax_stop = function(target) { Danbooru.ajax_stop = function(target) {

View File

@@ -170,6 +170,10 @@ img {
vertical-align: middle; vertical-align: middle;
} }
img.wait {
margin-left: 5px;
}
input[type=text], input[type=password], input[type=url], textarea, button { input[type=text], input[type=password], input[type=url], textarea, button {
/* border: 1px solid #AAA;*/ /* border: 1px solid #AAA;*/
font-size: 1em; font-size: 1em;

View File

@@ -14,8 +14,8 @@
</span> </span>
<span class="info"> <span class="info">
<strong>Score</strong> <strong>Score</strong>
<span id="score-for-post-<%= post.id %>"> <span>
<span><%= post.score %></span> <span id="score-for-post-<%= post.id %>"><%= post.score %></span>
<% if CurrentUser.user.is_privileged? %> <% if CurrentUser.user.is_privileged? %>
(vote <%= link_to("up", post_votes_path(:score => "up", :post_id => post.id), :remote => true, :method => :post) %>/<%= link_to("down", post_votes_path(:score => "down", :post_id => post.id), :remote => true, :method => :post) %>) (vote <%= link_to("up", post_votes_path(:score => "up", :post_id => post.id), :remote => true, :method => :post) %>/<%= link_to("down", post_votes_path(:score => "down", :post_id => post.id), :remote => true, :method => :post) %>)
<% end %> <% end %>

View File

@@ -1,5 +1,5 @@
<% if @error %> <% if @error %>
alert("<%= escape_javascript @error.to_s %>"); Danbooru.j_error("<%= j @error.to_s %>");
<% else %> <% else %>
$("#score-for-post-<%= @post.id %> span").text(<%= @post.score %>); $("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
<% end %> <% end %>

View File

@@ -11,6 +11,7 @@
(<%= post.image_width %>x<%= post.image_height %>) (<%= post.image_width %>x<%= post.image_height %>)
<% end %> <% end %>
</li> </li>
<li>Score: <span id="score-for-post-<%= post.id %>"><%= post.score %></span> (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 %>)</li>
<li> <li>
Status: Status:
<% if post.is_pending? %> <% if post.is_pending? %>