upgraded to jquery 1.5.1, fixed comment voting ajax

This commit is contained in:
albert
2011-03-08 18:23:16 -05:00
parent a281bf03ed
commit 2b2be3263b
12 changed files with 122 additions and 275 deletions

View File

@@ -1,6 +1,10 @@
module PoolsHelper module PoolsHelper
def recent_updated_pools(&block) def recent_updated_pools
pool_ids = session[:recent_pool_ids].to_s.scan(/\d+/) pool_ids = session[:recent_pool_ids].to_s.scan(/\d+/)
Pool.where(["id IN (?)", pool_ids]).each(&block) if pool_ids.any? if pool_ids.any?
Pool.where(["id IN (?)", pool_ids])
else
[]
end
end end
end end

View File

@@ -1,3 +1,5 @@
<% if @error %> <% if @error %>
alert(<%= escape_javascript(@error.to_s) %>); alert("<%= escape_javascript(@error.to_s) %>");
<% else %>
$("#score-for-comment-<%= @comment.id %>").html("<%= pluralize @comment.score, 'point' %>");
<% end %> <% end %>

View File

@@ -1,5 +1,5 @@
<div class="comments"> <div id="c-comments">
<div class="index"> <div id="a-index">
<% @posts.each do |post| %> <% @posts.each do |post| %>
<div class="post"> <div class="post">
<div class="preview"> <div class="preview">

View File

@@ -1,9 +1,12 @@
<article data-comment-id="<%= comment.id %>"> <article data-comment-id="<%= comment.id %>">
<div class="author"> <div class="author">
<h1><%= link_to comment.creator_name, user_path(comment.creator_id) %></h1> <h1><%= link_to comment.creator_name, user_path(comment.creator_id) %></h1>
<time datetime="<%= comment.created_at %>"> <p>
<%= time_ago_in_words(comment.created_at) %> ago <time datetime="<%= comment.created_at %>">
</time> <%= time_ago_in_words(comment.created_at) %> ago
</time>
</p>
<p><span class="comment-score" id="score-for-comment-<%= comment.id %>"><%= pluralize comment.score, "point" %></span></p>
</div> </div>
<div class="content"> <div class="content">
<div> <div>

View File

@@ -31,7 +31,7 @@
<%= nav_link_to("My Account", user_path(CurrentUser.user)) %> <%= nav_link_to("My Account", user_path(CurrentUser.user)) %>
<% end %> <% end %>
<%= nav_link_to("Posts", posts_path) %> <%= nav_link_to("Posts", posts_path) %>
<%= nav_link_to("Comments", comments_path) %> <%= nav_link_to("Comments", comments_path(:group_by => "post")) %>
<%= nav_link_to("Notes", notes_path) %> <%= nav_link_to("Notes", notes_path) %>
<%= nav_link_to("Artists", artists_path(:order => "date")) %> <%= nav_link_to("Artists", artists_path(:order => "date")) %>
<%= nav_link_to("Tags", tags_path(:order => "date")) %> <%= nav_link_to("Tags", tags_path(:order => "date")) %>

View File

