diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 876af6c6535cdbcb33de2819140c3febac816b28..83445dbdefa272abd7d105b064042a7d3e101dd6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,5 +2,4 @@ class ApplicationController < ActionController::Base protect_from_forgery :except => :receive layout 'application' - end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b9b94f28a595faff0f89e2fa371a637b725dd956..95dff0a7110d63b6df4dc861019ec769a1118a56 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -29,4 +29,7 @@ module ApplicationHelper end end + def mine?(post) + post.owner == User.first.email + end end diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index 3a3b0bfeaa4bf2aec47011c6e9a5816165b16653..810c2b74f172194e3dec12919e5917ab48abc24f 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -2,7 +2,7 @@ module DashboardHelper def type_partial(post) class_name = post.class.name.to_s.underscore - "#{class_name.pluralize}/pane" + "#{class_name.pluralize}/#{class_name}" end end diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..34b2d82648fdadad62b91e55975664c307a86685 --- /dev/null +++ b/app/views/blogs/_blog.html.haml @@ -0,0 +1,11 @@ +%li.message{:class => ("mine" if mine?(post))} + %span.from + = link_to post.owner, "#" + %b wrote a new blog post + %br + %b= post.title + %br + = post.body + %div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", blog_path(post) + - if mine?(post) + = link_to 'Destroy', blog_path(post), :confirm => 'Are you sure?', :method => :delete \ No newline at end of file diff --git a/app/views/blogs/_pane.html.haml b/app/views/blogs/_pane.html.haml deleted file mode 100644 index a5270a1b2ce0682f2b0982fed5d63b6608f9b3bf..0000000000000000000000000000000000000000 --- a/app/views/blogs/_pane.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%li.message - %span.from - = link_to post.owner, "#" - %b wrote a new blog post - %br - %b= post.title - %br - = post.body - %div.time - = "#{time_ago_in_words(post.updated_at)} ago" - diff --git a/app/views/blogs/index.html.haml b/app/views/blogs/index.html.haml index 655aa67eb376f4dcb2ace76e0b8bb8b774f7bfa1..c7aab65254f2f7779470b53139209ee67a5c70c9 100644 --- a/app/views/blogs/index.html.haml +++ b/app/views/blogs/index.html.haml @@ -2,4 +2,4 @@ %ul#stream - for blog in @blogs - = render "pane", :post => blog + = render "blog", :post => blog diff --git a/app/views/bookmarks/_bookmark.html.haml b/app/views/bookmarks/_bookmark.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..f1fcc1b4dac4c764c40b720f3036d4e7792a77ea --- /dev/null +++ b/app/views/bookmarks/_bookmark.html.haml @@ -0,0 +1,11 @@ +%li.message{:class => ("mine" if mine?(post))} + %span.from + = link_to post.owner, "#" + %b shared a link + %br + = post.title + = link_to post.link + %div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", bookmark_path(post) + - if mine?(post) + = link_to 'Destroy', bookmark_path(post), :confirm => 'Are you sure?', :method => :delete + diff --git a/app/views/bookmarks/_pane.html.haml b/app/views/bookmarks/_pane.html.haml deleted file mode 100644 index 8526bb91b12ed884007932287eddf1983699e5dc..0000000000000000000000000000000000000000 --- a/app/views/bookmarks/_pane.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%li.message - %span.from - = link_to post.owner, "#" - %b shared a link - %br - = post.title - = link_to post.link - %div.time= "#{time_ago_in_words(post.updated_at)} ago" - diff --git a/app/views/bookmarks/index.html.haml b/app/views/bookmarks/index.html.haml index 4380e370a2964713c6d0e7f3df2e4a6b861219dd..f518a2635a9d9ae6ba3d63b355ebcd569b63aac1 100644 --- a/app/views/bookmarks/index.html.haml +++ b/app/views/bookmarks/index.html.haml @@ -2,4 +2,4 @@ %ul#stream - for bookmark in @bookmarks - = render "pane", :post => bookmark + = render "bookmark", :post => bookmark diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 856c72e998859dc4c77a6fe41e9e227d63408a9f..deab8559ad4b499b7b4ad2714a21c2b5b6eabbb9 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,6 +1,5 @@ !!! %html - %head %title = yield(:title) || "Untitled" @@ -11,7 +10,7 @@ = javascript_include_tag 'jquery142' /= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" = javascript_include_tag 'rails' - = javascript_include_tag 'socket' + = javascript_include_tag 'socket' if user_signed_in? = csrf_meta_tag = yield(:head) @@ -28,7 +27,6 @@ $(this).fadeTo(80, 1); }); }); - %body %header diff --git a/app/views/status_messages/_pane.html.haml b/app/views/status_messages/_pane.html.haml deleted file mode 100644 index f523dc7039722f41636ecbdd80718c971cc6ae87..0000000000000000000000000000000000000000 --- a/app/views/status_messages/_pane.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%li.message - %span.from - = link_to post.owner, "#" - = post.message - %div.time - = "#{time_ago_in_words(post.updated_at)} ago" - diff --git a/app/views/status_messages/_status_message.html.haml b/app/views/status_messages/_status_message.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..bfe97c67889435648cc530f4b75215fe0bf113af --- /dev/null +++ b/app/views/status_messages/_status_message.html.haml @@ -0,0 +1,11 @@ +%li.message{:class => ("mine" if mine?(post))} + %span.from + = link_to post.owner, "#" + = post.message + %div.time + = "#{time_ago_in_words(post.updated_at)} ago" + - if mine?(post) + = link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete + + + diff --git a/app/views/status_messages/index.html.haml b/app/views/status_messages/index.html.haml index c6518c4d385975661d10806121c785974eb786f8..940352f06bd5a41ccdbe5cff0112276585de981e 100644 --- a/app/views/status_messages/index.html.haml +++ b/app/views/status_messages/index.html.haml @@ -1,5 +1,5 @@ %h1.big_text= link_to "new status message", new_status_message_path %ul#stream - for status_message in @status_messages - = render "pane", :post => status_message + = render "status_message", :post => status_message diff --git a/config/initializers/socket.rb b/config/initializers/socket.rb index 8e1193f3e4dcdb3f4127dd0c413fdecba41d7d29..a9ed0e9b589d86c9a4b77bae0781efa7566bc7ae 100644 --- a/config/initializers/socket.rb +++ b/config/initializers/socket.rb @@ -7,16 +7,13 @@ module WebSocket EM.next_tick { EM.add_timer(0.1) do - #puts "channel set" @channel = EM::Channel.new end EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) do |ws| ws.onopen { sid = @channel.subscribe { |msg| ws.send msg } - #@channel.push "#{sid} connectdfged!" - puts @channel.inspect - + ws.onmessage { |msg| @channel.push "#{msg}" } @@ -30,10 +27,7 @@ module WebSocket } #this should get folded into message queue i think? def self.update_clients(json) - #EM.add_timer(5) do - #puts @channel - @channel.push json - #end + @channel.push(json) if @channel end end diff --git a/config/routes.rb b/config/routes.rb index 54f48a4ffb7dcb2cdf39fde797af66f5a8b574ae..ec7eab734fa91361f52e159ee32a48b56e7d5ce4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,6 @@ Diaspora::Application.routes.draw do |map| resources :bookmarks resources :friends resources :status_messages - resources :status_messages #routes for devise, not really sure you will need to mess with this in the future, lets put default, #non mutable stuff in anohter file diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index c4d8f9a0af521defee10e5dfe8965f749b55d3b3..83689858224c93c5f82d4cc79a9955330edc45f6 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -131,7 +131,8 @@ li.message { line-height: 140%; font-size: 120%; font-family: "Lucida Grande"; - color: #999999; } + color: #999999; + margin-bottom: 5px; } li.message span.from { color: black; font-weight: bold; @@ -140,6 +141,9 @@ li.message { color: #bababa; font-size: 70%; } +.mine { + background-color: rgba(202, 237, 204, 0.5); } + h1 { position: relative; font-size: 24px; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index d4c837e00fb5a8062cbb29fc41b21bb7212d845b..e6b4dde8771fd7a725ca3c6a086926bd9859b31e 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -158,6 +158,7 @@ li.message :size 120% :family 'Lucida Grande' :color #999 + :margin-bottom 5px span.from :color #000 @@ -169,6 +170,8 @@ li.message div.time :color #bababa :font-size 70% +.mine + :background-color rgba(202, 237, 204, 0.5) h1 :position relative