Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
9b0a8c01
Commit
9b0a8c01
authored
9 years ago
by
Mateus Rambo Strey
Browse files
Options
Downloads
Patches
Plain Diff
fix thumbnail display
parent
c9d6beb8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/helpers/learning_objects_helper.rb
+24
-44
24 additions, 44 deletions
app/helpers/learning_objects_helper.rb
app/models/learning_object.rb
+9
-1
9 additions, 1 deletion
app/models/learning_object.rb
with
33 additions
and
45 deletions
app/helpers/learning_objects_helper.rb
+
24
−
44
View file @
9b0a8c01
...
...
@@ -2,14 +2,14 @@ module LearningObjectsHelper
def
display_object_type
(
learning_object
)
case
learning_object
.
object_type
.
name
when
'Áudio'
then
audio_tag
(
learning_object
.
retrieve_link
,
controls:
true
)
when
'Vídeo'
then
video_tag
(
learning_object
.
retrieve_link
,
autobuffer:
true
,
poster:
learning_object
.
thumbnail
)
when
'PDF'
then
"<iframe src=
\"
/pdfjs/web/viewer.html?file=
#{
learning_object
.
retrieve_link
}
\"
style=
\"
border: 0
\"
width=
\"
125%
\"
height=
\"
280
\"
frameborder=
\"
0
\"
scrolling=
\"
no
\"
></iframe>"
.
html_safe
else
image_tag
learning_object_thumbnail
(
learning_object
,
"
large
"
),
alt:
learning_object_title
(
learning_object
),
class:
"
thumbnail
"
when
'Áudio'
then
audio_tag
(
learning_object
.
retrieve_link
,
controls:
true
)
when
'Vídeo'
then
video_tag
(
learning_object
.
retrieve_link
,
autobuffer:
true
,
poster:
learning_object
_
thumbnail
(
learning_object
)
)
when
'PDF'
then
"<iframe src=
\"
/pdfjs/web/viewer.html?file=
#{
learning_object
.
retrieve_link
}
\"
style=
\"
border: 0
\"
width=
\"
125%
\"
height=
\"
280
\"
frameborder=
\"
0
\"
scrolling=
\"
no
\"
></iframe>"
.
html_safe
else
image_tag
learning_object_thumbnail
(
learning_object
,
'
large
'
),
alt:
learning_object_title
(
learning_object
),
class:
'
thumbnail
'
end
end
...
...
@@ -18,53 +18,36 @@ module LearningObjectsHelper
end
def
learning_object_thumbnail
(
learning_object
,
size
=
""
)
if
learning_object
.
thumbnail
.
blank?
thumbnail
=
learning_object
.
default_thumbnail
return
thumbnail
unless
thumbnail
.
blank?
unless
learning_object
.
object_type
.
blank?
case
learning_object
.
object_type
.
name
when
'Vídeo'
then
'video.png'
when
'Imagem'
then
'image.png'
when
'Hipertexto'
then
'text.png'
when
'Animação/simulação'
then
'animation.png'
when
'Software Educacional'
then
'software.png'
when
'Áudio'
then
'audio.png'
when
'Experimento prático'
then
'simulator.png'
else
size
==
'large'
?
'learning-object-preview-large.png'
:
'learning-object-preview.png'
when
'Vídeo'
then
return
'video.png'
when
'Imagem'
then
return
'image.png'
when
'Hipertexto'
then
return
'text.png'
when
'Animação/simulação'
then
return
'animation.png'
when
'Software Educacional'
then
return
'software.png'
when
'Áudio'
then
return
'audio.png'
when
'Experimento prático'
then
return
'simulator.png'
end
else
learning_object
.
thumbnail
end
(
size
==
'large'
)
?
'learning-object-preview-large.png'
:
'learning-object-preview.png'
end
def
learning_object_title
(
learning_object
)
if
learning_object
.
name
.
nil?
return
'Sem Título'
end
learning_object
.
name
end
def
render_learning_object
(
orientation
,
learning_object
)
case
(
orientation
)
when
"vertical"
render
"learning_objects/learning_object_vertical"
,
learning_object:
learning_object
when
"horizontal"
render
"learning_objects/learning_object_horizontal"
,
learning_object:
learning_object
else
render
"learning_objects/learning_object_horizontal"
,
learning_object:
learning_object
when
'vertical'
then
render
'learning_objects/learning_object_vertical'
,
learning_object:
learning_object
when
'horizontal'
then
render
'learning_objects/learning_object_horizontal'
,
learning_object:
learning_object
else
render
'learning_objects/learning_object_horizontal'
,
learning_object:
learning_object
end
end
def
collections_list
(
learning_object
)
collections
=
@collections
.
diff
(
learning_object_collections
(
learning_object
))
end
def
social_share
(
learning_object
)
set_meta_tags
og:
{
title:
@learning_object
.
name
,
...
...
@@ -76,8 +59,5 @@ module LearningObjectsHelper
set_meta_tags
fb:
{
app_id:
'745857965514514'
}
end
end
This diff is collapsed.
Click to expand it.
app/models/learning_object.rb
+
9
−
1
View file @
9b0a8c01
...
...
@@ -22,7 +22,7 @@ class LearningObject < ActiveRecord::Base
validates_uniqueness_of
:id_dspace
searchkick
language:
'brazilian'
,
match: :word_start
,
searchable:
[
:name
,
:description
,
:author
,
:object_type
]
default_scope
{
includes
(
:object_type
).
order
(
score: :desc
)
}
default_scope
{
includes
(
:object_type
,
:attachments
,
:attachment
,
:publisher
,
:topics
).
order
(
score: :desc
)
}
scope
:missing_thumbnail
,
->
()
{
where
(
thumbnail_file_name:
nil
)
}
def
search_data
...
...
@@ -57,6 +57,14 @@ class LearningObject < ActiveRecord::Base
nil
end
def
default_thumbnail
return
thumbnail
unless
thumbnail
.
blank?
return
nil
if
attachments
.
blank?
return
default_attachment
.
thumbnail
unless
default_attachment
.
thumbnail
.
blank?
attachments
.
each
{
|
a
|
return
a
.
thumbnail
unless
a
.
thumbnail
.
blank?
}
nil
end
def
retrieve_link
"
#{
DspaceService
.
link
}
/rest
#{
default_attachment
.
retrieve_link
}
"
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment