Skip to content
Extraits de code Groupes Projets
Valider 74691228 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

RS, IZ; All relevant controllers now create with user.post

parent 9fe37b1d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -6,10 +6,9 @@ class AlbumsController < ApplicationController ...@@ -6,10 +6,9 @@ class AlbumsController < ApplicationController
end end
def create def create
@album = Album.new(params[:album]) @album = current_user.post(:album, params[:album])
@album.person = current_user
if @album.save if @album.created_at
flash[:notice] = "Successfully created album." flash[:notice] = "Successfully created album."
redirect_to @album redirect_to @album
else else
...@@ -47,4 +46,5 @@ class AlbumsController < ApplicationController ...@@ -47,4 +46,5 @@ class AlbumsController < ApplicationController
render :action => 'edit' render :action => 'edit'
end end
end end
end end
...@@ -21,9 +21,9 @@ class BlogsController < ApplicationController ...@@ -21,9 +21,9 @@ class BlogsController < ApplicationController
end end
def create def create
@blog = Blog.new(params[:blog]) @blog = current_user.post(:blog, params[:blog])
@blog.person = current_user
if @blog.save if @blog.created_at
flash[:notice] = "Successfully created blog." flash[:notice] = "Successfully created blog."
redirect_to @blog redirect_to @blog
else else
......
...@@ -31,9 +31,9 @@ class BookmarksController < ApplicationController ...@@ -31,9 +31,9 @@ class BookmarksController < ApplicationController
end end
def create def create
@bookmark = Bookmark.new(params[:bookmark]) @bookmark = current_user.post(:bookmark, params[:bookmark])
@bookmark.person = current_user
if @bookmark.save if @bookmark.created_at
flash[:notice] = "Successfully created bookmark." flash[:notice] = "Successfully created bookmark."
redirect_to @bookmark redirect_to @bookmark
else else
......
...@@ -3,11 +3,9 @@ class PhotosController < ApplicationController ...@@ -3,11 +3,9 @@ class PhotosController < ApplicationController
def create def create
begin begin
#puts params.inspect @photo = current_user.post(:photo, params)
@photo = Photo.instantiate(params)
@photo.person = current_user
if @photo.save if @photo.created_at
flash[:notice] = "Successfully uploaded photo." flash[:notice] = "Successfully uploaded photo."
redirect_to @photo.album redirect_to @photo.album
else else
......
...@@ -13,10 +13,9 @@ class StatusMessagesController < ApplicationController ...@@ -13,10 +13,9 @@ class StatusMessagesController < ApplicationController
end end
def create def create
@status_message = StatusMessage.new(params[:status_message]) @status_message = current_user.post(:status_message, params[:status_message])
@status_message.person = current_user
if @status_message.save if @status_message.created_at
flash[:notice] = "Successfully created status message." flash[:notice] = "Successfully created status message."
redirect_to status_messages_url redirect_to status_messages_url
else else
......
...@@ -20,6 +20,10 @@ class Album ...@@ -20,6 +20,10 @@ class Album
after_save :notify_people after_save :notify_people
before_destroy :propagate_retraction before_destroy :propagate_retraction
def instantiate params
self.create params
end
def self.mine_or_friends(friend_param, current_user) def self.mine_or_friends(friend_param, current_user)
if friend_param if friend_param
Album.where(:person_id.ne => current_user.id) Album.where(:person_id.ne => current_user.id)
......
...@@ -173,9 +173,10 @@ form { ...@@ -173,9 +173,10 @@ form {
color: black; } color: black; }
#user_name span { #user_name span {
size: small; size: small;
font-style: italic;
font-weight: normal; font-weight: normal;
color: #999999; } color: #999999; }
#user_name #latest_message_time {
font-style: italic; }
#user_name ul { #user_name ul {
display: inline; display: inline;
margin: 0; margin: 0;
......
...@@ -207,11 +207,11 @@ form ...@@ -207,11 +207,11 @@ form
span span
:size small :size small
:font-style italic
:font :font
:weight normal :weight normal
:color #999 :color #999
#latest_message_time
:font-style italic
ul ul
:display inline :display inline
:margin 0 :margin 0
......
...@@ -14,7 +14,6 @@ describe Post do ...@@ -14,7 +14,6 @@ describe Post do
it "should associate the owner if none is present" do it "should associate the owner if none is present" do
@post.person.should == User.owner @post.person.should == User.owner
end end
end end
describe "newest" do describe "newest" do
......
...@@ -10,7 +10,6 @@ describe User do ...@@ -10,7 +10,6 @@ describe User do
describe 'friend requesting' do describe 'friend requesting' do
before do before do
@user = Factory.create(:user) @user = Factory.create(:user)
end end
it "should be able to accept a pending friend request" do it "should be able to accept a pending friend request" do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter