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 | 36 | |
| 37 | 37 | function finished(event, currentIndex) { |
| 38 | 38 | $("#vlibras-form").submit(); |
| 39 | + $("#btn-next").text("Enviando..."); | |
| 40 | + deactivateNextButton(); | |
| 39 | 41 | } |
| 40 | 42 | |
| 41 | 43 | function stepValidation(event, currentIndex, newIndex) { |
| ... | ... | @@ -62,17 +64,36 @@ $(function () { |
| 62 | 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 | 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 | 90 | var acceptedFileTypes = ["srt"]; |
| 72 | 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 | 97 | var acceptedFileTypes = ["flv", "ts", "avi", "mp4", "mov", "webm", "wmv", "mkv"]; |
| 77 | 98 | validateFileWizard($(this), acceptedFileTypes); |
| 78 | 99 | }); | ... | ... |
app/assets/javascripts/v_libras/requests/shared.js
| ... | ... | @@ -10,4 +10,13 @@ function checkType(file, acceptedFileTypes) { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | return isValidFile; |
| 13 | -} | |
| 14 | 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 | 24 | \ No newline at end of file | ... | ... |
app/assets/stylesheets/components/ribbon.css.scss
| 1 | +$ribbonUpperColor: #2A632B; | |
| 2 | +$ribbonBottomColor: #6D972D; | |
| 3 | + | |
| 1 | 4 | .ribbon-wrapper-green { |
| 2 | 5 | margin: 10px auto; |
| 3 | - width: 200px; | |
| 6 | + width: 205px; | |
| 4 | 7 | height: 165px; |
| 5 | 8 | overflow: hidden; |
| 6 | 9 | top: -3px; |
| ... | ... | @@ -10,7 +13,7 @@ |
| 10 | 13 | } |
| 11 | 14 | |
| 12 | 15 | .ribbon-content img { |
| 13 | - border-radius: 3px; | |
| 16 | + border-radius: 30px; | |
| 14 | 17 | -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); |
| 15 | 18 | -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); |
| 16 | 19 | box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); |
| ... | ... | @@ -21,25 +24,25 @@ |
| 21 | 24 | |
| 22 | 25 | .ribbon-green { |
| 23 | 26 | font: bold 15px Sans-Serif; |
| 24 | - color: #333; | |
| 27 | + color: #fff; | |
| 25 | 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 | 30 | -webkit-transform: rotate(45deg); |
| 28 | 31 | -moz-transform: rotate(45deg); |
| 29 | 32 | -ms-transform: rotate(45deg); |
| 30 | 33 | -o-transform: rotate(45deg); |
| 31 | 34 | position: relative; |
| 32 | 35 | padding: 5px 0; |
| 33 | - left: 118px; | |
| 34 | - bottom: 150px; | |
| 36 | + left: 122px; | |
| 37 | + bottom: 148px; | |
| 35 | 38 | width: 110px; |
| 39 | + | |
| 36 | 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 | 46 | -webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.3); |
| 44 | 47 | -moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.3); |
| 45 | 48 | box-shadow: 0px 0px 3px rgba(0,0,0,0.3); | ... | ... |
app/controllers/v_libras/requests_controller.rb
| 1 | 1 | class VLibras::RequestsController < ApplicationController |
| 2 | - before_filter :check_vlibras_api_status, :only => [ :rapid, :create ] | |
| 3 | - | |
| 4 | 2 | protect_from_forgery with: :null_session, :only => [ :callback ] |
| 3 | + | |
| 5 | 4 | before_filter :authenticate_user!, :except => [ :callback ] |
| 5 | + before_filter :check_vlibras_api_status, :except => [ :callback ] | |
| 6 | 6 | |
| 7 | 7 | def rapid |
| 8 | 8 | @request = VLibras::Request.new |
| ... | ... | @@ -25,6 +25,7 @@ class VLibras::RequestsController < ApplicationController |
| 25 | 25 | flash[:error] = 'Algo deu errado com a sua requisição. Por favor verifique opções escolhidas.' |
| 26 | 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 | 29 | @request.files.values.each { |f| f.file.delete } |
| 29 | 30 | |
| 30 | 31 | redirect_to :back | ... | ... |
app/models/v_libras/request.rb
| ... | ... | @@ -67,6 +67,7 @@ class VLibras::Request < ActiveRecord::Base |
| 67 | 67 | |
| 68 | 68 | ApiClient::Client.submit(self, files) |
| 69 | 69 | |
| 70 | + # Warning: this code is also present on the controller, if there is an error | |
| 70 | 71 | files.values.each { |f| f.file.delete } |
| 71 | 72 | |
| 72 | 73 | logger.debug '[VLibras::Request] Request done' | ... | ... |
app/views/devise/sessions/new.html.haml
app/views/static/home.haml
| 1 | 1 | .breadcrumb |
| 2 | - %h1 Menu | |
| 3 | 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 | 24 | \ No newline at end of file | ... | ... |
app/views/v_libras/requests/new.haml
| ... | ... | @@ -32,15 +32,21 @@ |
| 32 | 32 | |
| 33 | 33 | .span4 |
| 34 | 34 | = file_field_tag 'subtitle', :id => 'subtitle-upload' |
| 35 | + | |
| 35 | 36 | %h2 Posição |
| 36 | 37 | %section |
| 37 | 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 | 44 | %h2 Tamanho |
| 41 | 45 | %section |
| 42 | 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 | 51 | #menu.center |
| 46 | 52 | = button_tag 'Próximo', :class => "btn btn-large btn-success", :id => 'btn-next', :disabled => true | ... | ... |