zipme / redmine_lightbox

Lightbox for image attachments
MIT License
116 stars 119 forks source link

DOC and PDF #1

Closed LuisSerrano closed 13 years ago

LuisSerrano commented 13 years ago

Congratulation for your work, it is possible to use with the files .DOC and .PDF

zipme commented 13 years ago

Do you mean display the preview of .doc and .pdf file in lightbox?

LuisSerrano commented 13 years ago

Yes

zipme commented 13 years ago

Good idea, I will do that.

LuisSerrano commented 13 years ago

I have changed your file _link.rhtml with this

<% attachments.each do |attachment| -%> <% if attachment.image? -%>

<%= link_to image_tag(url_for({:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename }), :width => '180'), {:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename }, :class => 'lightbox', :rel => 'attachments', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }" %> <% else -%>

<%= link_to attachment.filename, {:controller => 'attachments', :action => 'download', :id => attachment }, :class => 'icon icon-attachment' %> <% end -%> <%= h(" - #{attachment.description}") unless attachment.description.blank? %> (<%= number_to_human_size attachment.filesize %>) <% if options[:deletable] %> <%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'destroy', :id => attachment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'delete', :title => l(:button_delete) %> <% end %> <% if options[:author] %> <%= attachment.author %>, <%= format_time(attachment.created_on) %> <% end %>

<% end %>

I have changed (harcoded) the file attachment.rb (models) (I dont know how to make a patch) Old def image? self.filename =~ /.(jpe?g|gif|png)$/i end

New

def image? self.filename =~ /.(jpe?g|gif|png|bmp)$/i end

zipme commented 13 years ago

you can fork the project, make the change , commit the change , then send a pull request.