Commit 573969df00a4f3ae8f68e36fafc6403bf28b6ac7
1 parent
dd55e8f9
Exists in
master
and in
2 other branches
Move menu to partial
Showing
9 changed files
with
174 additions
and
26 deletions
Show diff stats
@@ -0,0 +1,62 @@ | @@ -0,0 +1,62 @@ | ||
1 | +.ribbon-wrapper-green { | ||
2 | + margin: 10px auto; | ||
3 | + width: 200px; | ||
4 | + height: 165px; | ||
5 | + overflow: hidden; | ||
6 | + top: -3px; | ||
7 | + right: -3px; | ||
8 | + | ||
9 | + padding-top: 3px; | ||
10 | +} | ||
11 | + | ||
12 | +.ribbon-content img { | ||
13 | + border-radius: 3px; | ||
14 | + -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); | ||
15 | + -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); | ||
16 | + box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); | ||
17 | + | ||
18 | + width: 200px; | ||
19 | + height: 160px; | ||
20 | +} | ||
21 | + | ||
22 | +.ribbon-green { | ||
23 | + font: bold 15px Sans-Serif; | ||
24 | + color: #333; | ||
25 | + text-align: center; | ||
26 | + text-shadow: rgba(255,255,255,0.5) 0px 1px 0px; | ||
27 | + -webkit-transform: rotate(45deg); | ||
28 | + -moz-transform: rotate(45deg); | ||
29 | + -ms-transform: rotate(45deg); | ||
30 | + -o-transform: rotate(45deg); | ||
31 | + position: relative; | ||
32 | + padding: 5px 0; | ||
33 | + left: 118px; | ||
34 | + bottom: 150px; | ||
35 | + width: 110px; | ||
36 | + background-color: #BFDC7A; | ||
37 | + background-image: -webkit-gradient(linear, left top, left bottom, from(#BFDC7A), to(#8EBF45)); | ||
38 | + background-image: -webkit-linear-gradient(top, #BFDC7A, #8EBF45); | ||
39 | + background-image: -moz-linear-gradient(top, #BFDC7A, #8EBF45); | ||
40 | + background-image: -ms-linear-gradient(top, #BFDC7A, #8EBF45); | ||
41 | + background-image: -o-linear-gradient(top, #BFDC7A, #8EBF45); | ||
42 | + color: #6a6340; | ||
43 | + -webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.3); | ||
44 | + -moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.3); | ||
45 | + box-shadow: 0px 0px 3px rgba(0,0,0,0.3); | ||
46 | +} | ||
47 | + | ||
48 | +.ribbon-green:before, .ribbon-green:after { | ||
49 | + content: ""; | ||
50 | + border-top: 3px solid #6e8900; | ||
51 | + border-left: 3px solid transparent; | ||
52 | + border-right: 3px solid transparent; | ||
53 | + position:absolute; | ||
54 | + bottom: -3px; | ||
55 | +} | ||
56 | + | ||
57 | +.ribbon-green:before { | ||
58 | + left: 0; | ||
59 | +} | ||
60 | +.ribbon-green:after { | ||
61 | + right: 0; | ||
62 | +} | ||
0 | \ No newline at end of file | 63 | \ No newline at end of file |
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +.video-instructions { | ||
2 | + display: block; | ||
3 | + width: 100%; | ||
4 | + | ||
5 | + -moz-box-shadow: 0 0 5px 5px #888; | ||
6 | + -webkit-box-shadow: 0 0 5px 5px #888; | ||
7 | + box-shadow: 0 0 5px 5px #888; | ||
8 | +} | ||
9 | + | ||
10 | +.video-vlibras { | ||
11 | + max-width: 50%; | ||
12 | +} | ||
13 | + | ||
14 | +.video-js { | ||
15 | + width: 100%; | ||
16 | +} | ||
0 | \ No newline at end of file | 17 | \ No newline at end of file |
app/controllers/v_libras/requests_controller.rb
1 | class VLibras::RequestsController < ApplicationController | 1 | class VLibras::RequestsController < ApplicationController |
2 | - protect_from_forgery with: :null_session, :only => [ :callback ] | ||
3 | before_filter :check_vlibras_api_status, :only => [ :rapid, :create ] | 2 | before_filter :check_vlibras_api_status, :only => [ :rapid, :create ] |
4 | 3 | ||
5 | - before_filter :authenticate_user! | 4 | + protect_from_forgery with: :null_session, :only => [ :callback ] |
5 | + before_filter :authenticate_user!, :except => [ :callback ] | ||
6 | 6 | ||
7 | def rapid | 7 | def rapid |
8 | @request = VLibras::Request.new | 8 | @request = VLibras::Request.new |
app/helpers/application_helper.rb
@@ -46,8 +46,8 @@ module ApplicationHelper | @@ -46,8 +46,8 @@ module ApplicationHelper | ||
46 | :data => { 'toggle' => "tooltip" }, :title => request.response) | 46 | :data => { 'toggle' => "tooltip" }, :title => request.response) |
47 | end | 47 | end |
48 | 48 | ||
49 | - def custom_video_tag(video) | ||
50 | - html5_video_tag('/video.mp4', "#video_#{video.id}") | 49 | + def custom_video_tag(video, classes = nil) |
50 | + html5_video_tag(video.url_mp4, "video_#{video.id}", classes) | ||
51 | end | 51 | end |
52 | 52 | ||
53 | def html5_video_tag(url, id, classes = nil, *args) | 53 | def html5_video_tag(url, id, classes = nil, *args) |
app/models/v_libras/video.rb
@@ -23,8 +23,18 @@ class VLibras::Video < ActiveRecord::Base | @@ -23,8 +23,18 @@ class VLibras::Video < ActiveRecord::Base | ||
23 | self.update!(:seen => true) unless self.seen | 23 | self.update!(:seen => true) unless self.seen |
24 | end | 24 | end |
25 | 25 | ||
26 | + def thumb | ||
27 | + self.url.gsub('flv', 'png') | ||
28 | + end | ||
29 | + | ||
30 | + def url_mp4 | ||
31 | + self.url.gsub('flv', 'mp4') | ||
32 | + end | ||
33 | + | ||
26 | protected | 34 | protected |
27 | def default_values | 35 | def default_values |
28 | self.seen = false if self.seen.nil? | 36 | self.seen = false if self.seen.nil? |
37 | + | ||
38 | + return true | ||
29 | end | 39 | end |
30 | end | 40 | end |
@@ -0,0 +1,58 @@ | @@ -0,0 +1,58 @@ | ||
1 | +.navbar.navbar-fixed-top | ||
2 | + .navbar-inner | ||
3 | + .container-fluid | ||
4 | + %a.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse"} | ||
5 | + | ||
6 | + = link_to "GTAaaS", home_path, :class => "brand" | ||
7 | + | ||
8 | + - if current_user.present? | ||
9 | + .nav-collapse | ||
10 | + %ul.nav | ||
11 | + %li= link_to t('shared.main'), home_path | ||
12 | + | ||
13 | + %li.dropdown | ||
14 | + %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"} | ||
15 | + = t('shared.vlibras') | ||
16 | + - if current_user.videos.not_seen.any? | ||
17 | + %span.label.label-success Novo vídeo! | ||
18 | + %strong.caret | ||
19 | + %ul.dropdown-menu | ||
20 | + %li | ||
21 | + = link_to v_libras_videos_path do | ||
22 | + = t('wikivideos.my_videos') | ||
23 | + - if current_user.videos.not_seen.any? | ||
24 | + %span.label.label-success= current_user.videos.not_seen.size | ||
25 | + %li= link_to t('videos.new'), '#' | ||
26 | + %li.divider | ||
27 | + %li= link_to t('shared.form_alternative'), rapid_v_libras_requests_path | ||
28 | + | ||
29 | + %li.dropdown.hidden | ||
30 | + %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"} | ||
31 | + = t('shared.wikilibras') | ||
32 | + %strong.caret | ||
33 | + %ul.dropdown-menu | ||
34 | + %li= link_to t('wikivideos.my_signals'), '#' | ||
35 | + %li= link_to t('wikivideos.cadastro_sinal'), '#' | ||
36 | + %li.divider | ||
37 | + %li= link_to t('wikivideos.dicionario_de_dados'), '#' | ||
38 | + | ||
39 | + %li.hidden= link_to t('shared.slibras') | ||
40 | + | ||
41 | + %li= link_to t('shared.about'), "http://gtaaas.lavid.ufpb.br/projeto", :target => "blank" | ||
42 | + | ||
43 | + - if current_user.present? | ||
44 | + %ul.nav.pull-right | ||
45 | + %li.dropdown | ||
46 | + %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"} | ||
47 | + = current_user.name | ||
48 | + %strong.caret | ||
49 | + %ul.dropdown-menu | ||
50 | + %li= link_to t('shared.edit'), '' | ||
51 | + %li.divider | ||
52 | + %li= link_to t('shared.logout'), destroy_user_session_path, :method => 'delete' | ||
53 | + | ||
54 | + / | ||
55 | + <ul class="nav secondary-nav"> | ||
56 | + <li><haml_loud> link_to image_tag('pt.png'), url_for( :locale => 'pt' ), :title => "Português" </haml_loud></li> | ||
57 | + <li><haml_loud> link_to image_tag('en.png'), url_for( :locale => 'en' ), :title => 'English' </haml_loud></li> | ||
58 | + </ul> | ||
0 | \ No newline at end of file | 59 | \ No newline at end of file |
app/views/v_libras/videos/index.haml
@@ -11,35 +11,37 @@ | @@ -11,35 +11,37 @@ | ||
11 | .span4 | 11 | .span4 |
12 | .ribbon-wrapper-green | 12 | .ribbon-wrapper-green |
13 | .ribbon-content | 13 | .ribbon-content |
14 | - = link_to image_tag("avatar.png"), video | 14 | + = link_to image_tag(video.thumb), video |
15 | - unless video.seen | 15 | - unless video.seen |
16 | .ribbon-green Novo | 16 | .ribbon-green Novo |
17 | 17 | ||
18 | %p | 18 | %p |
19 | - = link_to video_path(video), class: "btn btn-success" do | 19 | + = link_to video.url_mp4, class: "btn btn-success" do |
20 | = content_tag(:span, '', :class => 'icon-download icon-white') | 20 | = content_tag(:span, '', :class => 'icon-download icon-white') |
21 | Baixar | 21 | Baixar |
22 | 22 | ||
23 | = link_to content_tag(:span, '', :class => 'icon-trash icon-white'), v_libras_video_path(video), method: :delete, | 23 | = link_to content_tag(:span, '', :class => 'icon-trash icon-white'), v_libras_video_path(video), method: :delete, |
24 | class: "btn btn-danger", data: { confirm: t('shared.confirm_delete') } | 24 | class: "btn btn-danger", data: { confirm: t('shared.confirm_delete') } |
25 | 25 | ||
26 | -.breadcrumb.requests | ||
27 | - %h4= t('requests.list') | ||
28 | - | ||
29 | -.row-fluid | ||
30 | - .span8.offset2 | ||
31 | - %table.table.table-hover.table-striped.table-requests | ||
32 | - %thead | ||
33 | - %tr | ||
34 | - %th Situação | ||
35 | - %th Vídeo | ||
36 | - %th Criado há | ||
37 | - | ||
38 | - - @requests.each do |request| | ||
39 | - %tr | ||
40 | - %td.span2= request_status_label(request) | ||
41 | - %td.span5= request.video_filename | ||
42 | - %td.span5= time_ago_in_words(request.created_at) | 26 | + |
27 | +- if @requests.any? | ||
28 | + .breadcrumb.requests | ||
29 | + %h4= t('requests.list') | ||
30 | + | ||
31 | + .row-fluid | ||
32 | + .span8.offset2 | ||
33 | + %table.table.table-hover.table-striped.table-requests | ||
34 | + %thead | ||
35 | + %tr | ||
36 | + %th Situação | ||
37 | + %th Vídeo | ||
38 | + %th Criado há | ||
39 | + | ||
40 | + - @requests.each do |request| | ||
41 | + %tr | ||
42 | + %td.span2= request_status_label(request) | ||
43 | + %td.span5= request.video_filename | ||
44 | + %td.span5= time_ago_in_words(request.created_at) | ||
43 | 45 | ||
44 | 46 | ||
45 | 47 |
app/views/v_libras/videos/show.haml
@@ -2,4 +2,4 @@ | @@ -2,4 +2,4 @@ | ||
2 | %h3= "Vídeo #{@video.request.video_filename}" | 2 | %h3= "Vídeo #{@video.request.video_filename}" |
3 | 3 | ||
4 | .row.text-center | 4 | .row.text-center |
5 | - = custom_video_tag(@video) | ||
6 | \ No newline at end of file | 5 | \ No newline at end of file |
6 | + = custom_video_tag(@video, 'video-vlibras') | ||
7 | \ No newline at end of file | 7 | \ No newline at end of file |
lib/api_client/callback_processor.rb
@@ -10,10 +10,10 @@ class ApiClient::CallbackProcessor | @@ -10,10 +10,10 @@ class ApiClient::CallbackProcessor | ||
10 | Rails.logger.debug "[VLibras::Callback] OK: #{params}" | 10 | Rails.logger.debug "[VLibras::Callback] OK: #{params}" |
11 | 11 | ||
12 | request.update!(:status => 'success') | 12 | request.update!(:status => 'success') |
13 | - request.create_video(:url => params['response']) | 13 | + request.create_video!(:url => params['response']) |
14 | end | 14 | end |
15 | 15 | ||
16 | Rails.logger.debug "[VLibras::Callback] Notifying websocket channel" | 16 | Rails.logger.debug "[VLibras::Callback] Notifying websocket channel" |
17 | - WebsocketRails[:requests_update].trigger(:update, {a: :b, c: :d}) | 17 | + WebsocketRails[:requests_update].trigger(:update, {}) |
18 | end | 18 | end |
19 | end | 19 | end |
20 | \ No newline at end of file | 20 | \ No newline at end of file |