Project

General

Profile

« Previous | Next » 

Revision 3807b362

Added by Marc Dequènes over 15 years ago

  • ID 3807b362f44c00b771ed8ed5b4da60799752825b

[evol] an artwork can have multiple materials

View differences:

TODO
Application:
- add created_by/updated_by support
Framework:
- finish restful_support rework (response handler at least)
app/models/artwork.rb
class Artwork < ActiveRecord::Base
belongs_to :artwork_set
belongs_to :artwork_group
belongs_to :artwork_material
belongs_to :artwork_size
belongs_to :artwork_condition
belongs_to :artwork_placement_reason
has_many :artwork_step_images, :order => "date ASC"
has_and_belongs_to_many :artwork_supports, :order => "name ASC"
has_and_belongs_to_many :artwork_materials, :order => "name ASC"
validates_presence_of :title, :artwork_material_id, :artwork_size_id, :artwork_condition_id
validates_presence_of :title, :artwork_size_id, :artwork_condition_id
validates_uniqueness_of :title
validates_length_of :title, :within => 1..256, :allow_blank => true
validates_length_of :placement_location, :within => 1..256, :allow_blank => true
validates_associated :artwork_set, :artwork_group, :artwork_material, :artwork_size, :artwork_condition
validates_associated :artwork_set, :artwork_group, :artwork_size, :artwork_condition
before_save {|model| model.artwork_group = nil if model.artwork_set.nil? }
app/models/artwork_material.rb
class ArtworkMaterial < ActiveRecord::Base
has_many :artworks, :order => "title ASC"
has_and_belongs_to_many :artworks, :order => "title ASC"
validates_presence_of :name
validates_uniqueness_of :name
app/views/admin/artworks/_form.rhtml
end
cat.custom_field :artwork_size_id, _("Size:"),
render(:partial => 'admin/artwork_sizes/selector', :locals => {:form_object => resource_name, :form_field => "artwork_size_id", :selected => selected_artwork_size_id})
cat.field :artwork_material_id, _("Material:"), :collection_select, @artwork_materials, :id, :name
cat.field :artwork_material_ids, _("Materials:"), :collection_select, @artwork_materials, :id, :name, {:include_blank => true}, {:multiple => true, :size => [@artwork_materials.size + 1, 10].min}
cat.field :artwork_support_ids, _("Supports"), :collection_select, @artwork_supports, :id, :name, {:include_blank => true}, {:multiple => true, :size => [@artwork_supports.size + 1, 10].min}
end
table.category _("Result") do |cat|
app/views/admin/artworks/show.rhtml
end
cat.content [_("Set / Group:"), text]
cat.content [_("Size:"), @artwork.artwork_size.human_size]
cat.content [_("Material:"), @artwork.artwork_material.name]
cat.content [_("Materials:"), display_list(@artwork.artwork_materials.collect{|t| t.name})]
cat.content [_("Supports:"), display_list(@artwork.artwork_supports.collect{|t| t.name})]
end
table.category _("Result") do |cat|
po/MyCyma.pot
msgid ""
msgstr ""
"Project-Id-Version: MyCyma 0.1.0\n"
"POT-Creation-Date: 2009-02-28 14:12+0100\n"
"POT-Creation-Date: 2009-03-18 14:26+0100\n"
"PO-Revision-Date: 2008-07-28 02:17+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
msgid "Artwork|Title"
msgstr ""
#: app/models/artwork.rb:-
msgid "Artwork|Artwork material"
msgstr ""
#: app/models/artwork.rb:-
msgid "Artwork|Artwork size"
msgstr ""
......
#: app/views/admin/artworks/show.rhtml:29
#: app/views/admin/artworks/_form.rhtml:28
msgid "Material:"
msgid "Materials:"
msgstr ""
#: app/views/admin/artworks/show.rhtml:30
po/fr/MyCyma.po
msgid ""
msgstr ""
"Project-Id-Version: MyCyma 0.1.0\n"
"POT-Creation-Date: 2009-02-28 14:12+0100\n"
"POT-Creation-Date: 2009-03-18 14:26+0100\n"
"PO-Revision-Date: 2008-07-28 02:17+0200\n"
"Last-Translator: Marc Dequènes (Duck) <Duck@DuckCorp.org>\n"
"MIME-Version: 1.0\n"
......
msgid "Artwork|Title"
msgstr "Oeuvre|Titre"
#: app/models/artwork.rb:-
msgid "Artwork|Artwork material"
msgstr "Oeuvre|Matériau de l'œuvre"
#: app/models/artwork.rb:-
msgid "Artwork|Artwork size"
msgstr "Oeuvre|Dimension de l'œuvre"
......
#: app/views/admin/artworks/show.rhtml:29
#: app/views/admin/artworks/_form.rhtml:28
msgid "Material:"
msgstr "Matériau :"
msgid "Materials:"
msgstr "Matériaux :"
#: app/views/admin/artworks/show.rhtml:30
msgid "Supports:"

Also available in: Unified diff