From a02a8f4f69e5a8c9d28143a3a54343c7d8e7436b Mon Sep 17 00:00:00 2001
From: Mateus Rambo Strey <mars11@inf.ufpr.br>
Date: Wed, 21 Oct 2015 14:43:23 -0200
Subject: [PATCH] add video and audio visualization in learning object show

---
 .../application/learning_objects.scss           | 17 ++++++++++++++++-
 app/views/learning_objects/show.html.erb        | 10 +++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/app/assets/stylesheets/application/learning_objects.scss b/app/assets/stylesheets/application/learning_objects.scss
index 0d1853fad..17a1cd8bc 100644
--- a/app/assets/stylesheets/application/learning_objects.scss
+++ b/app/assets/stylesheets/application/learning_objects.scss
@@ -87,9 +87,24 @@ $background-grey: #e7e7e8;
 }
 
 .learning-object {
-  .thumbnail {
+  .view {
     width: 530px;
     height: 298px;
+    audio {
+      width: inherit;
+      position: relative;
+    	top: 50%;
+    	transform: translateY(-50%);
+    }
+    img {
+      width: inherit;
+      height: inherit;
+      border: 0;
+    }
+    video {
+      width: inherit;
+      height: inherit;
+    }
   }
   .stats {
     text-align: right;
diff --git a/app/views/learning_objects/show.html.erb b/app/views/learning_objects/show.html.erb
index a21298c24..03df92088 100644
--- a/app/views/learning_objects/show.html.erb
+++ b/app/views/learning_objects/show.html.erb
@@ -25,7 +25,15 @@
 
 <div class="row learning-object">
   <div class="col-md-7">
-    <%= learning_object_thumbnail @learning_object, "large" %>
+    <div class="view">
+      <%=
+        case @learning_object.type
+        when 'Áudio' then audio_tag(@learning_object.get_retrievelink, controls: true)
+        when 'Vídeo' then video_tag(@learning_object.get_retrievelink, controls: true, autobuffer: true, poster: @learning_object.thumbnail)
+        else learning_object_thumbnail @learning_object, "large"
+        end
+      %>
+    </div>
     <div class="pull-right" style="padding-right:122px">
       <span class="glyphicon glyphicon-eye-open"><%= @learning_object.views %>&nbsp;</span>
       <span class="glyphicon glyphicon-star"><%= @learning_object.likes %>&nbsp;</span>
-- 
GitLab