Project

General

Profile

« Previous | Next » 

Revision 3807b362

Added by Marc Dequènes over 12 years ago

  • ID 3807b362f44c00b771ed8ed5b4da60799752825b

[evol] an artwork can have multiple materials

View differences:

TODO
1 1

  
2 2
Application:
3
- add created_by/updated_by support
3 4

  
4 5
Framework:
5 6
- finish restful_support rework (response handler at least)
app/models/artwork.rb
1 1
class Artwork < ActiveRecord::Base
2 2
  belongs_to :artwork_set
3 3
  belongs_to :artwork_group
4
  belongs_to :artwork_material
5 4
  belongs_to :artwork_size
6 5
  belongs_to :artwork_condition
7 6
  belongs_to :artwork_placement_reason
8 7
  has_many :artwork_step_images, :order => "date ASC"
9 8
  has_and_belongs_to_many :artwork_supports, :order => "name ASC"
9
  has_and_belongs_to_many :artwork_materials, :order => "name ASC"
10 10

  
11
  validates_presence_of :title, :artwork_material_id, :artwork_size_id, :artwork_condition_id
11
  validates_presence_of :title, :artwork_size_id, :artwork_condition_id
12 12
  validates_uniqueness_of :title
13 13
  validates_length_of :title, :within => 1..256, :allow_blank => true
14 14
  validates_length_of :placement_location, :within => 1..256, :allow_blank => true
15
  validates_associated :artwork_set, :artwork_group, :artwork_material, :artwork_size, :artwork_condition
15
  validates_associated :artwork_set, :artwork_group, :artwork_size, :artwork_condition
16 16

  
17 17
  before_save {|model| model.artwork_group = nil if model.artwork_set.nil? }
18 18

  
app/models/artwork_material.rb
1 1
class ArtworkMaterial < ActiveRecord::Base
2
  has_many :artworks, :order => "title ASC"
2
  has_and_belongs_to_many :artworks, :order => "title ASC"
3 3

  
4 4
  validates_presence_of :name
5 5
  validates_uniqueness_of :name
app/views/admin/artworks/_form.rhtml
25 25
    end
26 26
    cat.custom_field :artwork_size_id,  _("Size:"),
27 27
      render(:partial => 'admin/artwork_sizes/selector', :locals => {:form_object => resource_name, :form_field => "artwork_size_id", :selected => selected_artwork_size_id})
28
    cat.field :artwork_material_id, _("Material:"), :collection_select, @artwork_materials, :id, :name
28
    cat.field :artwork_material_ids, _("Materials:"), :collection_select, @artwork_materials, :id, :name, {:include_blank => true}, {:multiple => true, :size => [@artwork_materials.size + 1, 10].min}
29 29
    cat.field :artwork_support_ids, _("Supports"), :collection_select, @artwork_supports, :id, :name, {:include_blank => true}, {:multiple => true, :size => [@artwork_supports.size + 1, 10].min}
30 30
  end
31 31
  table.category _("Result") do |cat|
app/views/admin/artworks/show.rhtml
26 26
  end
27 27
  cat.content [_("Set / Group:"), text]
28 28
  cat.content [_("Size:"), @artwork.artwork_size.human_size]
29
  cat.content [_("Material:"), @artwork.artwork_material.name]
29
  cat.content [_("Materials:"), display_list(@artwork.artwork_materials.collect{|t| t.name})]
30 30
  cat.content [_("Supports:"), display_list(@artwork.artwork_supports.collect{|t| t.name})]
31 31
  end
32 32
  table.category _("Result") do |cat|
po/MyCyma.pot
7 7
msgid ""
8 8
msgstr ""
9 9
"Project-Id-Version: MyCyma 0.1.0\n"
10
"POT-Creation-Date: 2009-02-28 14:12+0100\n"
10
"POT-Creation-Date: 2009-03-18 14:26+0100\n"
11 11
"PO-Revision-Date: 2008-07-28 02:17+0200\n"
12 12
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 13
"Language-Team: LANGUAGE <LL@li.org>\n"
......
40 40
msgid "Artwork|Title"
41 41
msgstr ""
42 42

  
43
#: app/models/artwork.rb:-
44
msgid "Artwork|Artwork material"
45
msgstr ""
46

  
47 43
#: app/models/artwork.rb:-
48 44
msgid "Artwork|Artwork size"
49 45
msgstr ""
......
859 855

  
860 856
#: app/views/admin/artworks/show.rhtml:29
861 857
#: app/views/admin/artworks/_form.rhtml:28
862
msgid "Material:"
858
msgid "Materials:"
863 859
msgstr ""
864 860

  
865 861
#: app/views/admin/artworks/show.rhtml:30
po/fr/MyCyma.po
7 7
msgid ""
8 8
msgstr ""
9 9
"Project-Id-Version: MyCyma 0.1.0\n"
10
"POT-Creation-Date: 2009-02-28 14:12+0100\n"
10
"POT-Creation-Date: 2009-03-18 14:26+0100\n"
11 11
"PO-Revision-Date: 2008-07-28 02:17+0200\n"
12 12
"Last-Translator: Marc Dequènes (Duck) <Duck@DuckCorp.org>\n"
13 13
"MIME-Version: 1.0\n"
......
39 39
msgid "Artwork|Title"
40 40
msgstr "Oeuvre|Titre"
41 41

  
42
#: app/models/artwork.rb:-
43
msgid "Artwork|Artwork material"
44
msgstr "Oeuvre|Matériau de l'œuvre"
45

  
46 42
#: app/models/artwork.rb:-
47 43
msgid "Artwork|Artwork size"
48 44
msgstr "Oeuvre|Dimension de l'œuvre"
......
861 857

  
862 858
#: app/views/admin/artworks/show.rhtml:29
863 859
#: app/views/admin/artworks/_form.rhtml:28
864
msgid "Material:"
865
msgstr "Matériau :"
860
msgid "Materials:"
861
msgstr "Matériaux :"
866 862

  
867 863
#: app/views/admin/artworks/show.rhtml:30
868 864
msgid "Supports:"

Also available in: Unified diff