Skip to content

Instantly share code, notes, and snippets.

@sabril
Created February 18, 2011 02:26
Show Gist options
  • Save sabril/833148 to your computer and use it in GitHub Desktop.
Save sabril/833148 to your computer and use it in GitHub Desktop.
the old uploaded file in production mode is in myspecdata container so they are not linked with user container. See line 22, @container.object.exists?
.holder
- @job.job_folders.with_type("folder").each do |job_folder|
- @job_folder = job_folder
.main{ :id => "folder_#{@job_folder.id}"}
.icon
%a{"href" => "javascript:toggle_div(#{@job_folder.id});"}
= image_tag('plus.jpg', :size => "14x14", :id => "img_#{@job_folder.id}")
.icon= current_user.has_role?(:contact) ? image_tag("#{@job_folder.folder_type}.png", :size => "16x16", :alt => "file_folder_#{@job_folder.id}") : link_to_remote_redbox(image_tag("#{@job_folder.folder_type}.png", :size => "16x16", :alt => "file_folder_#{@job_folder.id}"), :url => new_multiple_files_url(:job_folder_id => @job_folder))
.main_name{ "style" => "width: 470px"}= @job_folder.folder_type == "folder" && !current_user.has_role?(:contact) ? in_place_editor_field(:job_folder, 'name', {}, :save_text => "Save") : @job_folder.name
.main_number  
.icon  
.icon  
.icon  
.icon= link_to_remote(image_tag("minus.png", :border => 0, :size => "16x16"), :url => "/job_folders/destroy/#{@job_folder.id}", :confirm => "This action will remove all the files in the folder. Are you sure want to remove this folder?",:loading => "Element.show('loading');") if !current_user.has_role?(:contact)
- @job_folder.job_files.each_with_index do |job_file, a|
- if !@container.object_exists?(job_file.misc.path)
= @container = @ccf.container("myspecdata")
.child{"name" => "div_#{@job_folder.id}", "style" => "display: none;", :id => "file_#{job_file.id}"}
.icon  
.icon= current_user.has_role?(:contact) ? " " : link_to_remote_redbox(image_tag("documentedit.png", :size => "16x16"), :url => "/job_files/edit/#{job_file.id}?job_id=#{@job.id}")
.child_number{ "style" => "width: 16px"}= a + 1
.child_name{ "style" => "width: 440px"}= link_to job_file.misc_file_name, job_file, :class => "download_file"
.child_number{ "style" => "width: 80px"}= job_file.created_at.strftime("%d-%b-%Y")
.icon= @container.object_exists?("miscs/#{job_file.id}/original/#{job_file.misc_file_name}") ? " " : image_tag("warning.png", :title => "Broken Link")
.icon  
.icon  
.icon= link_to image_tag("print.png", :size => "16x16"), job_file, :class => "download_file"
.icon= link_to_remote(image_tag("minus.png", :border => 0, :size => "16x16"), :url => "/job_files/destroy/#{job_file.id}", :confirm => "Are you sure want to remove this file?", :method => :delete,:loading => "Element.show('loading');") if !current_user.has_role?(:contact)
.holder
- @job.job_folders.with_type("folder").each do |job_folder|
- @job_folder = job_folder
.main{ :id => "folder_#{@job_folder.id}"}
.icon
%a{"href" => "javascript:toggle_div(#{@job_folder.id});"}
= image_tag('plus.jpg', :size => "14x14", :id => "img_#{@job_folder.id}")
.icon= current_user.has_role?(:contact) ? image_tag("#{@job_folder.folder_type}.png", :size => "16x16", :alt => "file_folder_#{@job_folder.id}") : link_to_remote_redbox(image_tag("#{@job_folder.folder_type}.png", :size => "16x16", :alt => "file_folder_#{@job_folder.id}"), :url => new_multiple_files_url(:job_folder_id => @job_folder))
.main_name{ "style" => "width: 470px"}= @job_folder.folder_type == "folder" && !current_user.has_role?(:contact) ? in_place_editor_field(:job_folder, 'name', {}, :save_text => "Save") : @job_folder.name
.main_number  
.icon  
.icon  
.icon  
.icon= link_to_remote(image_tag("minus.png", :border => 0, :size => "16x16"), :url => "/job_folders/destroy/#{@job_folder.id}", :confirm => "This action will remove all the files in the folder. Are you sure want to remove this folder?",:loading => "Element.show('loading');") if !current_user.has_role?(:contact)
- @job_folder.job_files.each_with_index do |job_file, a|
.child{"name" => "div_#{@job_folder.id}", "style" => "display: none;", :id => "file_#{job_file.id}"}
.icon  
.icon= current_user.has_role?(:contact) ? " " : link_to_remote_redbox(image_tag("documentedit.png", :size => "16x16"), :url => "/job_files/edit/#{job_file.id}?job_id=#{@job.id}")
.child_number{ "style" => "width: 16px"}= a + 1
.child_name{ "style" => "width: 440px"}= link_to job_file.misc_file_name, job_file, :class => "download_file"
.child_number{ "style" => "width: 80px"}= job_file.created_at.strftime("%d-%b-%Y")
.icon= @container.object_exists?("miscs/#{job_file.id}/original/#{job_file.misc_file_name}") ? " " : image_tag("warning.png", :title => "Broken Link")
.icon  
.icon  
.icon= link_to image_tag("print.png", :size => "16x16"), job_file, :class => "download_file"
.icon= link_to_remote(image_tag("minus.png", :border => 0, :size => "16x16"), :url => "/job_files/destroy/#{job_file.id}", :confirm => "Are you sure want to remove this file?", :method => :delete,:loading => "Element.show('loading');") if !current_user.has_role?(:contact)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment