Project

General

Profile

« Previous | Next » 

Revision 33c93671

Added by Marc Dequènes over 14 years ago

  • ID 33c93671e7aca8988443063c986223fa036d6fba

[cosmetic] display groups in a set into a light blue cell, like in the tree (closes #18), and btw improved CSS handling a bit (unfinished)

View differences:

app/helpers/application_helper.rb
with_link = params.has_key?(:with_link) ? params[:with_link] : true
image_padding = params.has_key?(:image_padding) ? params[:image_padding] : 5
frame_margin = params.has_key?(:frame_margin) ? params[:frame_margin] : 3
classes = params.has_key?(:classes) ? params[:classes].to_a : []
thumb = image.thumbnail(size)
frame_width = thumb.width + image_padding * 2
style = "text-align: center; padding: 0px; width: #{frame_width}px;"
style = "width: #{frame_width}px;"
#style += " border: 1px solid red;"
case frame_type
when :classic
......
style += " margin: #{frame_margin}px; display: inline-block;"
end
html = "<div class=\"image_frame\" style=\"" + style + "\">"
classes << "image_frame" unless classes.member? "image_frame"
html = "<div class=\"#{classes.join(" ")}\" style=\"" + style + "\">"
html += "<div style=\"padding: #{image_padding}px #{image_padding}px 0; margin: 0px;\">" + display_thumbnail(image, size) + "</div>"
html += "<div>"
infos = []
app/views/view/set.rhtml
<p>
<% @artwork_set.artworks.each do |artwork| %>
<% next if artwork.artwork_group %>
<%= display_image_frame(artwork.image, :frame_type => :float, :size => :thumb_small, :display_size => false) %>
<%= display_image_frame(artwork.image, :frame_type => :float, :size => :thumb_small, :display_size => false, :classes => "artwork") %>
<% end %>
<br style="clear: both;"/>
</p>
<h2><%= _("Groups:") %></h2>
<p>
<table>
<% @artwork_set.artwork_groups.each do |group| %>
<%= link_to(display_image_frame(group.artworks.last.image, :frame_type => :float, :size => :thumb_small, :force_title => group.name, :display_size => false, :with_link => false), :controller => '/view', :action => 'group', :id => group.id) %>
<td><%= link_to(display_image_frame(group.artworks.last.image, :frame_type => :cell, :size => :thumb_small, :force_title => group.name, :display_size => false, :with_link => false, :classes => "group"), :controller => '/view', :action => 'group', :id => group.id) %></td>
<% end %>
<br style="clear: both;"/>
</p>
</table>
app/views/view/tree.rhtml
<table>
<% ArtworkSet.find(:all, :order => 'name ASC').each do |set| %>
<tr><th><%= link_to(display_image_frame(set.artworks.last.image, :frame_type => :cell, :size => :thumb_small, :force_title => set.name, :display_size => false, :with_link => false), :controller => '/view', :action => 'set', :id => set.id) %></th>
<tr><th><%= link_to(display_image_frame(set.artworks.last.image, :frame_type => :cell, :size => :thumb_small, :force_title => set.name, :display_size => false, :with_link => false, :classes => "set"), :controller => '/view', :action => 'set', :id => set.id) %></th>
<% unless set.artwork_groups.empty? %>
<% set.artwork_groups.each do |group| %>
<td><%= link_to(display_image_frame(group.artworks.last.image, :frame_type => :cell, :size => :thumb_small, :force_title => group.name, :display_size => false, :with_link => false), :controller => '/view', :action => 'group', :id => group.id) %></td>
<td><%= link_to(display_image_frame(group.artworks.last.image, :frame_type => :cell, :size => :thumb_small, :force_title => group.name, :display_size => false, :with_link => false, :classes => "group"), :controller => '/view', :action => 'group', :id => group.id) %></td>
<% end %>
<% end %>
</tr>
public/stylesheets/default.css
text-align: center;
}
.image_frame {
text-align: center;
padding: 0px;
}
.artwork {
}
.group {
background-color: #F5F5F5;
}
.set {
background-color: #E6E6FA;
}

Also available in: Unified diff