diff --git a/app/controllers/friends_controller.rb b/app/controllers/friends_controller.rb index a13c3f2e496d4bc083f8b27e71a086f4d11808f4..c39bd1d27cbee4d300ca019b5663b1f617dd0825 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 e0f63e52d362eb627faa9dda3f4415c9395f79c1..7cb179712580c86b5cf856aa2465d5c15434790b 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 88208a6195d26ece90e7ba343bb4ef2cfd1d5a22..7052c6b3cdc10a242d6bdebb316f13a5410f5043 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 f9ec3c03bf894b97d5f65fbbda4c53eb0e477c36..af117e38198001ed7427b5c3a6925f57371af3f1 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 a2e61aa183eab7033764bc79160bece5c4645c15..5c594df44e378c79a38dc711a1db304a69ea6bfe 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 38a71123d4317940996bf91bd725cf8d7b6d67b9..fecec2b452cf2cc8f26fbeb755907e54e5222da7 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 0000000000000000000000000000000000000000..55e383a7324012f2ab8f30833df0112ce30adf24 --- /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