@@ -1,5 +1,5 @@
<div style="margin-bottom: 1em;"> <div style="margin-bottom: 1em;">
<% form_tag({:action => "index"}, :method => :get) do %> <% form_tag(tag_aliases_path, :method => :get) do %>
<%= text_field_tag "query", params[:query] %> <%= text_field_tag "query", params[:query] %>
<%= submit_tag "Search Aliases" %> <%= submit_tag "Search Aliases" %>
<%= submit_tag "Search Implications" %> <%= submit_tag "Search Implications" %>
@@ -12,7 +12,7 @@
<thead> <thead>
<tr> <tr>
<th width="1%"></th> <th width="1%"></th>
<th width="19%">Alias</th> <th width="19%">From</th>
<th width="20%">To</th> <th width="20%">To</th>
<th width="60%">Reason</th> <th width="60%">Reason</th>
</tr> </tr>

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +1,22 @@
$(document).ready(function() { $(document).ready(function() {
Cookie.setup(); Cookie.setup();
// $("#hide-upgrade-account-link").click(function() { // $("#hide-upgrade-account-link").click(function() {
// $("#upgrade-account").hide(); // $("#upgrade-account").hide();
// Cookie.put('hide-upgrade-account', '1', 7); // Cookie.put('hide-upgrade-account', '1', 7);
// }); // });
// Table striping // Table striping
$("table.striped tbody tr:even").addClass("even"); $("table.striped tbody tr:even").addClass("even");
$("table.striped tbody tr:odd").addClass("odd"); $("table.striped tbody tr:odd").addClass("odd");
// Comment listing // Comment listing
$(".comment-section form").hide(); $(".comment-section form").hide();
$(".comment-section input.expand-comment-response").click(function() { $(".comment-section input.expand-comment-response").click(function() {
var post_id = $(this).closest(".comment-section").attr("data-post-id"); var post_id = $(this).closest(".comment-section").attr("data-post-id");
$(".comment-section[data-post-id=" + post_id + "] form").show(); $(".comment-section[data-post-id=" + post_id + "] form").show();
$(this).hide(); $(this).hide();
}); });
// Image resize sidebar // Image resize sidebar
$("#resize-links").hide(); $("#resize-links").hide();
@@ -29,11 +29,11 @@ $(document).ready(function() {
image.attr("height", target.attr("data-height")); image.attr("height", target.attr("data-height"));
e.preventDefault(); e.preventDefault();
}); });
$("#resize-link a").click(function(e) { $("#resize-link a").click(function(e) {
$("#resize-links").toggle(); $("#resize-links").toggle();
e.preventDefault(); e.preventDefault();
}); });
}); });

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@
display: none !important; } display: none !important; }
body, div, h1, h2, h3, h4, h5, h6, p, ul, li, dd, dt { body, div, h1, h2, h3, h4, h5, h6, p, ul, li, dd, dt {
font-family: verdana, sans-serif; font-family: Verdana, Geneva, sans-serif;
font-size: 100%; font-size: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
@@ -252,6 +252,8 @@ div#c-pools div#a-edit ul.ui-sortable {
/*** Comments ***/ /*** Comments ***/
div.comments-for-post div.list-of-comments article { div.comments-for-post div.list-of-comments article {
margin-bottom: 2em; } margin-bottom: 2em; }
div.comments-for-post div.list-of-comments article span.comment-score {
color: #CCC; }
div.comments-for-post div.list-of-comments article div.author { div.comments-for-post div.list-of-comments article div.author {
width: 20%; width: 20%;
float: left; } float: left; }
@@ -263,15 +265,25 @@ div.comments-for-post div.comment-preview {
width: 40em; width: 40em;
margin-bottom: 2em; } margin-bottom: 2em; }
div.comments div.index div.preview { div#c-comments div#a-index div.header span.info {
margin-right: 1.5em; }
div#c-comments div#a-index div.header strong, div#c-comments div#a-index div.header time {
margin-right: 0.3em; }
div#c-comments div#a-index div.header time {
font-weight: bold; }
div#c-comments div#a-index div.header div.list-of-tags a {
margin-right: 0.5em; }
div#c-comments div#a-index div.header div.notices {
margin: 1em 0; }
div#c-comments div#a-index div.preview {
float: left; float: left;
width: 180px; } width: 180px; }
div.comments div.index div.post { div#c-comments div#a-index div.post {
margin-bottom: 4em; } margin-bottom: 4em; }
div.comments div.index div.post div.comments-for-post { div#c-comments div#a-index div.post div.comments-for-post {
float: left; float: left;
width: 55em; } width: 55em; }
div.comments div.index div.post div.comments-for-post h1 { div#c-comments div#a-index div.post div.comments-for-post h1 {
font-size: 1.2em; } font-size: 1.2em; }
/*** Favorites ***/ /*** Favorites ***/
@@ -342,33 +354,6 @@ div.post_histories div.index div.post {
div#unapprove-dialog p { div#unapprove-dialog p {
margin-bottom: 1em; } margin-bottom: 1em; }
/*** Comments ***/
div.comment-response > div {
margin-top: 1em; }
div.comment-list > article {
margin-bottom: 1em;
display: block; }
div.comment-list > article > header {
float: left;
width: 15em; }
div.comment-list > article > div {
float: left;
width: 40em; }
div.comments div.index div.header span.info {
margin-right: 1.5em; }
div.comments div.index div.header strong, div.comments div.index div.header time {
margin-right: 0.3em; }
div.comments div.index div.header time {
font-weight: bold; }
div.comments div.index div.header div.list-of-tags a {
margin-right: 0.5em; }
div.comments div.index div.header div.notices {
margin: 1em 0; }
/*** Sessions ***/ /*** Sessions ***/
div#sessions div#new section { div#sessions div#new section {
width: 30em; width: 30em;

View File

@@ -6,7 +6,7 @@ $link_hover_color: #9093FF;
} }
body, div, h1, h2, h3, h4, h5, h6, p, ul, li, dd, dt { body, div, h1, h2, h3, h4, h5, h6, p, ul, li, dd, dt {
font-family: verdana, sans-serif; font-family: Verdana, Geneva, sans-serif;
font-size: 100%; font-size: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
@@ -377,6 +377,10 @@ div.comments-for-post {
article { article {
margin-bottom: 2em; margin-bottom: 2em;
span.comment-score {
color: #CCC;
}
div.author { div.author {
width: 20%; width: 20%;
float: left; float: left;
@@ -396,8 +400,32 @@ div.comments-for-post {
} }
} }
div.comments { div#c-comments {
div.index { div#a-index {
div.header {
span.info {
margin-right: 1.5em;
}
strong, time {
margin-right: 0.3em;
}
time {
font-weight: bold;
}
div.list-of-tags {
a {
margin-right: 0.5em;
}
}
div.notices {
margin: 1em 0;
}
}
div.preview { div.preview {
float: left; float: left;
width: 180px; width: 180px;
@@ -559,58 +587,6 @@ div#unapprove-dialog {
} }
/*** Comments ***/
div.comment-response {
}
div.comment-response > div {
margin-top: 1em;
}
div.comment-list > article {
margin-bottom: 1em;
display: block;
}
div.comment-list > article > header {
float: left;
width: 15em;
}
div.comment-list > article > div {
float: left;
width: 40em;
}
div.comments {
div.index {
div.header {
span.info {
margin-right: 1.5em;
}
strong, time {
margin-right: 0.3em;
}
time {
font-weight: bold;
}
div.list-of-tags {
a {
margin-right: 0.5em;
}
}
div.notices {
margin: 1em 0;
}
}
}
}
/*** Sessions ***/ /*** Sessions ***/
div#sessions { div#sessions {
div#new { div#new {

View File

@@ -2,7 +2,7 @@
mkdir -p public/javascripts/compiled/posts mkdir -p public/javascripts/compiled/posts
cat public/javascripts/src/lib/jquery.min.js > public/javascripts/compiled/default.js cat public/javascripts/src/lib/jquery-1.5.1.min.js > public/javascripts/compiled/default.js
cat public/javascripts/src/lib/jquery-ui-1.8.9.custom.min.js >> public/javascripts/compiled/default.js cat public/javascripts/src/lib/jquery-ui-1.8.9.custom.min.js >> public/javascripts/compiled/default.js
cat public/javascripts/src/lib/jrails.min.js >> public/javascripts/compiled/default.js cat public/javascripts/src/lib/jrails.min.js >> public/javascripts/compiled/default.js
cat public/javascripts/src/lib/rails.js >> public/javascripts/compiled/default.js cat public/javascripts/src/lib/rails.js >> public/javascripts/compiled/default.js