Revision fc30c2a2
Added by Marc Dequènes about 16 years ago
- ID fc30c2a2a992f7470aeee259d71120ed3d55331e
app/views/admin/artwork_sizes/_selector.rhtml | ||
---|---|---|
<%
|
||
standard_sizes = options_from_collection_for_select ArtworkSize.find(:all, :order => "height ASC, width ASC", :conditions => {:standard => true}), :id, :human_size
|
||
custom_sizes = options_from_collection_for_select ArtworkSize.find(:all, :order => "height ASC, width ASC", :conditions => {:standard => false}), :id, :human_size
|
||
standard_sizes = options_from_collection_for_select ArtworkSize.find(:all, :order => "height ASC, width ASC", :conditions => {:standard => true}), :id, :human_size, selected
|
||
custom_sizes = options_from_collection_for_select ArtworkSize.find(:all, :order => "height ASC, width ASC", :conditions => {:standard => false}), :id, :human_size, selected
|
||
|
||
sizes_choice = title_option(_("== Standard Sizes ==")) + standard_sizes + title_option(_("== Custom Sizes ==")) + custom_sizes
|
||
%>
|
app/views/admin/artworks/_form.rhtml | ||
---|---|---|
<%
|
||
selected_artwork_set_id = (@artwork ? @artwork.artwork_set_id : nil)
|
||
selected_artwork_group_id = (@artwork ? @artwork.artwork_group_id : nil)
|
||
selected_artwork_size_id = (@artwork ? @artwork.artwork_size_id : nil)
|
||
|
||
form_for_resource do |f|
|
||
%>
|
||
... | ... | |
end
|
||
end
|
||
cat.custom_field :artwork_size_id, _("Size:"),
|
||
render(:partial => 'admin/artwork_sizes/selector', :locals => {:form_object => resource_name, :form_field => "artwork_size_id"})
|
||
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 :technique_ids, _("Techniques"), :collection_select, @techniques, :id, :name, {:include_blank => true}, {:multiple => true, :size => [@techniques.size + 1, 10].min}
|
||
end
|
Also available in: Unified diff
[fix] added 'selected' parameter to artwork size generic selector and pass currently selected size in artwork edit page (closes #1)