Revision ba788eca
Added by Marc Dequènes over 14 years ago
- ID ba788eca2972b79185a5100ab94e77febd9aa9aa
app/models/artwork.rb | ||
---|---|---|
belongs_to :artwork_size
|
||
belongs_to :artwork_condition
|
||
belongs_to :artwork_placement_reason
|
||
has_many :artwork_step_images, :order => "date ASC, id DESC"
|
||
has_many :artwork_step_images, :order => "date ASC, position ASC, id DESC"
|
||
has_and_belongs_to_many :artwork_supports, :order => "name ASC"
|
||
has_and_belongs_to_many :artwork_materials, :order => "name ASC"
|
||
|
app/models/artwork_step_image.rb | ||
---|---|---|
|
||
validates_presence_of :filename, :date, :artwork_id #, :void
|
||
validates_uniqueness_of :filename, :scope => :artwork_id
|
||
validates_numericality_of :position, :only_integer => true, :greater_than_or_equal_to => 0
|
||
validates_as_attachment
|
||
|
||
public :after_process_attachment
|
app/views/admin/artwork_step_images/_form.rhtml | ||
---|---|---|
<%=
|
||
stacking_form(f) do |table|
|
||
table.field :date, _("Date:"), :date_select
|
||
table.field :position, _("Position:"), :text_field, :value => resource_object.position || 0
|
||
table.field :uploaded_data, _("Image:"), :file_field
|
||
form_comment(table)
|
||
table.content display_standard_form_buttons(submit_label)
|
app/views/admin/artwork_step_images/index.rhtml | ||
---|---|---|
<table>
|
||
<tr>
|
||
<th><%= sortable_header :date, :label => _("Date"), :default => true %></th>
|
||
<th><%= _("Position") %></th>
|
||
<th><%= _("Preview") %></th>
|
||
<th><%= _("Actions") %></th>
|
||
</tr>
|
||
<% @artwork_step_images.each do |artwork_step_image| %>
|
||
<tr>
|
||
<td><%= artwork_step_image.date %></td>
|
||
<td><%= artwork_step_image.position %></td>
|
||
<td><%= link_to_resource artwork_step_image, display_thumbnail(artwork_step_image, :thumb_big) %></td>
|
||
<td class="actions"><%= display_standard_item_actions(artwork_step_image) %></td>
|
||
</tr>
|
Also available in: Unified diff
[cosmetic] added position number to artwork_step_images, only visible in the admin pages, to be able to change order for steps made the same day (closes #16)