Commit 05704252bc3774f21bf13e72aa256177ac3eb279
Exists in
master
and in
1 other branch
Merge branch 'devel' of git.lavid.ufpb.br:vlibras-web into devel
Showing
11 changed files
with
54 additions
and
25 deletions
Show diff stats
Gemfile.lock
... | ... | @@ -12,7 +12,6 @@ GEM |
12 | 12 | remote: https://rubygems.org/ |
13 | 13 | specs: |
14 | 14 | Ascii85 (1.0.1) |
15 | - ZenTest (4.6.2) | |
16 | 15 | actionmailer (3.2.0) |
17 | 16 | actionpack (= 3.2.0) |
18 | 17 | mail (~> 2.4.0) |
... | ... | @@ -47,13 +46,6 @@ GEM |
47 | 46 | awesome_print (1.0.2) |
48 | 47 | bcrypt-ruby (3.0.1) |
49 | 48 | builder (3.0.0) |
50 | - capybara (1.1.2) | |
51 | - mime-types (>= 1.16) | |
52 | - nokogiri (>= 1.3.3) | |
53 | - rack (>= 1.0.0) | |
54 | - rack-test (>= 0.5.4) | |
55 | - selenium-webdriver (~> 2.0) | |
56 | - xpath (~> 0.1.4) | |
57 | 49 | carrierwave (0.5.8) |
58 | 50 | activesupport (~> 3.0) |
59 | 51 | childprocess (0.3.1) |
... | ... | @@ -117,7 +109,7 @@ GEM |
117 | 109 | mini_magick (3.4) |
118 | 110 | subexec (~> 0.2.1) |
119 | 111 | multi_json (1.1.0) |
120 | - mysql2 (0.3.11) | |
112 | + mysql2 (0.3.15) | |
121 | 113 | nokogiri (1.5.2) |
122 | 114 | oj (2.1.4) |
123 | 115 | orm_adapter (0.0.6) | ... | ... |
README
app/assets/javascripts/site/videos.js
1 | 1 | // |
2 | 2 | // Author Igor Amorim - www.igoramorim.com |
3 | 3 | // |
4 | + | |
5 | +function check_subtitle(file) { | |
6 | + var accepted_file_types = ["srt"]; | |
7 | + return check_type(file, accepted_file_types) | |
8 | +}; | |
9 | + | |
10 | +function check_video(file) { | |
11 | + var accepted_file_types = ["avi", "mp4", "mov", "webm", "wmv", "mkv",]; | |
12 | + return check_type(file, accepted_file_types) | |
13 | +}; | |
14 | + | |
15 | +function check_type(file, accepted_file_types) { | |
16 | + | |
17 | + var ext = file.value.substring(file.value.lastIndexOf('.') + 1).toLowerCase(); | |
18 | + var isValidFile = false; | |
19 | + | |
20 | + for (var i = 0; i < accepted_file_types.length; i++) { | |
21 | + if (ext == accepted_file_types[i]) { | |
22 | + isValidFile = true; | |
23 | + break; | |
24 | + } | |
25 | + } | |
26 | + | |
27 | + if (!isValidFile) { | |
28 | + file.value = null; | |
29 | + alert("Apenas os formatos abaixo são aceitos:\n\n" + accepted_file_types.join(", ")); | |
30 | + } | |
31 | + | |
32 | + return isValidFile; | |
33 | +}; | |
34 | + | |
4 | 35 | $(function(){ |
5 | 36 | |
6 | 37 | $("#url").hide(); | ... | ... |
app/controllers/wikilibras/wikivideos_controller.rb
... | ... | @@ -9,9 +9,10 @@ class Wikilibras::WikivideosController < Wikilibras::BaseController |
9 | 9 | def dicionario |
10 | 10 | # @q = Wikivideo.search(params[:q]) |
11 | 11 | # @wikivideos = @q.result(:distinct => true) |
12 | - @wikivideo = Wikivideo.new | |
13 | - @wikivideos = Wikivideo.all | |
14 | - @wikivideos = Wikivideo.where("signal_name like ?","%#{params[:signal_name]}%") if params[:signal_name] | |
12 | +# @wikivideo = Wikivideo.new | |
13 | +# @wikivideos = Wikivideo.all | |
14 | +# @wikivideos = Wikivideo.where("signal_name like ?","%#{params[:signal_name]}%") if params[:signal_name] | |
15 | + @wikivideos = Dir.glob('public/dictionary/*.flv') | |
15 | 16 | end |
16 | 17 | |
17 | 18 | def search | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -25,8 +25,13 @@ module ApplicationHelper |
25 | 25 | end |
26 | 26 | |
27 | 27 | def format_signal_name(name) |
28 | - final = name.split(/\s*(\d+)\s*/,-1) | |
29 | - return final[0] | |
28 | + final = name.split("/").last.split(".").first | |
29 | + return final | |
30 | + end | |
31 | + | |
32 | + def format_signal_path(name) | |
33 | + final = name.split("/")[1..-1].join("/") | |
34 | + return final | |
30 | 35 | end |
31 | 36 | |
32 | 37 | def show_month(month) | ... | ... |
app/views/static/subtitle.html.haml
... | ... | @@ -6,6 +6,6 @@ |
6 | 6 | = form_for(@presenter.subtitle, :html => {:multipart => true, :class => "horizontal-form"}) do |f| |
7 | 7 | %fieldset |
8 | 8 | %label Coloque a Legenda |
9 | - = f.file_field :legend, :prompt => "LEGENDA", :id => "link_cc" | |
9 | + = f.file_field :legend, :prompt => "LEGENDA", :id => "link_cc", :onchange => "return check_subtitle(this)" | |
10 | 10 | #url |
11 | 11 | = f.submit "CONTINUAR", :class => "btn btn-success btn-large" |
12 | 12 | \ No newline at end of file | ... | ... |
app/views/static/upload.html.haml
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | = form_for(@presenter.upload, :html => {:multipart => true, :class => "horizontal-form"}) do |f| |
7 | 7 | %fieldset |
8 | 8 | %label Coloque o Vídeo |
9 | - = f.file_field :url, :id => "link_cc" | |
9 | + = f.file_field :url, :id => "link_cc", :onchange => "return check_video(this)" | |
10 | 10 | #url |
11 | 11 | = f.submit "CONTINUAR", :class => "btn btn-success btn-large" |
12 | -- content_for :menu, render(:partial => 'shared/menu') | |
13 | 12 | \ No newline at end of file |
13 | +- content_for :menu, render(:partial => 'shared/menu') | ... | ... |
app/views/videos/_form.html.haml
... | ... | @@ -23,10 +23,10 @@ |
23 | 23 | Legenda (.SRT) |
24 | 24 | #url |
25 | 25 | = f.label :url, t('videos.url'), :class => "bold" |
26 | - = f.file_field :url | |
26 | + = f.file_field :url, :onchange => "return check_video(this)" | |
27 | 27 | #legend |
28 | 28 | = f.label :legend, t('videos.subtitle'), :class => "bold" |
29 | - = f.file_field :legend, :prompt => "LEGENDA" | |
29 | + = f.file_field :legend, :prompt => "LEGENDA", :onchange => "return check_subtitle(this)" | |
30 | 30 | .field |
31 | 31 | = f.label :window_size, t('videos.window_size'), :class => "bold" |
32 | 32 | = f.select :window_size, [['Pequena', '1'], ['Média', '2'], ['Grande', '3']] | ... | ... |
app/views/wikilibras/wikivideos/_sinal.html.haml
1 | 1 | / Author Igor Portela - www.igorportela.com |
2 | 2 | :javascript |
3 | 3 | $(function(){ |
4 | - flowplayer("player#{wikivideo.id}", "/player/flowplayer-3.2.9.swf",{ | |
4 | + flowplayer("player_#{format_signal_name(wikivideo)}", "/player/flowplayer-3.2.9.swf",{ | |
5 | 5 | onFinish: function(){ this.getPlugin("play").hide(); }, |
6 | 6 | canvas: { backgroundColor: "#FFFFFF" } |
7 | 7 | }); |
8 | 8 | }); |
9 | -.modal.hide.fade{"aria-hidden" => "true", "aria-labelledby" => "myModalLabel", :id => "signal_#{wikivideo.id}", :role => "dialog", :tabindex => "-1"} | |
9 | +.modal.hide.fade{"aria-hidden" => "true", "aria-labelledby" => "myModalLabel", :id => "signal_#{format_signal_name(wikivideo)}", :role => "dialog", :tabindex => "-1"} | |
10 | 10 | .modal-header |
11 | 11 | %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} × |
12 | 12 | %h3#myModalLabel |
13 | - Sinal: #{format_signal_name(wikivideo.signal_name)} | |
13 | + Sinal: #{format_signal_name(wikivideo)} | |
14 | 14 | .modal-body |
15 | 15 | %div{:style => "height:350px"} |
16 | - = link_to '', wikivideo.path_signal, id: "player#{wikivideo.id}" | |
16 | + = link_to '', "/" + format_signal_path(wikivideo), id: "player_#{format_signal_name(wikivideo)}" | |
17 | 17 | .modal-footer |
18 | 18 | %button.btn.btn-primary{"aria-hidden" => "true", "data-dismiss" => "modal"} OK |
19 | 19 | %button.btn.btn-danger Denunciar Erro |
20 | 20 | \ No newline at end of file | ... | ... |
app/views/wikilibras/wikivideos/dicionario.html.haml
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | - @wikivideos.each do |wikivideo| |
14 | 14 | %tbody |
15 | 15 | %tr |
16 | - %td= link_to format_signal_name(wikivideo.signal_name), "#signal_#{wikivideo.id}", "data-toggle" => "modal" | |
16 | + %td= link_to format_signal_name(wikivideo), "#signal_#{format_signal_name(wikivideo)}", "data-toggle" => "modal" | |
17 | 17 | = render "wikilibras/wikivideos/sinal", wikivideo: wikivideo |
18 | 18 | - else |
19 | 19 | .alert | ... | ... |