Fix contentUpdater spec, adjust migration and fix a couple of the js viwes

This commit is contained in:
Raphael Sofaer 2011-07-11 16:17:11 -07:00
parent a7d8535d36
commit 8f50c622fa
10 changed files with 22 additions and 17 deletions

View file

@ -4,7 +4,7 @@
class SessionsController < Devise::SessionsController
after_filter :enqueue_update, :only => :create
#after_filter :enqueue_update, :only => :create
protected
def enqueue_update

View file

@ -5,7 +5,7 @@
- unless comments_expanded
%ul.show_comments{:class => ("hidden" if post.comments.size <= 3)}
%li
%b= comment_toggle( post)
= comment_toggle( post)
%ul.comments{:id => post.id, :class => ('loaded' if post.comments.size <= 3)}
-if post.comments.size > 3 && !comments_expanded
@ -14,5 +14,5 @@
= render :partial => 'comments/comment', :collection => post.comments, :locals => {:post => post}
- unless @commenting_disabled
.new_comment_form_wrapper{:class => ( 'hidden' if post.comments.size == 0)}
.new_comment_form_wrapper{:class => ('hidden' if post.comments.size == 0)}
= new_comment_form(post.id, current_user)

View file

@ -5,7 +5,10 @@
.likes_container
- if likes_count > 0
= image_tag('icons/heart.svg')
= link_to t('likes.likes.people_like_this', :count => likes_count), post_likes_path(target_id), :class => "expand_likes"
- if defined?(likes_index_link) && likes_index_link
= link_to t('likes.likes.people_like_this', :count => likes_count), post_likes_path(target_id), :class => "expand_likes"
- else
= t('likes.likes.people_like_this', :count => likes_count)
%span.hidden.likes_list
/= render 'likes/likes', :likes => likes

View file

@ -1,3 +1,3 @@
var target = $(".stream_element[data-guid=<%= escape_javascript(@post.id.to_s) %>]")
var target = $("#<%= @post.guid %>")
target.find(".sm_body").toggleClass("hidden");
target.find(".undo_text").toggleClass("hidden");

View file

@ -1,2 +1,2 @@
var target = $(".stream_element[data-guid=<%= escape_javascript(@post.id.to_s) %>]")
var target = $("#<%= @post.guid %>")
target.hide('blind', { direction: 'vertical' }, 300, function(){ target.remove() });

View file

@ -55,7 +55,7 @@
·
= link_to t('comments.new_comment.comment'), '#', :class => 'focus_comment_textarea'
.likes
= render "likes/likes_container", :target_id => post.id, :likes_count => post.likes_count, :current_user => current_user
.likes.on_post
= render "likes/likes_container", :target_id => post.id, :likes_count => post.likes_count, :current_user => current_user, :likes_index_link => true
= render "comments/comments", :post => post, :current_user => current_user, :commenting_disabled => (defined?(@commenting_disabled) && @commenting_disabled)

View file

@ -3,7 +3,7 @@ class LikesOnComments < ActiveRecord::Migration
def self.up
remove_foreign_key :likes, :posts
add_column :likes, :target_type, :string, :null => false
add_column :likes, :target_type, :string, :limit => 60, :null => false
rename_column :likes, :post_id, :target_id
add_column :comments, :likes_count, :integer, :default => 0, :null => false

View file

@ -110,7 +110,7 @@ ActiveRecord::Schema.define(:version => 20110707234802) do
add_index "invitations", ["sender_id"], :name => "index_invitations_on_sender_id"
create_table "likes", :force => true do |t|
t.boolean "positive", :default => true
t.boolean "positive", :default => true
t.integer "target_id"
t.integer "author_id"
t.string "guid"
@ -118,7 +118,7 @@ ActiveRecord::Schema.define(:version => 20110707234802) do
t.text "parent_author_signature"
t.datetime "created_at"
t.datetime "updated_at"
t.string "target_type", :null => false
t.string "target_type", :limit => 60, :null => false
end
add_index "likes", ["author_id"], :name => "likes_author_id_fk"

View file

@ -6,7 +6,7 @@
var ContentUpdater = {
addPostToStream: function(html) {
var streamElement = $(html);
var postGUID = streamElement.id;
var postGUID = $(streamElement).attr('id');
if($("#"+postGUID).length === 0) {
if($("#no_posts").length) {
@ -31,5 +31,5 @@ var ContentUpdater = {
.html(html)
.fadeIn("fast");
}
};

View file

@ -667,6 +667,7 @@ form.new_comment
:display inline-block
.comment
.likes,
.likes_container
:display inline
@ -2221,6 +2222,11 @@ ul.show_comments
:border
:top 1px dotted #aaa
ul.show_comments,
.likes_container
a
:color #999
.likes_container
:margin
:bottom -4px
@ -2228,10 +2234,6 @@ ul.show_comments
ul.show_comments,
.likes_container
a
:font
:weight bold
img
:position relative
:top 2px