diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 5ce599035..2fb5ac47f 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -6,10 +6,9 @@ class AlbumsController < ApplicationController end def create - @album = Album.new(params[:album]) - @album.person = current_user + @album = current_user.post(:album, params[:album]) - if @album.save + if @album.created_at flash[:notice] = "Successfully created album." redirect_to @album else @@ -47,4 +46,5 @@ class AlbumsController < ApplicationController render :action => 'edit' end end + end diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index e7461cedc..21e25d8c5 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -21,9 +21,9 @@ class BlogsController < ApplicationController end def create - @blog = Blog.new(params[:blog]) - @blog.person = current_user - if @blog.save + @blog = current_user.post(:blog, params[:blog]) + + if @blog.created_at flash[:notice] = "Successfully created blog." redirect_to @blog else diff --git a/app/controllers/bookmarks_controller.rb b/app/controllers/bookmarks_controller.rb index d22e934c2..523cda326 100644 --- a/app/controllers/bookmarks_controller.rb +++ b/app/controllers/bookmarks_controller.rb @@ -31,9 +31,9 @@ class BookmarksController < ApplicationController end def create - @bookmark = Bookmark.new(params[:bookmark]) - @bookmark.person = current_user - if @bookmark.save + @bookmark = current_user.post(:bookmark, params[:bookmark]) + + if @bookmark.created_at flash[:notice] = "Successfully created bookmark." redirect_to @bookmark else diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 4bf54cbf4..700812469 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -3,11 +3,9 @@ class PhotosController < ApplicationController def create begin - #puts params.inspect - @photo = Photo.instantiate(params) - @photo.person = current_user + @photo = current_user.post(:photo, params) - if @photo.save + if @photo.created_at flash[:notice] = "Successfully uploaded photo." redirect_to @photo.album else diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 356612181..cf5ee7f63 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -13,10 +13,9 @@ class StatusMessagesController < ApplicationController end def create - @status_message = StatusMessage.new(params[:status_message]) - @status_message.person = current_user + @status_message = current_user.post(:status_message, params[:status_message]) - if @status_message.save + if @status_message.created_at flash[:notice] = "Successfully created status message." redirect_to status_messages_url else diff --git a/app/models/album.rb b/app/models/album.rb index 14aa95778..5a2e2a3f3 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -20,6 +20,10 @@ class Album after_save :notify_people before_destroy :propagate_retraction + def instantiate params + self.create params + end + def self.mine_or_friends(friend_param, current_user) if friend_param Album.where(:person_id.ne => current_user.id) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index e08ee09eb..e0216a151 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -173,9 +173,10 @@ form { color: black; } #user_name span { size: small; - font-style: italic; font-weight: normal; color: #999999; } + #user_name #latest_message_time { + font-style: italic; } #user_name ul { display: inline; margin: 0; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 022e5f415..f4ae31d10 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -207,11 +207,11 @@ form span :size small - :font-style italic :font :weight normal :color #999 - + #latest_message_time + :font-style italic ul :display inline :margin 0 diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 96b271861..aac4898aa 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -14,7 +14,6 @@ describe Post do it "should associate the owner if none is present" do @post.person.should == User.owner end - end describe "newest" do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e9640d07a..01b0365be 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -10,7 +10,6 @@ describe User do describe 'friend requesting' do before do @user = Factory.create(:user) - end it "should be able to accept a pending friend request" do