Project

General

Profile

« Previous | Next » 

Revision ba788eca

Added by Marc Dequènes over 12 years ago

  • ID ba788eca2972b79185a5100ab94e77febd9aa9aa

[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)

View differences:

app/models/artwork.rb
4 4
  belongs_to :artwork_size
5 5
  belongs_to :artwork_condition
6 6
  belongs_to :artwork_placement_reason
7
  has_many :artwork_step_images, :order => "date ASC, id DESC"
7
  has_many :artwork_step_images, :order => "date ASC, position ASC, id DESC"
8 8
  has_and_belongs_to_many :artwork_supports, :order => "name ASC"
9 9
  has_and_belongs_to_many :artwork_materials, :order => "name ASC"
10 10

  
app/models/artwork_step_image.rb
10 10

  
11 11
  validates_presence_of :filename, :date, :artwork_id #, :void
12 12
  validates_uniqueness_of :filename, :scope => :artwork_id
13
  validates_numericality_of :position, :only_integer => true, :greater_than_or_equal_to => 0
13 14
  validates_as_attachment
14 15

  
15 16
  public :after_process_attachment
app/views/admin/artwork_step_images/_form.rhtml
5 5
<%=
6 6
stacking_form(f) do |table|
7 7
  table.field :date, _("Date:"), :date_select
8
  table.field :position, _("Position:"), :text_field, :value => resource_object.position || 0
8 9
  table.field :uploaded_data, _("Image:"), :file_field
9 10
  form_comment(table)
10 11
  table.content display_standard_form_buttons(submit_label)
app/views/admin/artwork_step_images/index.rhtml
13 13
  <table>
14 14
    <tr>
15 15
      <th><%= sortable_header :date, :label => _("Date"), :default => true %></th>
16
      <th><%= _("Position") %></th>
16 17
      <th><%= _("Preview") %></th>
17 18
      <th><%= _("Actions") %></th>
18 19
    </tr>
19 20
    <% @artwork_step_images.each do |artwork_step_image| %>
20 21
    <tr>
21 22
      <td><%= artwork_step_image.date %></td>
23
      <td><%= artwork_step_image.position %></td>
22 24
      <td><%= link_to_resource artwork_step_image, display_thumbnail(artwork_step_image, :thumb_big) %></td>
23 25
      <td class="actions"><%= display_standard_item_actions(artwork_step_image) %></td>
24 26
    </tr>

Also available in: Unified diff