[1] | 1 | <h1>Editing gallery</h1> |
---|
| 2 | |
---|
| 3 | <%= error_messages_for :gallery %> |
---|
| 4 | |
---|
[4] | 5 | <% form_for(@gallery, { :action => 'update' }, :html => {:multipart => true}) do |f| %> |
---|
| 6 | <p> |
---|
| 7 | <b>Title</b><br /> |
---|
| 8 | <%= f.text_field :sTitle, :class=>"textbox" %> |
---|
| 9 | </p> |
---|
| 10 | |
---|
| 11 | <p> |
---|
| 12 | <b>Description</b><br /> |
---|
| 13 | <%= f.text_area :tDescription, :class=>"textbox" %> |
---|
| 14 | </p> |
---|
| 15 | |
---|
| 16 | <p> |
---|
| 17 | <b>Type</b><br/> |
---|
| 18 | <select name="gallery[sType]" class="textbox" > |
---|
[10] | 19 | <%= options_for_select [["Artwork", "Artwork"], ["Engineering", "Engineering"]], @gallery.sType %> |
---|
[4] | 20 | </select> |
---|
| 21 | </p> |
---|
| 22 | |
---|
| 23 | <p> |
---|
[10] | 24 | <b>Order Value</b><br/> |
---|
| 25 | <div id="Input1" class="textbox"> |
---|
| 26 | <%= f.text_field :iOrder %> |
---|
| 27 | </div> |
---|
| 28 | |
---|
| 29 | <div id="Input1Results" class="results"></div> |
---|
| 30 | |
---|
| 31 | <script type="text/javascript"> |
---|
| 32 | var combobox = new ComboBox('Input1', 'Input1Results', |
---|
| 33 | [ |
---|
| 34 | <% for choice in @iOrders do -%> |
---|
| 35 | <%= '"' + choice + '", ' %> |
---|
| 36 | <% end -%> |
---|
| 37 | ] |
---|
| 38 | ); |
---|
| 39 | </script> |
---|
| 40 | </p> |
---|
| 41 | |
---|
| 42 | <p> |
---|
[4] | 43 | <b>Add Media Upload</b><br/> |
---|
| 44 | <input type="file" id="gallery_media" name="gallery_media"> |
---|
| 45 | <div id="gallery_media_list"></div> |
---|
| 46 | <script type="text/javascript"> |
---|
| 47 | var multi_selector = new MultiSelector( document.getElementById('gallery_media_list'), 0, 'gallery_media'); |
---|
| 48 | multi_selector.addElement( document.getElementById( 'gallery_media' ) ); |
---|
| 49 | </script> |
---|
| 50 | </p> |
---|
| 51 | |
---|
| 52 | <p> |
---|
| 53 | <b>Add File(s) Upload</b><br/> |
---|
| 54 | <input type="file" id="gallery_files" name="gallery_files"> |
---|
| 55 | <div id="gallery_files_list"></div> |
---|
| 56 | <script type="text/javascript"> |
---|
| 57 | var multi_selector = new MultiSelector( document.getElementById('gallery_files_list'), 0, 'gallery_files'); |
---|
| 58 | multi_selector.addElement( document.getElementById( 'gallery_files' ) ); |
---|
| 59 | </script> |
---|
| 60 | </p> |
---|
| 61 | |
---|
| 62 | <p><b>Current Media Uploaded</b><br/> |
---|
| 63 | <div class="fileOuterDiv"> |
---|
| 64 | <% for file in GalleryMedia.find(:all, :conditions => ["gallery_id = ?", @gallery.id]) do -%> |
---|
| 65 | <div id="<%= "Media_#{file.id.to_s}" %>" class="fileInnerDiv"> |
---|
| 66 | <%= link_to_remote( image_tag("icon-delete.gif"), |
---|
| 67 | :url => { :action => :destroy_file, :params => { :file_id => file.id, :id => @gallery.id, :type => "Media" } }, |
---|
| 68 | :confirm => "Are you sure?" ) %> |
---|
| 69 | <span> |
---|
| 70 | <% temp = file.medianame.split("/") %> |
---|
| 71 | <%= temp[temp.size-1] %> |
---|
| 72 | </span> |
---|
| 73 | </div> |
---|
| 74 | <div id="<%= "Media_Attributes_#{file.id.to_s}" %>" class="fileInnerDiv" style="width: 300px; float: right; margin: 1px; margin-top: 0px;"> |
---|
| 75 | <span> |
---|
| 76 | Title/Description: |
---|
| 77 | <% fields_for "gallery[media_fields_update][]", file do |media| %> |
---|
| 78 | <%= media.text_field :sTitle, :class => "textbox", :style => "margin: 0px; padding: 0px;" %> |
---|
| 79 | <%= media.text_area :tDescription, :class=>"textbox", :style=> "margin: 0px; padding: 0px;" %> |
---|
| 80 | <% end %> |
---|
| 81 | </span> |
---|
| 82 | </div> |
---|
| 83 | <div class="divclear"></div> |
---|
| 84 | <% end %> |
---|
| 85 | </div> |
---|
| 86 | </p> |
---|
| 87 | |
---|
| 88 | <p><b>Current Files Uploaded</b><br/> |
---|
| 89 | <div class="fileOuterDiv"> |
---|
| 90 | <% for file in GalleryFiles.find(:all, :conditions => ["gallery_id = ?", @gallery.id]) do -%> |
---|
| 91 | <div id="<%= "File_#{file.id.to_s}" %>" class="fileInnerDiv"> |
---|
| 92 | <%= link_to_remote( image_tag("icon-delete.gif"), |
---|
| 93 | :url => { :action => :destroy_file, :params => { :file_id => file.id, :id => @gallery.id, :type => "File"} }, |
---|
| 94 | :confirm => "Are you sure?" ) %> |
---|
| 95 | <span> |
---|
| 96 | <% temp = file.filename.split("/") %> |
---|
| 97 | <%= temp[temp.size-1] %> |
---|
| 98 | </span> |
---|
| 99 | </div> |
---|
| 100 | <% end %> |
---|
| 101 | </div> |
---|
| 102 | </p> |
---|
| 103 | |
---|
[1] | 104 | <p> |
---|
| 105 | <%= f.submit "Update" %> |
---|
| 106 | </p> |
---|
| 107 | <% end %> |
---|
| 108 | |
---|
| 109 | <%= link_to 'Show', @gallery %> | |
---|
| 110 | <%= link_to 'Back', galleries_path %> |
---|