57 lines
2.6 KiB
Plaintext
57 lines
2.6 KiB
Plaintext
= semantic_form_for [:admin,@video_file], :remote => true do |form|
|
|
.content
|
|
=form.inputs do
|
|
= form.input :public, :label => "Public ?"
|
|
=form.input :fr, :label => "FR ?"
|
|
=form.input :en, :label => "EN ?"
|
|
|
|
=form.input :created_at, :label => "Date de création :", :start_year => 1995
|
|
|
|
=#form.input :investigation_cat, :label => "Catégorie 'Investigation'", :collection => InvestigationCat.order(:parent_id).all, :as => :select, :include_blank => true
|
|
|
|
= form.input :image_file_id, :label => "Poster :" , :as => :qi_image_select
|
|
=form.input :video_folder, :collection => VideoFolder.order(:name).all
|
|
|
|
=form.input :youtube_code, :input_html => {:id => "youtube_id", :onkeydown => "youtube_parser($(this).val());", :onchange => "youtube_parser($(this).val());", :onkeyup => "youtube_parser($(this).val());"}
|
|
%p
|
|
Collez directement l'url de la vidéo youtube (https://www.youtube.com/watch?v=p00mU0LsSIg ou https://youtu.be/p00mU0LsSIg par exemple) et l'ID sera automatiquement détecté.
|
|
|
|
=form.input :vimeo_code, :label => "Code viméo :"
|
|
|
|
=form.semantic_fields_for :video_file_langs do |video_file_lang|
|
|
%hr
|
|
%h3=video_file_lang.object.lang_site.name
|
|
|
|
= video_file_lang.inputs do
|
|
=# video_file_lang.hidden_field :id
|
|
= video_file_lang.hidden_field :lang_site_id
|
|
= video_file_lang.input :title, :as => :string, :label => "Titre :"
|
|
-if @video_file.id
|
|
=video_file_lang.input :slug, :label => "Slug :"
|
|
= video_file_lang.input :description, :label => "Description courte :", :as => :text, :input_html => {:class => "redactor_textarea"}
|
|
|
|
|
|
=form.input :animals, :label => "Animaux concernés", :as => :check_boxes, :collection => Animal.order(:name).all
|
|
=form.input :categories, :label => "Catégories concernés", :as => :check_boxes, :collection => Category.joins(:category_langs).where("category_langs.lang_site_id = 1").order("category_langs.name")
|
|
|
|
|
|
|
|
|
|
.clear
|
|
|
|
:javascript
|
|
function youtube_parser(url){
|
|
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
|
|
var match = url.match(regExp);
|
|
if (match&&match[7].length==11){
|
|
|
|
$("#youtube_id").val(match[7]);
|
|
}else{
|
|
//alert("Url incorrecta");
|
|
}
|
|
}
|
|
|
|
|
|
.actions=form.submit "Sauvegarder", :class => "btn btn-primary"
|
|
|
|
-#:url => admin_video_files_path( :video_folder_id => params[:video_folder_id], :manager => params[:manager], :multiple => params[:multiple]) |