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
b531c73c
Commit
b531c73c
authored
9 years ago
by
Mauricio Giacomini Girardello
Browse files
Options
Downloads
Patches
Plain Diff
improve download button
parent
fa92ecab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/helpers/learning_objects_helper.rb
+52
-19
52 additions, 19 deletions
app/helpers/learning_objects_helper.rb
app/models/object_type.rb
+0
-8
0 additions, 8 deletions
app/models/object_type.rb
app/views/learning_objects/show.html.erb
+3
-3
3 additions, 3 deletions
app/views/learning_objects/show.html.erb
with
55 additions
and
30 deletions
app/helpers/learning_objects_helper.rb
+
52
−
19
View file @
b531c73c
...
...
@@ -2,10 +2,14 @@ module LearningObjectsHelper
def
display_object_type
(
learning_object
)
case
learning_object
.
default_attachment
.
mime_type
when
/audio\/*/i
then
audio_tag
(
learning_object
.
cache_link
,
controls:
true
)
when
/video\/mp4/i
then
video_tag
(
learning_object
.
cache_link
.
to_s
,
autobuffer:
true
,
poster:
learning_object_thumbnail
(
learning_object
))
when
/application\/(x-)?pdf/i
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
/audio\/*/i
then
audio_tag
(
learning_object
.
cache_link
,
controls:
true
)
when
/video\/mp4/i
then
video_tag
(
learning_object
.
cache_link
.
to_s
,
autobuffer:
true
,
poster:
learning_object_thumbnail
(
learning_object
))
when
/application\/(x-)?pdf/i
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
...
...
@@ -19,13 +23,20 @@ module LearningObjectsHelper
unless
learning_object
.
object_type
.
blank?
case
learning_object
.
object_type
.
name
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'
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
end
...
...
@@ -38,22 +49,44 @@ module LearningObjectsHelper
def
render_learning_object
(
orientation
,
learning_object
)
case
(
orientation
)
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
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
display_download_button
(
learning_object
)
return
external_website_btn
(
learning_object
)
if
learning_object
.
has_url_reference?
download_btn
learning_object
end
def
social_share
(
learning_object
)
set_meta_tags
og:
{
title:
learning_object
.
name
,
type:
'website'
,
description:
learning_object
.
description
,
image:
learning_object
.
default_thumbnail
title:
learning_object
.
name
,
type:
'website'
,
description:
learning_object
.
description
,
image:
learning_object
.
default_thumbnail
}
set_meta_tags
fb:
{
app_id:
'745857965514514'
app_id:
'745857965514514'
}
end
def
external_website_btn
(
learning_object
)
highlighted_btn
learning_object
.
url_reference
,
'Acessar website'
,
'fa-external-link'
end
def
download_btn
(
learning_object
)
highlighted_btn
download_learning_object_path
(
learning_object
),
'Download'
,
'fa-download'
end
def
highlighted_btn
(
url
,
_label
=
nil
,
_class
=
nil
)
link_to
url
,
class:
'download btn btn-success'
,
target:
"_blank"
do
"<i class='fa
#{
_class
}
'></i>
#{
_label
}
"
end
end
end
This diff is collapsed.
Click to expand it.
app/models/object_type.rb
+
0
−
8
View file @
b531c73c
# == Schema Information
#
# Table name: object_types
#
# id :integer not null, primary key
# name :string
#
class
ObjectType
<
ActiveRecord
::
Base
has_many
:learning_objects
has_and_belongs_to_many
:mime_types
...
...
This diff is collapsed.
Click to expand it.
app/views/learning_objects/show.html.erb
+
3
−
3
View file @
b531c73c
...
...
@@ -60,11 +60,11 @@
<div
class=
"rating-panel"
>
<%
if
user_signed_in?
%>
<div
class=
"actions"
>
<div
class=
"action download"
>
<%=
link_to
download_learning_object_path
,
class:
'download btn btn-success'
,
target:
"_blank"
do
%>
<i
class=
"fa fa-download"
></i>
FAZER DOWNLOAD
<%
end
%>
<%=
display_download_button
(
@learning_object
)
%>
</div>
<div
class=
"action"
>
<%=
link_to
like_learning_object_path
(
id:
@learning_object
.
id
),
class:
'vote btn btn-primary'
,
method: :post
,
remote:
true
do
%>
<%
if
@liked
%>
...
...
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