Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gy4443
chemotion_eln_server
Commits
dac29e28
Commit
dac29e28
authored
Nov 12, 2018
by
PiTrem
Browse files
container entity: fix img preview
parent
1ddd9a30
Changes
1
Show whitespace changes
Inline
Side-by-side
app/api/entities/container_entity.rb
View file @
dac29e28
...
@@ -42,7 +42,9 @@ module Entities
...
@@ -42,7 +42,9 @@ module Entities
private
private
def
preview_img
(
container_ids
,
attachments
)
def
preview_img
(
container_ids
,
attachments
)
attachment
=
attachments
.
find
{
|
a
|
a
.
thumb
==
true
&&
container_ids
.
include?
(
a
.
id
)}
attachment
=
attachments
.
find
{
|
a
|
a
.
thumb
==
true
&&
a
.
attachable_type
==
'Container'
&&
container_ids
.
include?
(
a
.
attachable_id
)
}
preview
=
attachment
.
read_thumbnail
if
attachment
preview
=
attachment
.
read_thumbnail
if
attachment
preview
&&
Base64
.
encode64
(
preview
)
||
"not available"
preview
&&
Base64
.
encode64
(
preview
)
||
"not available"
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment