Commit ac12e6b907e39eee93c7e4c00db014639874eb46

Authored by Fernando Brito
1 parent d417f408
Exists in master and in 2 other branches v2, wikilibras

Video#show and responsive design

app/assets/stylesheets/bootstrap.css.less
... ... @@ -13,11 +13,6 @@
13 13 @linkColor: #888;
14 14 @linkColorHover: darken(@linkColor, 15%);
15 15  
16   -
17   -body{
18   - margin-top:80px;
19   -}
20   -
21 16 footer {
22 17 background-color: #d6d6d6;
23 18 text-align:center;
... ...
app/assets/stylesheets/bootstrap_overrides.css.scss
... ... @@ -48,4 +48,5 @@
48 48 .login {
49 49 padding: 3% 5%;
50 50 margin: 10px 35% 30px;
  51 + text-align: center;
51 52 }
52 53 \ No newline at end of file
... ...
app/controllers/application_controller.rb
... ... @@ -7,7 +7,7 @@ protected
7 7 def check_vlibras_api_status
8 8 unless ApiClient.check_status
9 9 flash[:error] = t('error.api.offline')
10   - redirect_to home_path
  10 + # redirect_to home_path
11 11 end
12 12 end
13 13  
... ...
app/controllers/v_libras/videos_controller.rb
1 1 class VLibras::VideosController < InheritedResources::Base
2   - actions :destroy
  2 + actions :show, :destroy
3 3  
4   - before_filter :check_vlibras_api_status, :only => [ :index ]
  4 + before_filter :check_vlibras_api_status, :only => [ :index, :show ]
5 5 before_filter :authenticate_user!
6 6  
7 7 def index
... ...
app/helpers/application_helper.rb
... ... @@ -46,4 +46,11 @@ module ApplicationHelper
46 46 :data => { 'toggle' => "tooltip" }, :title => request.response)
47 47 end
48 48  
  49 + def custom_video_tag(video)
  50 + content_tag(:video, :id => "video_#{video.id}", :class => 'video-js vjs-default skin',
  51 + :controls => 'controls', :preload => 'auto', :width => '100%') do
  52 + content_tag(:source, '', :src => '/video.mp4', :type => 'video/mp4')
  53 + end
  54 + end
  55 +
49 56 end
... ...
app/views/layouts/application.html.erb
... ... @@ -6,6 +6,11 @@
6 6 <%= javascript_include_tag "application" %>
7 7 <%= yield :js %>
8 8 <%= csrf_meta_tags %>
  9 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10 +
  11 + <script type="text/javascript">
  12 + document.createElement('video');document.createElement('audio');document.createElement('track');
  13 + </script>
9 14 </head>
10 15 <body>
11 16 <div class="navbar navbar-fixed-top">
... ... @@ -72,14 +77,13 @@
72 77 </div>
73 78 </div>
74 79  
75   -<div class="container">
  80 +<div class="container-fluid">
76 81 <% if content_for?(:menu) %>
77 82 <div class="breadcrumb">
78 83 <%= yield :menu %>
79 84 </div>
80 85 <% end %>
81 86  
82   -
83 87 <% flash.each do |type, message| %>
84 88 <div class="alert <%= bootstrap_class_for(type) %> fade in">
85 89 <button class="close" data-dismiss="alert">×</button>
... ... @@ -93,5 +97,9 @@
93 97 <p>GTAaaS - <%= t('shared.project') %> <a href="http://gtaaas.lavid.ufpb.br" target="_blank">LAVID</a> | &copy; <%= Time.now.year %>. <%= t('shared.copyright') %>.</p>
94 98 </footer>
95 99 </div>
  100 +
  101 +<link href="//vjs.zencdn.net/4.6/video-js.css" rel="stylesheet">
  102 +<script src="//vjs.zencdn.net/4.6/video.js"></script>
  103 +
96 104 </body>
97 105 </html>
... ...
app/views/v_libras/requests/rapid.haml
1 1 - content_for :js do
2 2 = javascript_include_tag "v_libras/requests/rapid"
3 3  
4   -.login
5   - %h2
6   - = t('videos.new')
  4 +.row-fluid
  5 + .span4.offset4.login
  6 + %h2
  7 + = t('videos.new')
7 8  
8   - = form_tag v_libras_requests_path, method: :post, :multipart => true do |f|
9   - - if @request.errors.any?
10   - #error_explanation
11   - %p/
12   - %h4
13   - = pluralize(@request.errors.count, "erro")
14   - impede o vídeo de ser salvo:
15   - %ul
16   - - @request.errors.full_messages.each do |msg|
17   - %li.error= msg
  9 + = form_tag v_libras_requests_path, method: :post, :multipart => true do |f|
  10 + - if @request.errors.any?
  11 + #error_explanation
  12 + %p/
  13 + %h4
  14 + = pluralize(@request.errors.count, "erro")
  15 + impede o vídeo de ser salvo:
  16 + %ul
  17 + - @request.errors.full_messages.each do |msg|
  18 + %li.error= msg
18 19  
19   - .field
20   - = label_tag :service, t('videos.video_type'), :class => 'bold'
  20 + .field
  21 + = label_tag :service, t('videos.video_type'), :class => 'bold'
21 22  
22   - %label.radio
23   - = radio_button_tag :service, 'video', false, :id => 'service-video'
24   - Voz
25   - %label.radio
26   - = radio_button_tag :service, 'video-legenda', false, :id => 'service-video-subtitle'
27   - Legenda (.SRT)
  23 + %label.radio
  24 + = radio_button_tag :service, 'video', false, :id => 'service-video'
  25 + Voz
  26 + %label.radio
  27 + = radio_button_tag :service, 'video-legenda', false, :id => 'service-video-subtitle'
  28 + Legenda (.SRT)
28 29  
29   - #url.hide
30   - = label_tag :video, t('videos.url'), :class => "bold"
31   - = file_field_tag :video, :onchange => "return check_video(this)"
32   - #legend.hide
33   - = label_tag :subtitle, t('videos.subtitle'), :class => "bold"
34   - = file_field_tag :subtitle, :prompt => "LEGENDA", :onchange => "return check_subtitle(this)"
35   - .field
36   - = label_tag 'params[tamanho]', t('videos.window_size'), :class => "bold"
37   - = select_tag 'params[tamanho]', options_for_select([['Pequena', 'pequeno'], ['Média', 'medio'], ['Grande', 'grande']])
38   - .field
39   - %p
40   - %b
41   - = label_tag 'params[posicao]', t('videos.window_position'), :class => "bold"
42   - = select_tag 'params[posicao]', options_for_select([[t('videos.top_left'),
43   - 'superior-esquerdo'], [t('videos.top_right'), 'superior-direito'],
44   - [t('videos.bottom_right'),'inferior-direito'], [t('videos.bottom_left'), 'inferior-esquerdo']])
45   - .field
46   - = label_tag 'params[transparencia]', t('videos.transparency'), :class => "bold"
47   - = select_tag 'params[transparencia]', options_for_select([['Opaco', 'opaco'], ['Transparente', 'transparente']])
48   - = submit_tag "Confirmar", :class => "btn btn-primary actions"
  30 + #url.hide
  31 + = label_tag :video, t('videos.url'), :class => "bold"
  32 + = file_field_tag :video, :onchange => "return check_video(this)"
  33 + #legend.hide
  34 + = label_tag :subtitle, t('videos.subtitle'), :class => "bold"
  35 + = file_field_tag :subtitle, :prompt => "LEGENDA", :onchange => "return check_subtitle(this)"
  36 + .field
  37 + = label_tag 'params[tamanho]', t('videos.window_size'), :class => "bold"
  38 + = select_tag 'params[tamanho]', options_for_select([['Pequena', 'pequeno'], ['Média', 'medio'], ['Grande', 'grande']])
  39 + .field
  40 + %p
  41 + %b
  42 + = label_tag 'params[posicao]', t('videos.window_position'), :class => "bold"
  43 + = select_tag 'params[posicao]', options_for_select([[t('videos.top_left'),
  44 + 'superior-esquerdo'], [t('videos.top_right'), 'superior-direito'],
  45 + [t('videos.bottom_right'),'inferior-direito'], [t('videos.bottom_left'), 'inferior-esquerdo']])
  46 + .field
  47 + = label_tag 'params[transparencia]', t('videos.transparency'), :class => "bold"
  48 + = select_tag 'params[transparencia]', options_for_select([['Opaco', 'opaco'], ['Transparente', 'transparente']])
  49 + = submit_tag "Confirmar", :class => "btn btn-primary actions"
49 50  
... ...
app/views/v_libras/videos/index.haml
... ... @@ -4,21 +4,23 @@
4 4 .breadcrumb
5 5 %h3= t('videos.list')
6 6  
7   -.row.text-center
8   - - @videos.each do |video|
9   - .span4
10   - .ribbon-wrapper-green
11   - .ribbon-content
12   - = link_to image_tag("avatar.png"), video.url
13   - .ribbon-green Novo
14   -
15   - %p
16   - = link_to video_path(video), class: "btn btn-success" do
17   - = content_tag(:span, '', :class => 'icon-download icon-white')
18   - Baixar
19   -
20   - = link_to content_tag(:span, '', :class => 'icon-trash icon-white'), v_libras_video_path(video), method: :delete,
21   - class: "btn btn-danger", data: { confirm: t('shared.confirm_delete') }
  7 +
  8 +- @videos.in_groups_of(3, false) do |group|
  9 + .row-fluid.text-center
  10 + - for video in group
  11 + .span4
  12 + .ribbon-wrapper-green
  13 + .ribbon-content
  14 + = link_to image_tag("avatar.png"), video
  15 + .ribbon-green Novo
  16 +
  17 + %p
  18 + = link_to video_path(video), class: "btn btn-success" do
  19 + = content_tag(:span, '', :class => 'icon-download icon-white')
  20 + Baixar
  21 +
  22 + = link_to content_tag(:span, '', :class => 'icon-trash icon-white'), v_libras_video_path(video), method: :delete,
  23 + class: "btn btn-danger", data: { confirm: t('shared.confirm_delete') }
22 24  
23 25 .breadcrumb.requests
24 26 %h4= t('requests.list')
... ...
config/routes.rb
... ... @@ -17,7 +17,7 @@ Rails.application.routes.draw do
17 17 post 'callback', on: :collection
18 18 end
19 19  
20   - resources :videos, :only => [ :index, :destroy ]
  20 + resources :videos, :only => [ :index, :show, :destroy ]
21 21  
22 22  
23 23 end
... ...