when mouse move to button of announcement file : image => preview pic, file => type
This commit is contained in:
		
							parent
							
								
									506770bf33
								
							
						
					
					
						commit
						f4692182c0
					
				| 
						 | 
					@ -38,20 +38,17 @@ module Panel::Announcement::BackEnd::BulletinsHelper
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def file_picture_preview_setting(file_path)
 | 
					  def file_picture_preview_setting(file_path)
 | 
				
			||||||
    res= ""
 | 
					    res= ""
 | 
				
			||||||
    ext = File.extname(file_path)
 | 
					    ext = File.extname(file_path)[1..-1]
 | 
				
			||||||
 | 
					    puts ext
 | 
				
			||||||
    unless file_path.nil?
 | 
					    unless file_path.nil?
 | 
				
			||||||
      case ext
 | 
					      case ext
 | 
				
			||||||
        when ".jpg",".jpeg",".png",".gif"
 | 
					        when "jpg","jpeg","png","gif"
 | 
				
			||||||
          #res = '<div class="for_preview" style="display:none;">'
 | 
					 | 
				
			||||||
          #res << image_tag(file_path, {:title => t(:view)})
 | 
					 | 
				
			||||||
          #res << '</div>'
 | 
					 | 
				
			||||||
          #res.html_safe
 | 
					 | 
				
			||||||
          {"data-content" => "#{image_tag file_path}" }
 | 
					          {"data-content" => "#{image_tag file_path}" }
 | 
				
			||||||
 | 
					        when "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx"
 | 
				
			||||||
 | 
					          {"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/#{ext}/#{ext}-48_32.png")}"}
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          {"data-content" => t("sys.not_previewable") }
 | 
					          {"data-content" => t("sys.not_previewable") }
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,9 +4,10 @@
 | 
				
			||||||
  <td>
 | 
					  <td>
 | 
				
			||||||
    <div class="control-group">
 | 
					    <div class="control-group">
 | 
				
			||||||
      <div class="controls">
 | 
					      <div class="controls">
 | 
				
			||||||
 | 
					        <% if form_bulletin_file.new_record? %>
 | 
				
			||||||
          <%= f.file_field :file %>
 | 
					          <%= f.file_field :file %>
 | 
				
			||||||
					<%#= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
 | 
					        <% end %>
 | 
				
			||||||
					<%= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}.merge(file_picture_preview_setting(form_bulletin_file.file.url)) ) : '' %>
 | 
					        <%= form_bulletin_file.file.file ? ( link_to t(:view), form_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view), "data-trigger" => :hover}.merge(file_picture_preview_setting(form_bulletin_file.file.url)) ) : '' %>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </td> 
 | 
					  </td> 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue