mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 13:14:29 +08:00
Added large preview [SCI-694]
This commit is contained in:
parent
8738b3e09d
commit
b537feb8a0
6 changed files with 9 additions and 10 deletions
|
@ -5,7 +5,7 @@ $(document).ready(function() {
|
|||
$('.image-preview-link').click(function(e) {
|
||||
e.preventDefault();
|
||||
var name = $(this).find('p').text();
|
||||
var url = $(this).find('img').attr('src');
|
||||
var url = $(this).find('img').data('large-url');
|
||||
var downloadUrl = $(this).attr('href');
|
||||
var description = $(this).data('description');
|
||||
openPreviewModal(name, url, downloadUrl, description);
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
color: $color-white;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
|
@ -59,17 +60,13 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
background: $color-black;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ class Asset < ActiveRecord::Base
|
|||
|
||||
# Paperclip validation
|
||||
has_attached_file :file,
|
||||
styles: { medium: [Constants::MEDIUM_PIC_FORMAT, :jpg] },
|
||||
styles: { medium: [Constants::MEDIUM_PIC_FORMAT, :jpg],
|
||||
large: [Constants::LARGE_PIC_FORMAT, :jpg] },
|
||||
convert_options: { medium: '-quality 70 -strip' }
|
||||
|
||||
validates_attachment :file,
|
||||
|
@ -28,7 +29,7 @@ class Asset < ActiveRecord::Base
|
|||
%r{^image/#{ Regexp.union(
|
||||
Constants::WHITELISTED_IMAGE_TYPES
|
||||
) }}
|
||||
[:medium]
|
||||
[:medium, :large]
|
||||
else
|
||||
{}
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<%= image_tag 'medium/processing.gif' %>
|
||||
</span>
|
||||
<% else %>
|
||||
<%= image_tag(preview_asset_path result.asset) if result.asset.is_image? %>
|
||||
<%= image_tag(result.asset.url(:medium), data: {large_url: result.asset.url(:large)}) if result.asset.is_image? %>
|
||||
<p><%= result.asset.file_file_name %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<%= image_tag 'medium/processing.gif' %>
|
||||
</span>
|
||||
<% else %>
|
||||
<%= image_tag preview_asset_path(asset) if asset.is_image? %>
|
||||
<%= image_tag asset.url(:medium), data: {large_url: asset.url(:large)} if asset.is_image? %>
|
||||
<% end %>
|
||||
<p><%= truncate(asset.file_file_name,
|
||||
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
|
||||
|
|
|
@ -73,6 +73,7 @@ class Constants
|
|||
|
||||
# Picture size formats
|
||||
MEDIUM_PIC_FORMAT = '300x300>'.freeze
|
||||
LARGE_PIC_FORMAT = '800x600>'.freeze
|
||||
THUMB_PIC_FORMAT = '100x100>'.freeze
|
||||
ICON_PIC_FORMAT = '40x40>'.freeze
|
||||
ICON_SMALL_PIC_FORMAT = '30x30>'.freeze
|
||||
|
|
Loading…
Add table
Reference in a new issue