Project

General

Profile

« Previous | Next » 

Revision fc30c2a2

Added by Marc Dequènes over 12 years ago

  • ID fc30c2a2a992f7470aeee259d71120ed3d55331e

[fix] added 'selected' parameter to artwork size generic selector and pass currently selected size in artwork edit page (closes #1)

View differences:

app/views/admin/artwork_sizes/_selector.rhtml
1 1
<%
2
  standard_sizes = options_from_collection_for_select ArtworkSize.find(:all, :order => "height ASC, width ASC", :conditions => {:standard => true}), :id, :human_size
3
  custom_sizes = options_from_collection_for_select ArtworkSize.find(:all, :order => "height ASC, width ASC", :conditions => {:standard => false}), :id, :human_size
2
  standard_sizes = options_from_collection_for_select ArtworkSize.find(:all, :order => "height ASC, width ASC", :conditions => {:standard => true}), :id, :human_size, selected
3
  custom_sizes = options_from_collection_for_select ArtworkSize.find(:all, :order => "height ASC, width ASC", :conditions => {:standard => false}), :id, :human_size, selected
4 4

  
5 5
  sizes_choice = title_option(_("== Standard Sizes ==")) + standard_sizes + title_option(_("== Custom Sizes ==")) + custom_sizes
6 6
%>
app/views/admin/artworks/_form.rhtml
2 2
<%
3 3
selected_artwork_set_id = (@artwork ? @artwork.artwork_set_id : nil)
4 4
selected_artwork_group_id = (@artwork ? @artwork.artwork_group_id : nil)
5
selected_artwork_size_id = (@artwork ? @artwork.artwork_size_id : nil)
5 6

  
6 7
form_for_resource do |f|
7 8
%>
......
23 24
      end
24 25
    end
25 26
    cat.custom_field :artwork_size_id,  _("Size:"),
26
      render(:partial => 'admin/artwork_sizes/selector', :locals => {:form_object => resource_name, :form_field => "artwork_size_id"})
27
      render(:partial => 'admin/artwork_sizes/selector', :locals => {:form_object => resource_name, :form_field => "artwork_size_id", :selected => selected_artwork_size_id})
27 28
    cat.field :artwork_material_id, _("Material:"), :collection_select, @artwork_materials, :id, :name
28 29
    cat.field :technique_ids, _("Techniques"), :collection_select, @techniques, :id, :name, {:include_blank => true}, {:multiple => true, :size => [@techniques.size + 1, 10].min}
29 30
  end

Also available in: Unified diff