Skip to content

Commit

Permalink
Fix issue paginagmbh#29
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-sanchez-dorado committed May 11, 2018
1 parent 3cf5d60 commit 7178f6b
Showing 1 changed file with 63 additions and 74 deletions.
137 changes: 63 additions & 74 deletions app/views/attachments/_links.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,72 @@
:class => 'icon-only icon-edit'
) if options[:editable] %>
</div>
<table>
<% for attachment in attachments %>
<tr>
<td>
<% if attachment.is_image? %>
<%= link_to_attachment attachment, :class => 'icon icon-attachment lightbox_preview', :download => true -%>
</td>
<td class="alignrigth">
<%= link_to l(:button_view),
{ :controller => 'attachments', :action => 'download',
:id => attachment, :filename => attachment.filename },
:class => 'icon-only icon-magnifier lightbox_preview ' + attachment.filename.split('.').last.downcase,
:rel => 'attachments', :title => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }" %>

<% elsif attachment.is_pdf? %>
<%= link_to_attachment attachment, :class => 'icon icon-attachment lightbox_preview pdf', :download => true -%>
</td>
<td class="alignrigth">
<%= link_to l(:button_view),
{ :controller => 'attachments', :action => 'download_inline',
:id => attachment, :filename => attachment.filename },
:class => 'icon-only icon-magnifier lightbox_preview pdf',
:rel => 'attachments', :title => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }",
:data => {:fancybox_type => 'iframe'} %>

<% else %>
<%= link_to_attachment attachment, :class => 'icon icon-attachment' -%>
</td>
<td class="alignrigth">
<% end %>
<%= link_to_attachment attachment, class: 'icon-only icon-download', title: l(:button_download), download: true -%>
</td>
<td class="alignrigth">
<span class="size"><%= number_to_human_size attachment.filesize %></span>
</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>
<p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<% if attachment.is_text? %>
<%= link_to l(:button_view),
{ :controller => 'attachments', :action => 'show',
:id => attachment, :filename => attachment.filename },
:class => 'icon-only icon-magnifier',
:title => l(:button_view) %>
<% end %>
<% if attachment.is_image? %>
<%= link_to l(:button_view),
{ :controller => 'attachments', :action => 'download',
:id => attachment, :filename => attachment.filename },
:class => 'icon-only icon-magnifier lightbox_preview ' + attachment.filename.split('.').last.downcase,
:rel => 'attachments', :title => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }" %>
<% end %>
<% if( attachment.filename =~ /.(pdf|swf)$/i ) %>
<%= link_to l(:button_view),
{ :controller => 'attachments', :action => 'download_inline',
:id => attachment, :filename => attachment.filename },
:class => 'icon-only icon-magnifier lightbox_preview ' + attachment.filename.split('.').last.downcase,
:rel => 'attachments', :title => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }",
:data => {:fancybox_type => 'iframe'} %>
<% end %>
<%= attachment.description unless attachment.description.blank? %>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% 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 %>
<% if options[:author] %>
<span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
<% end %>
</p>
<% end %>
</table>
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<div class="thumbnails images">
<% images.each do |attachment| %>
<div>
<%=
link_to image_tag(url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment)),
{:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename},
:class => ('lightbox' + (attachment.is_pdf? ? ' pdf' : '')) , :rel => 'thumbnails', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }"
%>
</div>

<% if defined?(Setting.thumbnails_enabled) && Setting.thumbnails_enabled? %>
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<div class="thumbnails images">
<% images.each do |attachment| %>
<div>
<%=
link_to image_tag(url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment)),
{:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename},
:class => 'lightbox', :rel => 'thumbnails', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }"
%>
</div>
<% end %>
</div>
<% end %>
</div>
<% else %>
<% images = attachments.select { |a| a.image? } %>
<% unless images.empty? %>
<div class='images'>
<% images.each do |attachment| %>
<%= link_to image_tag(url_for({:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename }), :width => Setting.thumbnails_size),
{:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename }, :class => 'lightbox', :rel => 'thumbnails', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }" %>
<% end -%>
</div>
<% end -%>
<% end %>
<% else %>
<% images = attachments.select { |a| a.image? } %>
<% unless images.empty? %>
<div class='images'>
<% images.each do |attachment| %>
<%= link_to image_tag(url_for({:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename }), :width => '180'),
{:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename }, :class => 'lightbox', :rel => 'thumbnails', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }" %>
<% end -%>
</div>
<% end -%>
<% end %>

</div>

0 comments on commit 7178f6b

Please sign in to comment.