diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index fc12437f6..a74143363 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -33,12 +33,27 @@ class AlbumsController < ApplicationController end def show - @photo = Photo.new - @album = current_user.find_visible_post_by_id( params[:id] ) + @person = current_user.visible_people.find_by_person_id(params[:person_id]) if params[:person_id] + @person ||= current_user.person + + @album = :uploads if params[:id] == "uploads" + @album ||= current_user.find_visible_post_by_id(params[:id]) + unless @album render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 else - @album_photos = @album.photos + + if @album == :uploads + @album_id = nil + @album_name = "Uploads" + @album_photos = current_user.visible_posts(:_type => "Photo", :album_id => nil, :person_id => @person.id) + + else + @album_id = @album.id + @album_name = @album.name + @album_photos = @album.photos + end + respond_with @album end end diff --git a/app/views/albums/show.html.haml b/app/views/albums/show.html.haml index b8f7bc859..f997d91af 100644 --- a/app/views/albums/show.html.haml +++ b/app/views/albums/show.html.haml @@ -10,11 +10,14 @@ }); -= render 'shared/author_info', :person => @album.person, :post => @album +- if @album != :uploads + = render 'shared/author_info', :person => @person, :post => @album +- else + = render 'shared/author_info', :person => @person %ul#breadcrumb - %li= link_to "#{@album.person.profile.first_name}'s Photos", person_photos_path(@album.person) - %li= @album.name + %li= link_to "#{@person.profile.first_name}'s Photos", person_photos_path(@person) + %li= @album_name .span-19.appends-1.last @@ -25,16 +28,19 @@ .span-5.last %h2 - = @album.name + = @album_name - ="#{t('.updated')} #{how_long_ago(@album)}" + - if @album != :uploads + ="#{t('.updated')} #{how_long_ago(@album)}" - -if current_user.owns? @album - = render 'photos/new_photo', :album_id => @album.id, :aspect_id => nil - = link_to t('.edit_album'), edit_album_path(@album), :class => 'button' + -if current_user.person.id == @person.id + = render 'photos/new_photo', :album_id => @album_id, :aspect_id => "all" - .album_id{:id => @album.id, :style => "display:hidden;"} + - if @album != :uploads + = link_to t('.edit_album'), edit_album_path(@album_id), :class => 'button' - -unless current_user.owns? @album - %h4= "#{t('.by')} #{@album.person.real_name}" + .album_id{:id => @album_id, :style => "display:hidden;"} + + -unless current_user.person.id == @person.id + %h4= "#{t('.by')} #{@person.real_name}" diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index 931c23104..e2f9dc06e 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -30,6 +30,13 @@ - if @person != current_user.person && current_user.friends.include?(@person) = link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button" + %br + %br + %ul + %li= link_to 'stream', person_path(@person) + %li= link_to 'photos', person_photos_path(@person) + + .span-15.last - if @posts.count > 0 %ul#stream diff --git a/app/views/photos/index.html.haml b/app/views/photos/index.html.haml index f8de1f037..23ff5a7db 100644 --- a/app/views/photos/index.html.haml +++ b/app/views/photos/index.html.haml @@ -12,10 +12,6 @@ .span-24.last{:style=>"position:relative;"} = render 'shared/author_info', :person => @person - - .right - = link_to "+ Add photos", '#add_photo_pane', :class => "add_photo_button button" - %ul#breadcrumb %li= link_to "#{@person.profile.first_name}'s Photos", person_photos_path(@person) @@ -31,12 +27,12 @@ %div - for album in @albums = render "albums/album", :post => album + = link_to "uploads", album_path("uploads") .span-24.last %h3 Albums - .span-24.last #add_photo_pane = render "photos/new_photo", :album_id => nil, :aspect_id => :all diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index 2962cd2d6..49590e653 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -12,6 +12,8 @@ %li= link_to "#{@photo.person.profile.first_name}'s Photos", person_photos_path(@photo.person) - if !@photo.album_id.nil? %li= link_to @album.name, album_path(@album) + - else + %li= link_to "uploads", album_path("uploads") %li= @photo.caption - if @photo.album