diff --git a/app/models/post.rb b/app/models/post.rb index 0aba899181674a9ecc28a0f8497e311775409c2d..683083b30e3101f03611935aea133ab8b0d00fe2 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -5,6 +5,7 @@ class Post include ROXML include Diaspora::Webhooks + xml_accessor :_id key :person_id, ObjectId belongs_to :person, :class_name => 'Person' diff --git a/app/models/status_message.rb b/app/models/status_message.rb index 195d5a73ee036f20a0f0cad15ebd5bcc8d74b474..96c9c689e4389f0c587c61e51a6b52b94d29e8a9 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -3,7 +3,7 @@ class StatusMessage < Post xml_name :status_message xml_accessor :message - + key :message, String diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index 366f5ad85907674442db0453241f51dcc51c186a..e0f63e52d362eb627faa9dda3f4415c9395f79c1 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml @@ -1,4 +1,4 @@ -%li.message{:class => ("mine" if mine?(post))} +%li.message{:id => post.id, :class => ("mine" if mine?(post))} %span.from = link_to_person post.person %b wrote a new blog post diff --git a/app/views/bookmarks/_bookmark.html.haml b/app/views/bookmarks/_bookmark.html.haml index 03fd47c0f603d1d3388e7b59c548f8f095f8fe13..88208a6195d26ece90e7ba343bb4ef2cfd1d5a22 100644 --- a/app/views/bookmarks/_bookmark.html.haml +++ b/app/views/bookmarks/_bookmark.html.haml @@ -1,4 +1,4 @@ -%li.message{:class => ("mine" if mine?(post))} +%li.message{:id => post.id, :class => ("mine" if mine?(post))} %span.from = link_to_person post.person %b shared a link diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index 74c1f3c6bab598541b97e67d3189c6090898cfa2..3cf43c7234b6c1c099325461efcbcc86d0a66e94 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -1,4 +1,4 @@ -%li.comment +%li.comment{:id => comment.id} %span.from = link_to_person comment.person = comment.text diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0a5ad669c9f90e4edc89d3fa3ae7648d42f4a639..a6fde39eabc5f6fc31226522ea49af4c1f84731d 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -33,18 +33,12 @@ if((location.href.indexOf(obj['class']) != -1 ) || (location.pathname == '/')) { $("#stream").prepend($(obj['html']).fadeIn("fast")); }; - } - ws.onclose = function() { debug("socket closed"); }; - ws.onopen = function() { - debug("connected..."); - }; - - - $('#show_filters').hover( function() { - $("#stream_filters").fadeIn(80); - }, - function() { - $("#stream_filters").fadeOut(100); + } + ws.onclose = function() { debug("socket closed"); }; + ws.onopen = function() { + ws.send(location.pathname); + debug("connected..."); + }; }); }); %body diff --git a/app/views/status_messages/_status_message.html.haml b/app/views/status_messages/_status_message.html.haml index d1c6611c132095c80cefafe87d6b638aafe99ea5..a0dc4336be8d41e1efdd4edb26acf95c1cc5a251 100644 --- a/app/views/status_messages/_status_message.html.haml +++ b/app/views/status_messages/_status_message.html.haml @@ -1,4 +1,4 @@ -%li.message{:class => ("mine" if mine?(post))} +%li.message{:id => post.id, :class => ("mine" if mine?(post))} %span.from = link_to_person post.person = post.message diff --git a/config/initializers/socket.rb b/config/initializers/socket.rb index 9e6d7ff59c2e92cb37aa02ef752949c3975af285..de5eb3f3c1231e736d8f4024ff1c97e5b7da98c4 100644 --- a/config/initializers/socket.rb +++ b/config/initializers/socket.rb @@ -13,11 +13,11 @@ module WebSocket end end - EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) do |ws| + EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug =>false) do |ws| ws.onopen { sid = @channel.subscribe { |msg| ws.send msg } - ws.onmessage { |msg| @channel.push msg} + ws.onmessage { |msg|}#@channel.push msg; puts msg} ws.onclose { @channel.unsubscribe(sid) } } @@ -29,10 +29,12 @@ module WebSocket end def self.view_hash(object) - {:class =>object.class.to_s.underscore.pluralize, :html => WebSocket.view_for(object)} + v = WebSocket.view_for(object) + puts v + {:class =>object.class.to_s.underscore.pluralize, :html => v} end def self.view_for(object) - @view.render(:partial => @view.type_partial(object), :locals => {:post => object}) + @view.render @view.type_partial(object), :post => object end -end \ No newline at end of file +end