From 45a9d9e34259c5f9af819519e44cb9cadf1c5931 Mon Sep 17 00:00:00 2001 From: maxwell Date: Mon, 28 Jun 2010 22:15:52 -0700 Subject: [PATCH] moved the silly destory link over a bit --- app/controllers/friends_controller.rb | 2 +- app/views/blogs/_blog.html.haml | 5 +++-- app/views/bookmarks/_bookmark.html.haml | 5 +++-- .../status_messages/_status_message.html.haml | 10 +++++----- public/stylesheets/application.css | 9 +++++++++ public/stylesheets/sass/application.sass | 10 ++++++++++ spec/lib/web_socket_spec.rb | 19 +++++++++++++++++++ 7 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 spec/lib/web_socket_spec.rb diff --git a/app/controllers/friends_controller.rb b/app/controllers/friends_controller.rb index a13c3f2e4..c39bd1d27 100644 --- a/app/controllers/friends_controller.rb +++ b/app/controllers/friends_controller.rb @@ -2,7 +2,7 @@ class FriendsController < ApplicationController before_filter :authenticate_user! def index - @friends = Friend.all + @friends = Friend.paginate :page => params[:page], :order => 'created_at DESC' end def show diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index e0f63e52d..7cb179712 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml @@ -2,10 +2,11 @@ %span.from = link_to_person post.person %b wrote a new blog post + - if mine?(post) + .destroy_link + = link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete %br %b= post.title %br = raw 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 diff --git a/app/views/bookmarks/_bookmark.html.haml b/app/views/bookmarks/_bookmark.html.haml index 88208a619..7052c6b3c 100644 --- a/app/views/bookmarks/_bookmark.html.haml +++ b/app/views/bookmarks/_bookmark.html.haml @@ -2,12 +2,13 @@ %span.from = link_to_person post.person %b shared a link + - if mine?(post) + .destroy_link + = link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete %br = post.title %a{:href => "#{post.link}"} = 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/status_messages/_status_message.html.haml b/app/views/status_messages/_status_message.html.haml index f9ec3c03b..af117e381 100644 --- a/app/views/status_messages/_status_message.html.haml +++ b/app/views/status_messages/_status_message.html.haml @@ -2,11 +2,11 @@ %span.from = link_to_person post.person = post.message + + - if mine?(post) + .destroy_link + = link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete + %div.time = link_to(how_long_ago(post), status_message_path(post)) = render "comments/comments", :post => post - - if mine?(post) - = link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete - - - diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index a2e61aa18..5c594df44 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -203,3 +203,12 @@ ul.comment_set { img#profile_picture { width: 100%; } + +.pagination a { + padding: 3px; } + +.destroy_link { + float: right; } + +#debug_info { + margin-top: 20px; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 38a71123d..fecec2b45 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -239,3 +239,13 @@ ul.comment_set img#profile_picture :width 100% + +.pagination + a + :padding 3px + +.destroy_link + :float right + +#debug_info + :margin-top 20px diff --git a/spec/lib/web_socket_spec.rb b/spec/lib/web_socket_spec.rb new file mode 100644 index 000000000..55e383a73 --- /dev/null +++ b/spec/lib/web_socket_spec.rb @@ -0,0 +1,19 @@ +require File.dirname(__FILE__) + '/../spec_helper' + + + +describe WebSocket do + it 'should prepare a view along with an objects class in json' do + + EventMachine.run { + include WebSocket + user = Factory.create(:user) + post = Factory.create(:status_message) + + json = WebSocket.view_hash(post) + json.should include post.message + + EventMachine.stop + } + end +end \ No newline at end of file