Commit 293d91acd1578c95f352d373907846f51cac1dcb
1 parent
a376db6e
Exists in
master
and in
2 other branches
Menu. Javascript for workflow
Showing
8 changed files
with
83 additions
and
22 deletions
Show diff stats
app/assets/javascripts/v_libras/requests/new.js
@@ -36,6 +36,8 @@ $(function () { | @@ -36,6 +36,8 @@ $(function () { | ||
36 | 36 | ||
37 | function finished(event, currentIndex) { | 37 | function finished(event, currentIndex) { |
38 | $("#vlibras-form").submit(); | 38 | $("#vlibras-form").submit(); |
39 | + $("#btn-next").text("Enviando..."); | ||
40 | + deactivateNextButton(); | ||
39 | } | 41 | } |
40 | 42 | ||
41 | function stepValidation(event, currentIndex, newIndex) { | 43 | function stepValidation(event, currentIndex, newIndex) { |
@@ -62,17 +64,36 @@ $(function () { | @@ -62,17 +64,36 @@ $(function () { | ||
62 | $("#btn-next").prop('disabled', true); | 64 | $("#btn-next").prop('disabled', true); |
63 | } | 65 | } |
64 | 66 | ||
67 | + $(".btn-window-position").click(function() { | ||
68 | + $("#vlibras-form").addHidden('params[posicao]', $(this).data("value")); | ||
69 | + $("#vlibras-form").addHidden('params[transparencia]', 'opaco'); | ||
70 | + activateNextButton(); | ||
71 | + | ||
72 | + return false; | ||
73 | + }); | ||
74 | + | ||
75 | + $(".btn-window-size").click(function() { | ||
76 | + $("#vlibras-form").addHidden('params[tamanho]', $(this).data("value")); | ||
77 | + activateNextButton(); | ||
78 | + | ||
79 | + return false; | ||
80 | + }); | ||
81 | + | ||
65 | 82 | ||
66 | 83 | ||
67 | /* | 84 | /* |
68 | * Validates video and subtitle extension and activate the next button | 85 | * Validates video and subtitle extension and activate the next button |
69 | */ | 86 | */ |
70 | - $("#vlibras-wizard #subtitle-upload").change(function() { | 87 | + $("#vlibras-form #subtitle-upload").change(function() { |
88 | + $("#vlibras-form").addHidden('service', 'video-legenda'); | ||
89 | + | ||
71 | var acceptedFileTypes = ["srt"]; | 90 | var acceptedFileTypes = ["srt"]; |
72 | validateFileWizard($(this), acceptedFileTypes); | 91 | validateFileWizard($(this), acceptedFileTypes); |
73 | }); | 92 | }); |
74 | 93 | ||
75 | - $("#vlibras-wizard #video-upload").change(function() { | 94 | + $("#vlibras-form #video-upload").change(function() { |
95 | + $("#vlibras-form").addHidden('service', 'video'); | ||
96 | + | ||
76 | var acceptedFileTypes = ["flv", "ts", "avi", "mp4", "mov", "webm", "wmv", "mkv"]; | 97 | var acceptedFileTypes = ["flv", "ts", "avi", "mp4", "mov", "webm", "wmv", "mkv"]; |
77 | validateFileWizard($(this), acceptedFileTypes); | 98 | validateFileWizard($(this), acceptedFileTypes); |
78 | }); | 99 | }); |
app/assets/javascripts/v_libras/requests/shared.js
@@ -10,4 +10,13 @@ function checkType(file, acceptedFileTypes) { | @@ -10,4 +10,13 @@ function checkType(file, acceptedFileTypes) { | ||
10 | } | 10 | } |
11 | 11 | ||
12 | return isValidFile; | 12 | return isValidFile; |
13 | -} | ||
14 | \ No newline at end of file | 13 | \ No newline at end of file |
14 | +} | ||
15 | + | ||
16 | +// This must be applied to a form (or an object inside a form). | ||
17 | +// http://stackoverflow.com/questions/2530635/jquery-add-additional-parameters-on-submit-not-ajax | ||
18 | +jQuery.fn.addHidden = function (name, value) { | ||
19 | + return this.each(function () { | ||
20 | + var input = $("<input>").attr("type", "hidden").attr("name", name).val(value); | ||
21 | + $(this).append($(input)); | ||
22 | + }); | ||
23 | +}; | ||
15 | \ No newline at end of file | 24 | \ No newline at end of file |
app/assets/stylesheets/components/ribbon.css.scss
1 | +$ribbonUpperColor: #2A632B; | ||
2 | +$ribbonBottomColor: #6D972D; | ||
3 | + | ||
1 | .ribbon-wrapper-green { | 4 | .ribbon-wrapper-green { |
2 | margin: 10px auto; | 5 | margin: 10px auto; |
3 | - width: 200px; | 6 | + width: 205px; |
4 | height: 165px; | 7 | height: 165px; |
5 | overflow: hidden; | 8 | overflow: hidden; |
6 | top: -3px; | 9 | top: -3px; |
@@ -10,7 +13,7 @@ | @@ -10,7 +13,7 @@ | ||
10 | } | 13 | } |
11 | 14 | ||
12 | .ribbon-content img { | 15 | .ribbon-content img { |
13 | - border-radius: 3px; | 16 | + border-radius: 30px; |
14 | -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); | 17 | -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); | 18 | -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); |
16 | box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); | 19 | box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); |
@@ -21,25 +24,25 @@ | @@ -21,25 +24,25 @@ | ||
21 | 24 | ||
22 | .ribbon-green { | 25 | .ribbon-green { |
23 | font: bold 15px Sans-Serif; | 26 | font: bold 15px Sans-Serif; |
24 | - color: #333; | 27 | + color: #fff; |
25 | text-align: center; | 28 | text-align: center; |
26 | - text-shadow: rgba(255,255,255,0.5) 0px 1px 0px; | 29 | + text-shadow: rgba(0, 0, 0, 1) 0px 1px 0px; |
27 | -webkit-transform: rotate(45deg); | 30 | -webkit-transform: rotate(45deg); |
28 | -moz-transform: rotate(45deg); | 31 | -moz-transform: rotate(45deg); |
29 | -ms-transform: rotate(45deg); | 32 | -ms-transform: rotate(45deg); |
30 | -o-transform: rotate(45deg); | 33 | -o-transform: rotate(45deg); |
31 | position: relative; | 34 | position: relative; |
32 | padding: 5px 0; | 35 | padding: 5px 0; |
33 | - left: 118px; | ||
34 | - bottom: 150px; | 36 | + left: 122px; |
37 | + bottom: 148px; | ||
35 | width: 110px; | 38 | width: 110px; |
39 | + | ||
36 | background-color: #BFDC7A; | 40 | 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; | 41 | + background-image: -webkit-gradient(linear, left top, left bottom, from($ribbonUpperColor), to($ribbonBottomColor)); |
42 | + background-image: -webkit-linear-gradient(top, $ribbonUpperColor, $ribbonBottomColor); | ||
43 | + background-image: -moz-linear-gradient(top, $ribbonUpperColor, $ribbonBottomColor); | ||
44 | + background-image: -ms-linear-gradient(top, $ribbonUpperColor, $ribbonBottomColor); | ||
45 | + background-image: -o-linear-gradient(top, $ribbonUpperColor, $ribbonBottomColor); | ||
43 | -webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.3); | 46 | -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); | 47 | -moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.3); |
45 | box-shadow: 0px 0px 3px rgba(0,0,0,0.3); | 48 | box-shadow: 0px 0px 3px rgba(0,0,0,0.3); |
app/controllers/v_libras/requests_controller.rb
1 | class VLibras::RequestsController < ApplicationController | 1 | class VLibras::RequestsController < ApplicationController |
2 | - before_filter :check_vlibras_api_status, :only => [ :rapid, :create ] | ||
3 | - | ||
4 | protect_from_forgery with: :null_session, :only => [ :callback ] | 2 | protect_from_forgery with: :null_session, :only => [ :callback ] |
3 | + | ||
5 | before_filter :authenticate_user!, :except => [ :callback ] | 4 | before_filter :authenticate_user!, :except => [ :callback ] |
5 | + before_filter :check_vlibras_api_status, :except => [ :callback ] | ||
6 | 6 | ||
7 | def rapid | 7 | def rapid |
8 | @request = VLibras::Request.new | 8 | @request = VLibras::Request.new |
@@ -25,6 +25,7 @@ class VLibras::RequestsController < ApplicationController | @@ -25,6 +25,7 @@ class VLibras::RequestsController < ApplicationController | ||
25 | flash[:error] = 'Algo deu errado com a sua requisição. Por favor verifique opções escolhidas.' | 25 | flash[:error] = 'Algo deu errado com a sua requisição. Por favor verifique opções escolhidas.' |
26 | flash[:warning] = @request.errors.full_messages.to_sentence.humanize | 26 | flash[:warning] = @request.errors.full_messages.to_sentence.humanize |
27 | 27 | ||
28 | + # Warning: this code is also present on #perform_request, if the request is successfully done | ||
28 | @request.files.values.each { |f| f.file.delete } | 29 | @request.files.values.each { |f| f.file.delete } |
29 | 30 | ||
30 | redirect_to :back | 31 | redirect_to :back |
app/models/v_libras/request.rb
@@ -67,6 +67,7 @@ class VLibras::Request < ActiveRecord::Base | @@ -67,6 +67,7 @@ class VLibras::Request < ActiveRecord::Base | ||
67 | 67 | ||
68 | ApiClient::Client.submit(self, files) | 68 | ApiClient::Client.submit(self, files) |
69 | 69 | ||
70 | + # Warning: this code is also present on the controller, if there is an error | ||
70 | files.values.each { |f| f.file.delete } | 71 | files.values.each { |f| f.file.delete } |
71 | 72 | ||
72 | logger.debug '[VLibras::Request] Request done' | 73 | logger.debug '[VLibras::Request] Request done' |
app/views/devise/sessions/new.html.haml
1 | .row-fluid | 1 | .row-fluid |
2 | - .span5.offset1 | ||
3 | - = html5_video_tag('/video.mp4', 'login', 'video-instructions', :autoplay => 'autoplay') | 2 | + .span7 |
3 | + = html5_video_tag('/system/videos/login.mp4', 'login', 'video-instructions', :autoplay => 'autoplay') | ||
4 | 4 | ||
5 | .span4.offset1.login | 5 | .span4.offset1.login |
6 | %h2 Entrar | 6 | %h2 Entrar |
app/views/static/home.haml
1 | .breadcrumb | 1 | .breadcrumb |
2 | - %h1 Menu | ||
3 | \ No newline at end of file | 2 | \ No newline at end of file |
3 | + %h1 Menu | ||
4 | + | ||
5 | +.hero-unit | ||
6 | + .row-fluid | ||
7 | + .span4 | ||
8 | + = html5_video_tag('/system/videos/vlibras.mp4', 'video-vlibras', 'video-instructions', :autoplay => 'autoplay') | ||
9 | + %br/ | ||
10 | + %h2= link_to "V-LIBRAS", new_v_libras_request_path | ||
11 | + %p Coloque o seu vídeo e torne-o acessível. | ||
12 | + | ||
13 | + .span4.hidden | ||
14 | + = html5_video_tag('/system/videos/wikilibras.mp4', 'video-wikilibras', 'video-instructions') | ||
15 | + %br/ | ||
16 | + %h2= link_to "WIKILIBRAS", '#' | ||
17 | + %p Contribua com sinais de LIBRAS para o nosso banco de dados. | ||
18 | + | ||
19 | + .span4.hidden | ||
20 | + = html5_video_tag('/system/videos/slibras.mp4', 'video-slibras', 'video-instructions') | ||
21 | + %br/ | ||
22 | + %h2= link_to "S-LIBRAS", '#' | ||
23 | + %p Edite a legenda dos vídeos já acessíveis | ||
4 | \ No newline at end of file | 24 | \ No newline at end of file |
app/views/v_libras/requests/new.haml
@@ -32,15 +32,21 @@ | @@ -32,15 +32,21 @@ | ||
32 | 32 | ||
33 | .span4 | 33 | .span4 |
34 | = file_field_tag 'subtitle', :id => 'subtitle-upload' | 34 | = file_field_tag 'subtitle', :id => 'subtitle-upload' |
35 | + | ||
35 | %h2 Posição | 36 | %h2 Posição |
36 | %section | 37 | %section |
37 | %p | 38 | %p |
38 | - asd | 39 | + = button_tag 'Superior Esquerdo', :class => 'btn btn-large btn-window-position', :data => { :value => 'superior-esquerdo' } |
40 | + = button_tag 'Superior Direito', :class => 'btn btn-large btn-window-position', :data => { :value => 'superior-direito' } | ||
41 | + = button_tag 'Inferior Direito', :class => 'btn btn-large btn-window-position', :data => { :value => 'inferior-direito' } | ||
42 | + = button_tag 'Inferior Esquerdo', :class => 'btn btn-large btn-window-position', :data => { :value => 'inferior-esquerdo' } | ||
39 | 43 | ||
40 | %h2 Tamanho | 44 | %h2 Tamanho |
41 | %section | 45 | %section |
42 | %p | 46 | %p |
43 | - botão de | 47 | + = button_tag 'Pequeno', :class => 'btn btn-large btn-window-size', :data => { :value => 'pequeno' } |
48 | + = button_tag 'Médio', :class => 'btn btn-large btn-window-size', :data => { :value => 'medio' } | ||
49 | + = button_tag 'Grande', :class => 'btn btn-large btn-window-size', :data => { :value => 'grande' } | ||
44 | 50 | ||
45 | #menu.center | 51 | #menu.center |
46 | = button_tag 'Próximo', :class => "btn btn-large btn-success", :id => 'btn-next', :disabled => true | 52 | = button_tag 'Próximo', :class => "btn btn-large btn-success", :id => 'btn-next', :disabled => true |