| [4] | 1 | <h1>Editing gallery</h1> | 
|---|
|  | 2 |  | 
|---|
|  | 3 | <%= error_messages_for :gallery %> | 
|---|
|  | 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" > | 
|---|
|  | 19 | <%= options_for_select [["Artwork", "Artwork"], ["Engineering", "Engineering"]] %> | 
|---|
|  | 20 | </select> | 
|---|
|  | 21 | </p> | 
|---|
|  | 22 |  | 
|---|
|  | 23 | <p> | 
|---|
|  | 24 | <b>Add Media Upload</b><br/> | 
|---|
|  | 25 | <input type="file" id="gallery_media" name="gallery_media"> | 
|---|
|  | 26 | <div id="gallery_media_list"></div> | 
|---|
|  | 27 | <script type="text/javascript"> | 
|---|
|  | 28 | var multi_selector = new MultiSelector( document.getElementById('gallery_media_list'), 0, 'gallery_media'); | 
|---|
|  | 29 | multi_selector.addElement( document.getElementById( 'gallery_media' ) ); | 
|---|
|  | 30 | </script> | 
|---|
|  | 31 | </p> | 
|---|
|  | 32 |  | 
|---|
|  | 33 | <p> | 
|---|
|  | 34 | <b>Add File(s) Upload</b><br/> | 
|---|
|  | 35 | <input type="file" id="gallery_files" name="gallery_files"> | 
|---|
|  | 36 | <div id="gallery_files_list"></div> | 
|---|
|  | 37 | <script type="text/javascript"> | 
|---|
|  | 38 | var multi_selector = new MultiSelector( document.getElementById('gallery_files_list'), 0, 'gallery_files'); | 
|---|
|  | 39 | multi_selector.addElement( document.getElementById( 'gallery_files' ) ); | 
|---|
|  | 40 | </script> | 
|---|
|  | 41 | </p> | 
|---|
|  | 42 |  | 
|---|
|  | 43 | <p><b>Current Media Uploaded</b><br/> | 
|---|
|  | 44 | <div class="fileOuterDiv"> | 
|---|
|  | 45 | <% for file in GalleryMedia.find(:all, :conditions => ["gallery_id = ?", @gallery.id]) do -%> | 
|---|
|  | 46 | <div id="<%= "Media_#{file.id.to_s}" %>" class="fileInnerDiv"> | 
|---|
|  | 47 | <%= link_to_remote( image_tag("icon-delete.gif"), | 
|---|
|  | 48 | :url => { :action => :destroy_file, :params => { :file_id => file.id, :id => @gallery.id, :type => "Media" } }, | 
|---|
|  | 49 | :confirm => "Are you sure?" ) %> | 
|---|
|  | 50 | <span> | 
|---|
|  | 51 | <% temp = file.medianame.split("/") %> | 
|---|
|  | 52 | <%= temp[temp.size-1] %> | 
|---|
|  | 53 | </span> | 
|---|
|  | 54 | </div> | 
|---|
|  | 55 | <div id="<%= "Media_#{file.id.to_s}" %>" class="fileInnerDiv" style="width: 300px; float: right; margin: 1px; margin-top: 0px;"> | 
|---|
|  | 56 | <span> | 
|---|
|  | 57 | Title/Description: | 
|---|
|  | 58 | <% fields_for "gallery[media_fields_update][]", file do |media| %> | 
|---|
|  | 59 | <%= media.text_field :sTitle, :class => "textbox", :style => "margin: 0px; padding: 0px;" %> | 
|---|
|  | 60 | <%= media.text_area :tDescription, :class=>"textbox", :style=> "margin: 0px; padding: 0px;" %> | 
|---|
|  | 61 | <% end %> | 
|---|
|  | 62 | </span> | 
|---|
|  | 63 | </div> | 
|---|
|  | 64 | <div class="divclear"></div> | 
|---|
|  | 65 | <% end %> | 
|---|
|  | 66 | </div> | 
|---|
|  | 67 | </p> | 
|---|
|  | 68 |  | 
|---|
|  | 69 | <p><b>Current Files Uploaded</b><br/> | 
|---|
|  | 70 | <div class="fileOuterDiv"> | 
|---|
|  | 71 | <% for file in GalleryFiles.find(:all, :conditions => ["gallery_id = ?", @gallery.id]) do -%> | 
|---|
|  | 72 | <div id="<%= "File_#{file.id.to_s}" %>" class="fileInnerDiv"> | 
|---|
|  | 73 | <%= link_to_remote( image_tag("icon-delete.gif"), | 
|---|
|  | 74 | :url => { :action => :destroy_file, :params => { :file_id => file.id, :id => @gallery.id, :type => "File"} }, | 
|---|
|  | 75 | :confirm => "Are you sure?" ) %> | 
|---|
|  | 76 | <span> | 
|---|
|  | 77 | <% temp = file.filename.split("/") %> | 
|---|
|  | 78 | <%= temp[temp.size-1] %> | 
|---|
|  | 79 | </span> | 
|---|
|  | 80 | </div> | 
|---|
|  | 81 | <% end %> | 
|---|
|  | 82 | </div> | 
|---|
|  | 83 | </p> | 
|---|
|  | 84 |  | 
|---|
|  | 85 | <p> | 
|---|
|  | 86 | <%= f.submit "Update" %> | 
|---|
|  | 87 | </p> | 
|---|
|  | 88 | <% end %> | 
|---|
|  | 89 |  | 
|---|
|  | 90 | <%= link_to 'Show', @gallery %> | | 
|---|
|  | 91 | <%= link_to 'Back', galleries_path %> | 
|---|