Project

General

Profile

Download (2.82 KB) Statistics
| Branch: | Tag: | Revision:

root / app / views / admin / artworks / _form.rhtml @ 70e65017

1 b689e231 Marc Dequènes (Duck)
<p>
2
<%
3
selected_artwork_set_id = (@artwork ? @artwork.artwork_set_id : nil)
4
selected_artwork_group_id = (@artwork ? @artwork.artwork_group_id : nil)
5 fc30c2a2 Marc Dequènes (Duck)
selected_artwork_size_id = (@artwork ? @artwork.artwork_size_id : nil)
6 b689e231 Marc Dequènes (Duck)
7
form_for_resource do |f|
8
%>
9
<%=
10
stacking_form(f) do |table|
11
  table.category _("General") do |cat|
12
    cat.field :title, _("Title:"), :text_field
13
    cat.field :artwork_set_id, _("Set:"), :collection_select, @artwork_sets, :id, :name, :include_blank => true
14
    cat.conditional_block(:set_details, @artwork, :artwork_set_id) do |bl|
15
      bl.field :artwork_set_position, _("Position into Artwork Set:"), :text_field
16
      bl.custom_field :artwork_group_id, _("Group:"),
17
        "<select id=\"artwork_artwork_group_id\" name=\"artwork[artwork_group_id]\">" +
18
        render(:partial => 'admin/artwork_groups/select_for_artwork_set',
19
               :locals => {:form_object => resource_name, :form_field => "artwork_group_id",
20
	                   :artwork_set_id => selected_artwork_set_id, :selected => selected_artwork_group_id}) +
21
        "</select>"
22
      bl.conditional_block(:group_details, @artwork, :artwork_group_id) do |bl2|
23
        bl2.field :artwork_group_position, _("Position into Artwork Group:"), :text_field
24
      end
25
    end
26
    cat.custom_field :artwork_size_id,  _("Size:"),
27 fc30c2a2 Marc Dequènes (Duck)
      render(:partial => 'admin/artwork_sizes/selector', :locals => {:form_object => resource_name, :form_field => "artwork_size_id", :selected => selected_artwork_size_id})
28 b689e231 Marc Dequènes (Duck)
    cat.field :artwork_material_id, _("Material:"), :collection_select, @artwork_materials, :id, :name
29 70e65017 Marc Dequènes (Duck)
    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 b689e231 Marc Dequènes (Duck)
  end
31
  table.category _("Result") do |cat|
32
    cat.field :artwork_condition_id, _("Condition:"), :collection_select, @artwork_conditions, :id, :name
33
    cat.category _("Placement") do |cat2|
34
      cat2.field :artwork_placement_reason_id, _("Reason:"), :collection_select, @artwork_placement_reasons, :id, :name, :include_blank => true
35
      cat2.conditional_block(:placement_details, @artwork, :artwork_placement_reason_id) do |bl|
36
	bl.field :placement_location, _("Location:"), :text_field
37
	bl.field :placement_date, _("Date:"), :date_select
38
      end
39
    end
40
    form_comment(cat)
41
  end
42 676cb428 Marc Dequènes (Duck)
  table.content display_standard_form_buttons(submit_label)
43 b689e231 Marc Dequènes (Duck)
end
44
%>
45
<%
46
end
47
%>
48
</p>
49
<%=
50
  observe_field_with_reload :artwork_artwork_set_id,
51
                            :url => { :controller => 'artwork_groups', :action => 'select_for_artwork_set' },
52
			    :update => :artwork_artwork_group_id,
53
			    :with => "'form_object=#{resource_name}&form_field=artwork_group_id&initial_artwork_set_id=#{selected_artwork_set_id}&initial_artwork_group_id=#{selected_artwork_group_id}&artwork_set_id=' + escape(value)"
54
%>