show album thumbnails and photos in tag page

master
Coleman 2008-07-11 00:19:42 -05:00
parent b5142c06f1
commit 90199932e8
7 changed files with 63 additions and 72 deletions

View File

@ -10,8 +10,9 @@ class Tags < Application
raise NotFound unless @tag
@pages = @tag.pages
@albums = @tag.albums
@photos = @tag.photos
@secondary_title = "Content tagged with #{@tag.name}"
display @tag
render
end
def new

View File

@ -0,0 +1,13 @@
<% if albums.nil? or albums.empty? -%>
<p><em><strong>There were no albums found!</strong></em></p>
<% else -%>
<% albums.each_with_index do |album, index| -%>
<div class="photo_album col_<%= (index + 1) % 3 -%>">
<p><a href="<%= url(:album, :id => album.name.gsub(/ /, '_')) -%>"><%= album.name -%></a> (<%= album.photos.size -%> photos)</p>
<% if album.album_thumbnail -%><a href="<%= url(:album, :id => album.name.gsub(/ /, '_')) -%>"><img src="<%= thumbnail_photo_url(album.album_thumbnail) -%>" /></a><% end -%>
</div>
<% end -%>
<br style="clear: both" />
<% end -%>

View File

@ -0,0 +1,10 @@
<% if photos.nil? or photos.empty? %>
<p><em><strong>There were no photos found!</strong></em></p>
<% else -%>
<% photos.each_with_index do |photo, idx| -%>
<div class="photo col_<%= (idx + 1) % 3 -%>"><a href="<%= url(:photo, photo) -%>" rel="nofollow" onclick="window.open(this.href);return false;"><img src="<%= thumbnail_photo_url(photo) -%>" /></a></div>
<% if (idx + 1) % 3 == 0 or photos.last == photo -%><br style="clear:both" /><% end -%>
<% end -%>
<% end -%>

View File

@ -7,45 +7,6 @@
</div>
<% end -%>
<% throw_content :for_stylesheet do -%>
.photo_collection_item {
word-wrap: break-word;
width: 170px;
height: 200px;
margin-top: 15px;
padding: 5px;
text-align: center;
border: 1px solid #BBB;
float: left;
position: relative;
}
.col_1 {
margin-left: 10px;
}
.col_2 {
margin-left: 10px;
}
.col_0 {
margin-left: 10px;
}
<% end -%>
<% if @albums.empty? -%>
<p><em><strong>There were no albums found!</strong></em></p>
<% else -%>
<% @albums.each_with_index do |album, index| -%>
<div class="photo_collection_item col_<%= (index + 1) % 3 -%>">
<p><a href="<%= url(:album, :id => album.name.gsub(/ /, '_')) -%>"><%= album.name -%></a> (<%= album.photos.size -%> photos)</p>
<% if album.album_thumbnail -%><a href="<%= url(:album, :id => album.name.gsub(/ /, '_')) -%>"><img src="<%= thumbnail_photo_url(album.album_thumbnail) -%>" /></a><% end -%>
</div>
<% end -%>
<br style='clear:both;' />
<%= partial 'albums', :albums => @albums %>
<%= partial 'shared/pagination_links' %>
<% end -%>

View File

@ -20,34 +20,10 @@
<% end -%>
<% end -%>
<% throw_content :for_stylesheet do -%>
.photo_collection_item {
word-wrap: break-word;
max-width: 150px;
max-height: 150px;
margin-top: 15px;
margin-bottom: 15px;
padding: 3px;
border: 1px solid #BBB;
float: left;
position: relative;
}
.col_1, .col_2, .col_0 {
margin-left: 15px;
margin-right: 15px;
}
<% end -%>
<div class="hentry">
<h1><%= @album.name -%></h1>
<% @photos.each_with_index do |photo, idx| -%>
<div class="photo_collection_item col_<%= (idx + 1) % 3 -%>"><a href="<%= url(:photo, photo) -%>" rel="nofollow" onclick="window.open(this.href);return false;"><img src="<%= thumbnail_photo_url(photo) -%>" /></a></div>
<% if (idx + 1) % 3 == 0 or @photos.last == photo -%><br style="clear:both" /><% end -%>
<% end -%>
<%= partial 'photos', :photos => @photos %>
</div>
<%= partial 'shared/pagination_links' %>

View File

@ -11,8 +11,9 @@
<% end %>
<h2>Albums</h2>
<% if @albums.empty? -%>
<p><em><strong>None!</strong></em></p>
<% else -%>
<ol><%= @albums.collect { |a| "<li><a href='#{url(:album, :id => a.name.gsub(/ /, '_'))}'>#{a.name}</a></li>" }.join -%></ol>
<% end -%>
<%= partial 'albums/albums', :albums => @albums %>
<br />
<h2>Photos</h2>
<%= partial 'albums/photos', :photos => @photos %>

View File

@ -489,3 +489,32 @@
margin-left: auto;
margin-right: auto;
}
.photo_album {
word-wrap: break-word;
width: 170px;
height: 200px;
margin-top: 15px;
padding: 5px;
text-align: center;
border: 1px solid #BBB;
float: left;
position: relative;
}
.photo {
word-wrap: break-word;
max-width: 150px;
max-height: 150px;
margin-top: 15px;
margin-bottom: 15px;
padding: 3px;
border: 1px solid #BBB;
float: left;
position: relative;
}
.col_1, .col_2, .col_0 {
margin-left: 10px;
margin-right: 10px;
}