diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 5ce5990355d12095d4e8a14af94dbfbcf9d95c41..2fb5ac47f41b3c52574a882f260c9fc2e9b4fbfb 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 e7461cedc89803557057b624ad6f6fff7b44d6c2..21e25d8c51d3b32fa39294e411b9ea85daf6680d 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 d22e934c21a8d7343648fa30f3473ccf537b21c5..523cda3267d989a8bed5d6e407e903dd16f8b4e9 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 4bf54cbf48876b8bbae2b588c4fe7f4de3fd511c..7008124690fb2ac2220524ee16a835b6c2c84895 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 356612181b8d25316ca2b4974146f61ee38df3f0..cf5ee7f63f144f162d786df086c480c3374fe6c5 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 14aa957789bf1ecf63fba994a9348a5a5072adcf..5a2e2a3f327739198c3037ab107870ecd80d3ac6 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 e08ee09ebda970441168d5ef07f121b9c0533b24..e0216a151c2662c1afc0770672d36d06e991951e 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 022e5f415ce85cc114ef1c90ea3302f87ac077b0..f4ae31d1099cb9181e4d2a305ebccc1e1b6b8eb5 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 96b2718612569bedf3da75814a2ecac2ea69ad88..aac4898aa01c5f54d74c37c5daeacfe13e87e1bd 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 e9640d07adc1d066fd935f81806975e7ac54a7e4..01b0365be071eaae461ba5db8d01ca44b5e39c6c 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