Project

General

Profile

« Previous | Next » 

Revision 8ff59b90

Added by Marc Dequènes over 15 years ago

  • ID 8ff59b90e699695c175ab594a2687ef11878682d

[evol] added artwork view and now use the new image frame in all views

View differences:

app/controllers/view_controller.rb
class ViewController < ApplicationController
def artwork
@artwork = Artwork.find(params[:id])
end
def set
@artwork_set = ArtworkSet.find(params[:id])
end
app/views/view/artwork.rhtml
<h1><%= sprintf(_("View of artwork '%s'"), @artwork.title) %></h1>
<div style="float: right;">
<h2><%= _("Steps") %></h2>
<table>
<% @artwork.artwork_step_images.each do |step| %>
<tr>
<td><%= display_image_frame(step, :size => :thumb_small, :display_size => false, :display_title => false, :with_link => false) %></td>
<td><%= step.date %></td>
<tr>
<% end %>
</table>
</div>
<p>
<%= sprintf(_("This artwork is part of the '%s' set"), link_to(@artwork.artwork_set.name, :action => 'set', :id => @artwork.artwork_set.id)) %>
<% if @artwork.artwork_group %>
<br />
<%= sprintf(_("This artwork is part of the '%s' group"), link_to(@artwork.artwork_group.name, :action => 'group', :id => @artwork.artwork_group.id)) %>
<% end %>
</p>
<%= display_image_frame(@artwork.image, :size => :thumb_big, :with_link => false) %>
app/views/view/group.rhtml
<h2><%= _("Artworks:") %></h2>
<p>
<% @artwork_group.artworks.each do |artwork| %>
<%= display_artwork_frame(artwork, :frame_type => :float, :size => :thumb_small, :display_size => false) %>
<%= display_image_frame(artwork.image, :frame_type => :float, :size => :thumb_small, :display_size => false) %>
<% end %>
<br style="clear: both;"/>
</p>
app/views/view/set.rhtml
<h2><%= _("Groups:") %></h2>
<p>
<% @artwork_set.artwork_groups.each do |group| %>
<%= link_to(display_artwork_frame(group.artworks.last, :frame_type => :float, :size => :thumb_small, :force_title => group.name, :display_size => false), :action => 'group', :id => group.id) %>
<%= 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) %>
<% end %>
<br style="clear: both;"/>
</p>
......
<h2><%= _("Artworks:") %></h2>
<p>
<% @artwork_set.artworks.each do |artwork| %>
<%= display_artwork_frame(artwork, :frame_type => :float, :size => :thumb_small, :display_size => false) %>
<% next if artwork.artwork_group %>
<%= display_image_frame(artwork.image, :frame_type => :float, :size => :thumb_small, :display_size => false) %>
<% end %>
<br style="clear: both;"/>
</p>
app/views/view/tree.rhtml
<table>
<% ArtworkSet.find(:all, :order => 'name ASC').each do |set| %>
<tr><th><%= link_to(display_artwork_frame(set.artworks.last, :frame_type => :cell, :size => :thumb_small, :force_title => set.name, :display_size => false), :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), :controller => '/view', :action => 'set', :id => set.id) %></th>
<% unless set.artwork_groups.empty? %>
<% set.artwork_groups.each do |group| %>
<td><%= link_to(display_artwork_frame(group.artworks.last, :frame_type => :cell, :size => :thumb_small, :force_title => group.name, :display_size => false), :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), :controller => '/view', :action => 'group', :id => group.id) %></td>
<% end %>
<% end %>
</tr>
app/views/welcome/index.rhtml
# reload to ensure joint objects are well loaded
artwork = Artwork.find(artwork.id)
%>
<%= display_artwork_frame(artwork, :frame_type => :float) %>
<%= display_image_frame(artwork.image, :frame_type => :float) %>
<% end %>
<br style="clear: both;"/>
</p>

Also available in: Unified diff