paginagmbh / redmine_lightbox2

Lightbox for image attachments in Redmine
MIT License
126 stars 97 forks source link

Don't force download #54

Open kroomagnon opened 6 years ago

kroomagnon commented 6 years ago

Hi!

Please don't force downloading of the image when I try to open in new tab.

Regards, Krisztián

dstana commented 6 years ago

+1

ghost commented 6 years ago

+1

ghost commented 6 years ago

@dstana looks like simple workaround of this problem is:

diff -Naur app/views/attachments/_links.html.erb-2018-07-04 app/views/attachments/_links.html.erb
--- app/views/attachments/_links.html.erb-2018-07-04    2018-07-04 07:45:40.541549108 +0000
+++ app/views/attachments/_links.html.erb       2018-07-04 07:45:47.139515615 +0000
@@ -11,7 +11,7 @@
 <tr>
   <td>
     <% if attachment.is_image? %>
-      <%= link_to_attachment attachment, :class => 'icon icon-attachment lightbox_preview', :download => true -%>
+      <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => false -%>
       </td>
       <td class="alignrigth">
       <%= link_to l(:button_view),

In any case this is fix of my issue :)

dstana commented 6 years ago

@wwwlde What version of the plugin are you using? That row in my version looks like this:

<tr>
  <td>
    <%= link_to_attachment attachment, class: 'icon icon-attachment' -%>
    <span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
    <%= link_to_attachment attachment, class: 'icon-only icon-download', title: l(:button_download), download: true -%>
  </td>
  <td><%= attachment.description unless attachment.description.blank? %></td>
  <td>
    <% if options[:author] %>
      <span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
    <% end %>
  </td>
  <td>
    <% if options[:deletable] %>
      <%= link_to l(:button_delete), attachment_path(attachment),
                  :data => {:confirm => l(:text_are_you_sure)},
                  :method => :delete,
                  :class => 'delete icon-only icon-del',
                  :title => l(:button_delete) %>
    <% end %>
  </td>
</tr>
ghost commented 6 years ago

@dstana Version 0.4.3 / Redmine 3.4

dstana commented 6 years ago

@wwwlde I'm confused. The diff shows you only changed 1 line. Can you post the the rest of the contents _links.html.erb?

ghost commented 6 years ago

@dstana _links.html.erb.txt

dstana commented 6 years ago

@wwwlde I was looking in the redmine app directory instead of the plugin app directory for some reason :)

Anyway that fix just disables the lightbox for the file links at the top. What I need is after the lightbox opens and you open the image in a new tab for it not to download.