MS figured out how to get comments to come thru the websocket. this is super super super hacky, and kind of terrible, but it works

This commit is contained in:
maxwell 2010-06-28 17:35:38 -07:00
parent 3dce5f1b34
commit 36b5a90d34
6 changed files with 15 additions and 10 deletions

View file

@ -3,7 +3,7 @@ module StatusMessagesHelper
def my_latest_message def my_latest_message
message = StatusMessage.my_newest message = StatusMessage.my_newest
unless message.nil? unless message.nil?
return message.message + " " + how_long_ago(message) return message.message + " - " + how_long_ago(message)
else else
return "No message to display." return "No message to display."
end end

View file

@ -1,6 +1,5 @@
= form_tag("/comments",:remote => true, :class =>"new_comment", :id => "new_comment") do = form_tag("/comments", :remote => true, :class =>"new_comment", :id => "new_comment-#{post.id}") do
%p %p
= text_field_tag "comment_text", 'dislike!', :size => 30, :name => 'comment[text]' = text_field_tag "comment_text", 'dislike!', :size => 30, :name => 'comment[text]'
= hidden_field_tag "comment_post_id", "#{post.id}", :name => "comment[post_id]" = hidden_field_tag "comment_post_id", "#{post.id}", :name => "comment[post_id]"
= submit_tag 'comment', :id => "comment_submit", :name => "commit" = submit_tag 'comment', :id => "comment_submit_#{post.id}", :name => "commit"

View file

@ -8,7 +8,7 @@
= stylesheet_link_tag "blueprint/screen", :media => 'screen' = stylesheet_link_tag "blueprint/screen", :media => 'screen'
= stylesheet_link_tag "application" = stylesheet_link_tag "application"
/= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" /= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
= javascript_include_tag 'jquery142', 'rails', 'view' = javascript_include_tag 'jquery142', 'rails', 'view'
= javascript_include_tag 'tiny_mce/tiny_mce.js' = javascript_include_tag 'tiny_mce/tiny_mce.js'

View file

@ -4,7 +4,7 @@
= post.message = post.message
%div.time %div.time
= link_to(how_long_ago(post), status_message_path(post)) = link_to(how_long_ago(post), status_message_path(post))
/= render "comments/comments", :post => post = render "comments/comments", :post => post
- if mine?(post) - if mine?(post)
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete = link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete

View file

@ -11,7 +11,12 @@ module WebSocket
class << @view class << @view
include ApplicationHelper include ApplicationHelper
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers
#include ActionView::Helpers::FormTagHelper include ActionController::RequestForgeryProtection::ClassMethods
include ActionView::Helpers::FormTagHelper
include ActionView::Helpers::UrlHelper
def protect_against_forgery?
false
end
end end
end end
@ -36,13 +41,13 @@ module WebSocket
v = WebSocket.view_for(object) v = WebSocket.view_for(object)
puts v.inspect puts v.inspect
rescue Exception > e rescue Exception => e
puts "in failzord " + v.inspect puts "in failzord " + v.inspect
puts object.inspect puts object.inspect
puts e.inspect puts e.message
raise e raise e
end end
puts "i made it here"
{:class =>object.class.to_s.underscore.pluralize, :html => v} {:class =>object.class.to_s.underscore.pluralize, :html => v}
end end

View file

@ -30,6 +30,7 @@ $(document).ready(function(){
$('#bookmark_title').click(clearForm); $('#bookmark_title').click(clearForm);
$('#bookmark_link').click(clearForm); $('#bookmark_link').click(clearForm);
$('#debug_more').hide();
function clearForm(){ function clearForm(){
$(this).val(""); $(this).val("");