user now has a uploads meta album for photos. fixed some view issues with photo#show, album#show

This commit is contained in:
danielvincent 2010-10-28 16:14:33 -07:00
parent a7df1bca68
commit 1d399598d3
5 changed files with 45 additions and 19 deletions

View file

@ -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

View file

@ -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}"

View file

@ -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

View file

@ -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

View file

@ -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