370 lines
15 KiB
Plaintext
370 lines
15 KiB
Plaintext
<% content_for :page_specific_css do %>
|
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
|
<%= stylesheet_link_tag "video_data/jplayer.blue.monday.min" %>
|
|
<% end %>
|
|
<% content_for :page_specific_javascript do %>
|
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
|
<%= javascript_include_tag "lib/module-area" %>
|
|
<%= javascript_include_tag "validator" %>
|
|
<%= javascript_include_tag "video_data/jquery.jplayer.min" %>
|
|
<% end %>
|
|
<style type="text/css">
|
|
.fileupload .video-thumbnail{
|
|
max-height: none;
|
|
display: inline-block;
|
|
width: 30em;
|
|
height: 20em;
|
|
}
|
|
</style>
|
|
<%#= f.error_messages %>
|
|
<%
|
|
@video_pro_setting = VideoProSetting.first
|
|
@video_pro_setting = nil if @video_pro_setting && (!@video_pro_setting.enable_name_mapping)
|
|
%>
|
|
<!-- Input Area -->
|
|
<div class="input-area">
|
|
<!-- Module Tabs -->
|
|
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
|
<ul class="nav nav-pills module-nav">
|
|
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
|
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
|
|
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
|
</ul>
|
|
<!-- Module -->
|
|
<div class="tab-content module-area">
|
|
|
|
<!-- Basic Module -->
|
|
<div class="tab-pane fade in active" id="basic">
|
|
<!-- Category -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:category) %></label>
|
|
<div class="controls">
|
|
<%= select_category(f, @module_app) %>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:type) %></label>
|
|
<div class="controls">
|
|
<div><%= t("choose_type") %></div>
|
|
<%=
|
|
select_tag "video_image[exchange_item]", options_for_select(@item,@item_choose)
|
|
%>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="exchange_item_3" style="display:none">
|
|
<!-- Images Upload -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:image) %></label>
|
|
<div class="controls">
|
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @video_image.file.file %>" data-provides="fileupload">
|
|
<div class="fileupload-new thumbnail pull-left">
|
|
<% if @video_image.file.file %>
|
|
<%= image_tag @video_image.file.url %>
|
|
<% else %>
|
|
<img src="https://via.placeholder.com/200x80/EFEFEF/AAAAAA" />
|
|
<% end %>
|
|
</div>
|
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
|
<span class="btn btn-file">
|
|
<span class="fileupload-new"><%= t(:select_image) %></span>
|
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
|
<%= f.file_field :file, accept: "image/*" %>
|
|
</span>
|
|
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
|
<div class="controls" data-toggle="buttons-checkbox">
|
|
<label class="checkbox inline btn btn-danger fileupload-remove">
|
|
<%= f.check_box :remove_file %><%= t(:remove) %>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="exchange_item_1" style="display:none">
|
|
<div class="control-group input-title">
|
|
<label class="control-label muted"><%= t(:youtube) %></label>
|
|
<div class="controls">
|
|
<div><%= 'ex. https://www.youtube.com/watch?v=UHF2e3lyPVU' %></div>
|
|
<%= f.text_field :youtube, placeholder: t(:youtube), class: 'input-block-level' %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="exchange_item_2" style="display:none">
|
|
<!-- Video Upload -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:video) %></label>
|
|
<div class="controls">
|
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @video_image.file.file %>" data-provides="fileupload">
|
|
<div class="fileupload-new video-thumbnail thumbnail pull-left">
|
|
<%= render partial: "jplayer",locals:{i: 1,file_name: f.object["video_file"],file_url: f.object.video_file.url,file_webm_url: (f.object.video_file_webm.url rescue nil),not_ready: true } %>
|
|
</div>
|
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
|
<span class="btn btn-file">
|
|
<span class="fileupload-new"><%= t("video_pro.select_video") %></span>
|
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
|
<%= f.file_field :video_file, accept: "video/mp4,video/x-m4v,video/ogg,video/webm" %>
|
|
</span>
|
|
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
|
<div class="controls" data-toggle="buttons-checkbox">
|
|
<label class="checkbox inline btn btn-danger fileupload-remove">
|
|
<%= f.check_box :remove_file %><%= t(:remove) %>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t("video_pro.video_snapshot") %></label>
|
|
<div class="controls">
|
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @video_image.video_snapshot.file %>" data-provides="fileupload">
|
|
<div class="fileupload-new thumbnail pull-left">
|
|
<% if @video_image.video_snapshot.file %>
|
|
<%= image_tag @video_image.video_snapshot.url %>
|
|
<% else %>
|
|
<img src="https://via.placeholder.com/200x80/EFEFEF/AAAAAA" />
|
|
<% end %>
|
|
</div>
|
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
|
<span class="btn btn-file">
|
|
<span class="fileupload-new"><%= t(:select_image) %></span>
|
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
|
<%= f.file_field :video_snapshot, accept: "image/*" %>
|
|
</span>
|
|
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
|
<div class="controls" data-toggle="buttons-checkbox">
|
|
<label class="checkbox inline btn btn-danger fileupload-remove">
|
|
<%= f.check_box :remove_file %><%= t(:remove) %>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<label for="auto_convert_video" class="control-label muted" function="field_label">
|
|
<%= t("video_pro.auto_convert_video")%>
|
|
</label>
|
|
<div class="controls">
|
|
<label class="checkbox">
|
|
<%= f.check_box :auto_convert_video, id: "auto_convert_video" %>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Post Agency -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t("video_pro.post_agency") %></label>
|
|
<div class="controls">
|
|
<%
|
|
current_user_id = current_user.id.to_s
|
|
if @video_image.update_user_id.blank?
|
|
update_user_id = current_user_id
|
|
else
|
|
update_user_id = @video_image.update_user_id
|
|
end
|
|
post_agency_text = ""
|
|
if @video_pro_setting
|
|
if update_user_id == current_user_id
|
|
post_agency_text = @video_pro_setting.get_user_name(update_user_id)
|
|
else
|
|
post_agency_text = "#{@video_pro_setting.get_user_name(update_user_id)} -> #{@video_pro_setting.get_user_name(current_user_id)}"
|
|
end
|
|
else
|
|
if update_user_id == current_user_id
|
|
post_agency_text = VideoProSetting.get_user_name(update_user_id)
|
|
else
|
|
post_agency_text = "#{VideoProSetting.get_user_name(update_user_id)} -> #{VideoProSetting.get_user_name(current_user_id)}"
|
|
end
|
|
end
|
|
%>
|
|
<%= select_tag "#{f.object_name}[use_override_post_agency]", options_for_select([[t("video_pro.the_same_as_publisher"), "0"], [t("video_pro.other"), "1"]], f.object.use_override_post_agency ? "1" : "0"), id: 'use_override_post_agency' %>
|
|
<div id="original_post_agency" class="<%= 'hide' if f.object.use_override_post_agency %>">
|
|
<%= post_agency_text %>
|
|
</div>
|
|
<div id="override_post_agency" class="<%= 'hide' unless f.object.use_override_post_agency %>">
|
|
<%= f.select("override_post_agency", (options_for_select(VideoProSetting.first.post_agencies.to_a.map.with_index{|agency,i| [agency, i] },:selected => f.object.override_post_agency) rescue [])) %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Date Time Picker -->
|
|
<div class="control-group">
|
|
<label class="control-label muted" for="video_pro_postdate"><%= t("video_pro.postdate") %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :postdate, :no_label => true, :picker_type=>'date', :format=>'yyyy/MM/dd' %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Date Time Picker -->
|
|
<div class="control-group">
|
|
<label class="control-label muted" for="video_pro_deadline"><%= t("video_pro.deadline") %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :deadline, :no_label => true, :picker_type=>'date', :format=>'yyyy/MM/dd', :new_record => @video_image.new_record? %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- language-selection -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t("video_pro.language_enabled") %></label>
|
|
<div class="controls">
|
|
<% @site_in_use_locales.each do |locale| %>
|
|
<label class="checkbox">
|
|
<%= check_box_tag "video_image[language_enabled][]", locale, (@video_image.language_enabled.include?(locale.to_s) rescue false) %>
|
|
<%= t(locale.to_s) %>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="tab-pane fade" id="status">
|
|
<!-- Status -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:status) %></label>
|
|
<div class="controls" data-toggle="buttons-checkbox">
|
|
<label class="checkbox inline btn <%= 'active' if f.object.is_top? %>">
|
|
<%= f.check_box :is_top %> <%= t(:top) %>
|
|
</label>
|
|
<label class="checkbox inline btn <%= 'active' if f.object.is_hot? %>">
|
|
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
|
</label>
|
|
<label class="checkbox inline btn <%= 'active' if f.object.is_hidden? %>">
|
|
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Tag Module -->
|
|
<div class="tab-pane fade" id="tag">
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:tags) %></label>
|
|
<%= select_tags(f, @module_app) %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Language Tabs -->
|
|
<ul class="nav nav-pills language-nav">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<li class="<%= 'active' if i == 0 %>">
|
|
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale.to_s) %></a>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<!-- Language -->
|
|
<div class="tab-content language-area">
|
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
|
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
|
<!-- Title-->
|
|
<div class="control-group input-content">
|
|
<label for="video_title" class="control-label muted"><%= t("title")%></label>
|
|
<div class="controls">
|
|
<%= f.fields_for :title_translations do |f| %>
|
|
<%= f.text_field locale, class: "input-block-level", value: (@video_image.title_translations[locale] rescue nil), placeholder: "#{t(locale.to_s)+t("title")}" %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<!-- Description -->
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted"><%= t(:description) %> (<%= t(locale.to_s) %>)</label>
|
|
<div class="controls">
|
|
<div class="textarea">
|
|
<%= f.fields_for :desc_translations do |f| %>
|
|
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@video_image.desc_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Keyword -->
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted"><%= t("video_pro.keyword") %> (<%= t(locale.to_s) %>)</label>
|
|
<div class="controls">
|
|
<%= f.fields_for :keyword_translations do |f| %>
|
|
<%= f.text_field locale, class: "input-block-level", value: (@video_image.keyword_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="form-actions">
|
|
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var form = new FormValidator($("#new_video_image"));
|
|
$("div#exchange_item_" + $("#video_image_exchange_item").val()).show();
|
|
$("#video_image_exchange_item").on("change",function(){
|
|
$("div[id*=exchange_item]").hide();
|
|
$("div#exchange_item_" + $(this).val()).show();
|
|
})
|
|
function checkSelect()
|
|
{
|
|
if(document.getElementById("video_image_exchange_item").value == "")
|
|
{
|
|
alert("<%= t('video_pro.please_choose_exchange_item') %>");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
$(document).ready(function(){
|
|
jplayer_ready_func_1();
|
|
$('#video_image_video_file').change(function(){
|
|
var file = this.files ? this.files[0] : null;
|
|
var value = this.value;
|
|
if(file || value){
|
|
var file_name = file ? file.name : value.split(/[\/\\]/).last();
|
|
var type = get_video_type(file_name);
|
|
var file_url = window.URL ? window.URL.createObjectURL(file) : "file://"+ value;
|
|
$("#jquery_jplayer_1").parents('.fileupload-new').css('display','');
|
|
$("#jquery_jplayer_1").jPlayer('destroy');
|
|
jPlayer_1_data["title"] = file_name;
|
|
jPlayer_1_data[type] = file_url;
|
|
$("#jquery_jplayer_1").jPlayer(jPlayer_1);
|
|
}
|
|
})
|
|
$('#exchange_item_2 [data-dismiss="fileupload"]').on("click",function(){
|
|
$("#jquery_jplayer_1").parents('.fileupload-new').css('display','none');
|
|
})
|
|
$('#video_image_out_link').on('paste', function(e){
|
|
var pastedData = e.originalEvent.clipboardData.getData('text');
|
|
var _this = $(this);
|
|
pastedData = pastedData.replace(new RegExp('^http(s|)://' + window.location.host), '');
|
|
window.setTimeout(function(){
|
|
_this.val(pastedData);
|
|
}, 0);
|
|
});
|
|
$("#use_override_post_agency").on("change", function(){
|
|
var val = $(this).val();
|
|
if(val == "1"){
|
|
$('#override_post_agency').removeClass('hide');
|
|
$('#original_post_agency').addClass('hide');
|
|
}else{
|
|
$('#override_post_agency').addClass('hide');
|
|
$('#original_post_agency').removeClass('hide');
|
|
}
|
|
})
|
|
})
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|