Commit af7ab095 authored by marcheing's avatar marcheing Committed by Diego de Araújo Martinez Camarinha

Add video upload form and javascripts

The added javascripts were included in the precompile assets list
initializer
Signed-off-by: Diego de Araújo Martinez Camarinha's avatarDiego Araújo <diegoamc@protonmail.ch>
parent c6eb7c95
function video_zip_code(event){
if($('input[name=video-has-location]').first().is(':checked')) {
$('#video-location').css('display', 'block');
$("#video-location").prop('required', true);
} else {
$('#video-location').css('display', 'none');
$("#video-location").prop('required', false);
}
}
$('input[name=video-has-location]').on('change', video_zip_code);
<%= form_for(content) do |f| %>
<% if content.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(content.errors.count, "error") %> prohibited this content from being saved:</h2>
<ul>
<% content.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :title %>
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :description %>
<%= f.text_field :description %>
</div>
<div class="field">
<%= f.label :user_id %>
<%= f.number_field :user_id %>
</div>
<div class="field">
<%= f.label :adult %>
<%= f.check_box :adult %>
</div>
<div class="field">
<%= f.label :rating %>
<%= f.number_field :rating %>
</div>
<div class="field">
<%= f.label :soundtrack %>
<%= f.text_field :soundtrack %>
<div class="form-section">
<div class="columns small-12">
<h2><%= t('send_content') %></h2>
</div>
<%= form_for(content, id: 'content-upload-form', 'data-abide' => true, novalidate: true, html: { multipart: true } ) do |f| %>
<% if content.errors.any? %>
<div id="error_explanation" data-abide-error class="alert callout">
<h2 class="fa fa-exclamation-circle"><%= pluralize(content.errors.count, "error") %> prohibited this content from being saved:</h2>
<ul>
<% content.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<fieldset>
<div class="field-label">
<%= f.label "#{t('author')} *", for: 'content_author' %>
</div>
<div class="field-item">
<%= f.text_field :author, required: true, disabled: true, value: current_user.profile.full_name %>
</div>
</fieldset>
<div class="field">
<%= f.label :view_count %>
<%= f.number_field :view_count %>
</div>
<!-- TODO: Add contests for content upload
<fieldset class="contest-select">
<div class="field-label">
<legend>
Concurso *
<span data-tooltip aria-haspopup="true" class="has-tip top" data-disable-hover='false' tabindex=1 title="Você pode incluir o seu vídeo em mais de um concurso, caso ele se encaixe no tema"><i class="fa fa-question-circle"></i></span>
</legend>
</div>
<div class="field-item">
<input type="checkbox" name="contest-select" id="contest-1"><label for="contest-1">Concurso 1 <a href="#" title="Ver concurso" target="_blank"><i class="fa fa-external-link"></i></a></label><br />
<input type="checkbox" name="contest-select" id="contest-2"><label for="contest-2">Concurso 2 <a href="#" title="Ver concurso" target="_blank"><i class="fa fa-external-link"></i></a></label><br />
<input type="checkbox" name="contest-select" id="contest-3"><label for="contest-3">Concurso 3 <a href="#" title="Ver concurso" target="_blank"><i class="fa fa-external-link"></i></a></label><br />
<input type="checkbox" name="contest-select" id="contest-4"><label for="contest-4">Concurso 4 <a href="#" title="Ver concurso" target="_blank"><i class="fa fa-external-link"></i></a></label>
</div>
</fieldset>
-->
<div class="field">
<%= f.label :deleted %>
<%= f.check_box :deleted %>
</div>
<fieldset>
<div class="field-label-item">
<%= f.check_box :terms_of_service, id: 'user-terms', required: true %>
<%= f.label t('terms_of_service_html'), for: :terms_of_service %>
</div>
</fieldset>
<div class="field">
<%= f.label :zip_code %>
<%= f.text_field :zip_code %>
</div>
<div id="content-upload-field-group">
<div class="content-field-group video-field">
<fieldset>
<div class="field-label-item">
<h3><%= t('video') %></h3>
</div>
<div class="field-label">
<%= f.label "#{t('video')} *", for: 'video-upload' %>
</div>
<div class="field-item">
<%= f.label t('select_file'), for: 'video-upload', class: 'button' %>
<%= f.file_field :video, required: true, class: 'show-for-sr', id: 'video-upload' %>
</div>
</fieldset>
<fieldset>
<div class="field-label">
<%= f.label "#{t('title')} *", for: 'video-title' %>
</div>
<div class="field-item">
<%= f.text_field :title, required: true, id: 'video-title' %>
</div>
</fieldset>
<fieldset>
<div class="field-label">
<%= f.label t('description'), for: 'video-description' %>
</div>
<div class="field-item">
<%= f.text_field :description, id: 'video-description' %>
</div>
</fieldset>
<fieldset>
<div class="field-label">
<%= f.label "#{t('director')} *", for: 'video-director' %>
</div>
<div class="field-item">
<%= f.text_field :director, required: true, id: 'video-director' %>
</div>
</fieldset>
<fieldset>
<div class="field-label">
<%= f.label t('co_director'), for: 'video-co-director' %>
</div>
<div class="field-item">
<%= f.text_field :co_director, id: 'video-co-director' %>
</div>
</fieldset>
<fieldset>
<div class="field-label">
<%= f.label(t('team'), for: 'video-team') do %>
<span data-tooltip aria-haspopup="true" class="has-tip top" data-disable-hover="false" tabindex=1 title="Explicação sobre o campo"><i class="fa fa-question-circle"></i></span>
<% end %>
</div>
<div class="field-item">
<%= f.text_area :team, id: 'video-team' %>
</div>
</fieldset>
<fieldset>
<div class="field-label">
<%= f.label("#{t('soundtrack')} *", for: 'video-soundtrack') do %>
<span data-tooltip aria-haspopup="true" class="has-tip top" data-disable-hover="false" tabindex=1 title="Explicação sobre o campo"><i class="fa fa-question-circle"></i></span>
<% end %>
</div>
<div class="field-item">
<%= f.text_field :soundtrack, id: 'video-soundtrack', required: true %>
</div>
</fieldset>
<fieldset>
<div class="field-label-item">
<%= f.label(t('specific_location'), for: 'video-has-location') do %>
<%= check_box_tag 'video-has-location', 'yes' %>
<% end %>
</div>
</fieldset>
<fieldset style="display: none;" id="video-location">
<div class="field-label">
<%= f.label "#{t('zip_code')} *", for: 'video-location-postal-code' %>
</div>
<div class="field-item">
<%= f.text_field :zip_code, id: 'video-location-postal-code', placeholder: '99999-999' %>
</div>
</fieldset>
<!-- TODO: Add tag support for contents
<fieldset>
<div class="field-label">
<label for="video-tags">Tags</label>
</div>
<div class="field-item">
<input type="text" id="video-tags" name="video-tags" placeholder="" aria-describedby="tagsHelpText">
<span class="form-error">
Campo obrigatório.
</span>
<p class="help-text" id="tagsHelpText">Utilize vírgulas entre as tags</p>
</div>
</fieldset>
-->
<fieldset>
<div class="field-label-item">
<%= f.label(t('adult'), for: 'video-adults-only') do %>
<%= f.check_box :adult, id: 'video-adults-only', value: 'yes' %>
<% end %>
</div>
</fieldset>
<fieldset>
<div class="field-label-item">
<%= f.label(t('allow_commentary'), for: 'video-allow-commentary') do %>
<%= f.check_box :allow_comments, id: 'video-allow-commentary', value: 'yes' %>
<% end %>
</div>
</fieldset>
</div>
<div class="field">
<%= f.label :director %>
<%= f.text_field :director %>
</div>
<div class="field">
<%= f.label :co_director %>
<%= f.text_field :co_director %>
</div>
<div class="field">
<%= f.label :team %>
<%= f.text_field :team %>
</div>
</div>
<div class="field">
<%= f.label :allow_comments %>
<%= f.check_box :allow_comments %>
</div>
<fieldset>
<div class="field-label-item">
<%= f.submit t('register'), class: 'button' %>
</div>
</fieldset>
<% end %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% content_for :footer do %>
<%= javascript_include_tag 'contents/show_zip_code_input.js' %>
<% end %>
......@@ -9,4 +9,4 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( profiles/*.js )
Rails.application.config.assets.precompile += %w( profiles/*.js contents/*.js )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment