500 lines
21 KiB
Plaintext
500 lines
21 KiB
Plaintext
|
<% content_for :page_specific_css do %>
|
|||
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
|||
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
|||
|
<%= stylesheet_link_tag "lib/main-list" %>
|
|||
|
<% 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/file-type" %>
|
|||
|
<%= javascript_include_tag "lib/module-area" %>
|
|||
|
<%= javascript_include_tag "form" %>
|
|||
|
<% end %>
|
|||
|
<!-- 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>
|
|||
|
<% if @current_user.is_admin? || @current_user.is_manager?(@module_app) %>
|
|||
|
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
|
|||
|
<% end %>
|
|||
|
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
|||
|
<li>
|
|||
|
<a href="#video_imageupload" data-toggle="tab"><%= t('video_program.video_image') %></a>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<a href="#imageupload" data-toggle="tab"><%= t('video_program.image') %></a>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<a href="#carousel_image_upload" data-toggle="tab" title="<%= t('video_program.carousel_image_title') %>"><%= t('video_program.carousel_image') %></a>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<a href="#episodes_albums" data-toggle="tab" title="<%= t('video_program.episodes_albums') %>"><%= t('video_program.episodes_albums') %></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("video_program.start_date") %></label>
|
|||
|
<div class="controls">
|
|||
|
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @video_program.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="control-group">
|
|||
|
<label class="control-label muted"><%= t("video_program.end_date") %></label>
|
|||
|
<div class="controls">
|
|||
|
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @video_program.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="control-group" id="external_link_box">
|
|||
|
<%= f.label :video_external_link, t("video_program.video_external_link"), :class => "control-label muted" %>
|
|||
|
<div class="controls">
|
|||
|
<%= f.text_field :video_external_link %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="control-group" id="episodes_box">
|
|||
|
<%= f.label :episodes, t("video_program.episodes"), :class => "control-label muted" %>
|
|||
|
<div class="controls">
|
|||
|
<%= f.number_field :episodes %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<!-- Status Module -->
|
|||
|
<% if @current_user.is_admin? || @current_user.is_manager?(@module_app) %>
|
|||
|
<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 btn <%= 'active' if @video_program.is_top? %>">
|
|||
|
<%= f.check_box :is_top %> <%= t(:top) %>
|
|||
|
</label>
|
|||
|
|
|||
|
<label class="checkbox inline btn <%= 'active' if @video_program.is_hot? %>">
|
|||
|
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
|||
|
</label>
|
|||
|
|
|||
|
<label class="checkbox inline btn <%= 'active' if @video_program.is_hidden? %>">
|
|||
|
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="control-group <%= @video_program.is_top? || (!@video_program.top_end_date.nil? && @video_program.top_end_date > Time.now) ? "" : "hide" %>" data-for="is_top">
|
|||
|
<label for="" class="control-label muted">Top end time</label>
|
|||
|
<div class="controls">
|
|||
|
<%= f.datetime_picker :top_end_date, :no_label => true, :new_record => @video_program.new_record? %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
</div>
|
|||
|
<% end %>
|
|||
|
|
|||
|
<!-- 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>
|
|||
|
|
|||
|
<!-- Images Module -->
|
|||
|
<div class="tab-pane fade" id="video_imageupload">
|
|||
|
<div class="control-group">
|
|||
|
<%= f.label :display_video_image, t("video_program.display_video_image"), :class => "control-label muted" %>
|
|||
|
<div class="controls">
|
|||
|
<%= f.check_box :display_video_image %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<!-- 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_program.video_image.file %>" data-provides="fileupload">
|
|||
|
<div class="fileupload-new thumbnail pull-left">
|
|||
|
<% if @video_program.video_image.file %>
|
|||
|
<%= image_tag @video_program.video_image %>
|
|||
|
<% else %>
|
|||
|
<img src="/assets/video_program/AAAAAA.png" />
|
|||
|
<% 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_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_video_image %><%= t(:remove) %>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<% @site_in_use_locales.each do |locale| %>
|
|||
|
<%= f.fields_for :video_image_description_translations do |f| %>
|
|||
|
<div class="control-group">
|
|||
|
<label class="control-label muted" for="image_description_<%= locale.to_s %>"><%= t(:description) + " (#{t(locale.to_s)})" %></label>
|
|||
|
<div class="controls">
|
|||
|
<%= f.text_field locale, value: (@video_program.video_image_description_translations[locale.to_s] rescue nil) %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<% end %>
|
|||
|
<% end %>
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
<!-- Images Module -->
|
|||
|
<div class="tab-pane fade" id="imageupload">
|
|||
|
<div class="control-group">
|
|||
|
<%= f.label :display_image, t("video_program.display_image"), :class => "control-label muted" %>
|
|||
|
<div class="controls">
|
|||
|
<%= f.check_box :display_image %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<!-- 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_program.image.file %>" data-provides="fileupload">
|
|||
|
<div class="fileupload-new thumbnail pull-left">
|
|||
|
<% if @video_program.image.file %>
|
|||
|
<%= image_tag @video_program.image %>
|
|||
|
<% else %>
|
|||
|
<img src="/assets/video_program/AAAAAA.png" />
|
|||
|
<% 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 :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_image %><%= t(:remove) %>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<% @site_in_use_locales.each do |locale| %>
|
|||
|
<%= f.fields_for :image_description_translations do |f| %>
|
|||
|
<div class="control-group">
|
|||
|
<label class="control-label muted" for="image_description_<%= locale.to_s %>"><%= t(:description) + " (#{t(locale.to_s)})" %></label>
|
|||
|
<div class="controls">
|
|||
|
<%= f.text_field locale, value: (@video_program.image_description_translations[locale.to_s] rescue nil) %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<% end %>
|
|||
|
<% end %>
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="tab-pane fade" id="carousel_image_upload">
|
|||
|
<div class="control-group">
|
|||
|
<label class="control-label muted" for="carousel_image_width"><%= t("video_program.carousel_image_width") %></label>
|
|||
|
<div class="controls">
|
|||
|
<%= f.text_field :custom_carousel_image_width, :placeholder => t("video_program.custom_carousel_image_width_hint") %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<% if !f.object.video_program_carousel_images.blank? %>
|
|||
|
<div class="exist">
|
|||
|
<% f.object.video_program_carousel_images.each_with_index do |video_program_carousel_image, i| %>
|
|||
|
<%= f.fields_for :video_program_carousel_images, video_program_carousel_image do |f| %>
|
|||
|
<%= render :partial => 'form_image', :object => video_program_carousel_image, :locals => {:f => f, :i => i} %>
|
|||
|
<% end %>
|
|||
|
<% end %>
|
|||
|
<hr>
|
|||
|
</div>
|
|||
|
<% end %>
|
|||
|
<!-- Add -->
|
|||
|
<div class="add-target">
|
|||
|
</div>
|
|||
|
<p class="add-btn controls">
|
|||
|
<%= hidden_field_tag 'bulletin_carousel_image_count', f.object.video_program_carousel_images.count %>
|
|||
|
<a id="add_carousel_image" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="tab-pane fade" id="episodes_albums">
|
|||
|
<%= render partial: 'admin/galleries/select_albums_form', locals: {field: 'video_program[album_ids][]', albums: f.object.albums} %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<!-- Language Tabs -->
|
|||
|
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
|||
|
<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) %></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" : '' %>">
|
|||
|
<div class="control-group input-title">
|
|||
|
<label class="control-label muted"><%= t('video_program.title') %></label>
|
|||
|
<div class="controls">
|
|||
|
<%= f.fields_for :title_translations do |f| %>
|
|||
|
<%= f.text_area locale, class: "ckeditor_reduce input-block-level", placeholder: t('video_program.title'), value: (@video_program.title_translations[locale] rescue nil) %>
|
|||
|
<% end %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="control-group input-subtitle">
|
|||
|
<label class="control-label muted"><%= t(:subtitle) %></label>
|
|||
|
<div class="controls">
|
|||
|
<div class="textarea">
|
|||
|
<%= f.fields_for :subtitle_translations do |f| %>
|
|||
|
<%= f.text_area locale, rows: 2, class: "ckeditor input-block-level", value: (@video_program.subtitle_translations[locale] rescue nil) %>
|
|||
|
<% end %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="control-group input-notes">
|
|||
|
<label class="control-label muted"><%= t("video_program.program_notes") %></label>
|
|||
|
<div class="controls">
|
|||
|
<div class="textarea">
|
|||
|
<%= f.fields_for :program_notes_translations do |f| %>
|
|||
|
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@video_program.program_notes_translations[locale] rescue nil) %>
|
|||
|
<% end %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="control-group input-notes">
|
|||
|
<label class="control-label muted"><%= t("video_program.actor_notes") %></label>
|
|||
|
<div class="controls">
|
|||
|
<div class="textarea">
|
|||
|
<%= f.fields_for :actor_notes_translations do |f| %>
|
|||
|
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@video_program.actor_notes_translations[locale] rescue nil) %>
|
|||
|
<% end %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="control-group input-notes">
|
|||
|
<label class="control-label muted"><%= t("video_program.video_notes") %></label>
|
|||
|
<div class="controls">
|
|||
|
<div class="textarea">
|
|||
|
<%= f.fields_for :video_notes_translations do |f| %>
|
|||
|
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@video_program.video_notes_translations[locale] rescue nil) %>
|
|||
|
<% end %>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
<% end %>
|
|||
|
|
|||
|
<!-- Link -->
|
|||
|
<div class="control-group">
|
|||
|
<label class="control-label muted"><%= t(:link) %></label>
|
|||
|
<div class="controls add-input">
|
|||
|
|
|||
|
<!-- Exist -->
|
|||
|
<% if @video_program && !@video_program.video_program_links.blank? %>
|
|||
|
<div class="exist">
|
|||
|
<% @video_program.video_program_links.each_with_index do |video_program_link, i| %>
|
|||
|
<%= f.fields_for :video_program_links, video_program_link do |f| %>
|
|||
|
<%= render :partial => 'form_link', :object => video_program_link, :locals => {:f => f, :i => i} %>
|
|||
|
<% end %>
|
|||
|
<% end %>
|
|||
|
<hr>
|
|||
|
</div>
|
|||
|
<% end %>
|
|||
|
|
|||
|
<!-- Add -->
|
|||
|
<div class="add-target">
|
|||
|
</div>
|
|||
|
<p class="add-btn">
|
|||
|
<%= hidden_field_tag 'video_program_link_field_count', @video_program.video_program_links.count %>
|
|||
|
<a id="add_link" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|||
|
</p>
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<!-- File -->
|
|||
|
<div class="control-group">
|
|||
|
<label class="control-label muted"><%= t(:file_) %></label>
|
|||
|
<div class="controls">
|
|||
|
|
|||
|
<!-- Exist -->
|
|||
|
<% if @video_program && !@video_program.video_program_files.blank? %>
|
|||
|
<div class="exist">
|
|||
|
<% @video_program.video_program_files.each_with_index do |video_program_file, i| %>
|
|||
|
<%= f.fields_for :video_program_files, video_program_file do |f| %>
|
|||
|
<%= render :partial => 'form_file', :object => video_program_file, :locals => {:f => f, :i => i} %>
|
|||
|
<% end %>
|
|||
|
<% end %>
|
|||
|
<hr>
|
|||
|
</div>
|
|||
|
<% end %>
|
|||
|
|
|||
|
<!-- Add -->
|
|||
|
<div class="add-target">
|
|||
|
</div>
|
|||
|
<p class="add-btn">
|
|||
|
<%= hidden_field_tag 'video_program_file_field_count', @video_program.video_program_files.count %>
|
|||
|
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|||
|
</p>
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<!-- Form Actions -->
|
|||
|
<div class="form-actions">
|
|||
|
<%= get_referer_url[:action] rescue "" %>
|
|||
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|||
|
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
|||
|
<%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %>
|
|||
|
<%= link_to t('cancel'), admin_video_programs_path, :class=>"btn" %>
|
|||
|
</div>
|
|||
|
|
|||
|
<span id='show_preview'>
|
|||
|
<div class="modal hide fade in banner-preview" id="">
|
|||
|
<div class="modal-header">
|
|||
|
<a class="close" data-dismiss="modal">×</a>
|
|||
|
<h3><%= t(:preview) %></h3>
|
|||
|
</div>
|
|||
|
<div class="modal-body">
|
|||
|
<iframe id="preview-iframe" src=""></iframe>
|
|||
|
</div>
|
|||
|
<div class="modal-footer">
|
|||
|
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</span>
|
|||
|
<% if !@module_app.tags.empty? %>
|
|||
|
<script type="text/javascript">
|
|||
|
$("form.previewable").on("submit", function(){
|
|||
|
if(!$("input[name='video_program[tags][]']").is(":checked")){
|
|||
|
if(!confirm("You have selected no tag, do you wish to continue?")){
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
</script>
|
|||
|
<% end %>
|
|||
|
<script>
|
|||
|
$("#video_program_display_image").click(function(){$("#image_display_setting").toggleClass("hide")})
|
|||
|
function Appendzero(obj)
|
|||
|
{
|
|||
|
if(obj<10) return "0" +""+ obj;
|
|||
|
else return obj;
|
|||
|
}
|
|||
|
|
|||
|
$(function() {
|
|||
|
if (location.pathname.substr(-3)=='new'){
|
|||
|
var getDate = new Date();
|
|||
|
var toDay = getDate.getFullYear()+"/"+ (Appendzero(getDate.getMonth()+1))+"/"+Appendzero(getDate.getDate())+" "+Appendzero(getDate.getHours())+":"+Appendzero(getDate.getMinutes());
|
|||
|
$('input[name="video_program[postdate]"]').val(toDay);
|
|||
|
}
|
|||
|
|
|||
|
$("#main-wrap").after("");
|
|||
|
|
|||
|
$(document).on('click', '#add_link', function(){
|
|||
|
var new_id = $(this).prev().attr('value');
|
|||
|
var old_id = new RegExp("new_video_program_links", "g");
|
|||
|
var on = $('.language-nav li.active').index();
|
|||
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|||
|
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :video_program_links) %>").replace(old_id, new_id));
|
|||
|
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|||
|
formTip();
|
|||
|
});
|
|||
|
$(document).on('click', '#add_file', function(){
|
|||
|
var new_id = $(this).prev().attr('value');
|
|||
|
var old_id = new RegExp("new_video_program_files", "g");
|
|||
|
var on = $('.language-nav li.active').index();
|
|||
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|||
|
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :video_program_files) %>").replace(old_id, new_id));
|
|||
|
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
|||
|
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|||
|
});
|
|||
|
formTip();
|
|||
|
});
|
|||
|
$(document).on('click', '#add_carousel_image', function(){
|
|||
|
var new_id = $(this).prev().attr('value');
|
|||
|
var old_id = new RegExp("new_video_program_carousel_images", "g");
|
|||
|
var on = $('.language-nav li.active').index();
|
|||
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|||
|
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_image', f, :video_program_carousel_images) %>").replace(old_id, new_id));
|
|||
|
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
|||
|
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|||
|
});
|
|||
|
});
|
|||
|
$(document).on('click', '.fileupload-remove', function(){
|
|||
|
if($(this).find(".delete_image").length != 0){
|
|||
|
$(this).parents('.image_group').remove();
|
|||
|
}
|
|||
|
});
|
|||
|
$(document).on('click', '.delete_link', function(){
|
|||
|
$(this).parents('.input-prepend').remove();
|
|||
|
});
|
|||
|
$(document).on('click', '.delete_file', function(){
|
|||
|
$(this).parents('.input-prepend').remove();
|
|||
|
});
|
|||
|
$(document).on('click', '.remove_existing_record', function(){
|
|||
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
|||
|
$(this).children('.should_destroy').attr('value', 1);
|
|||
|
$(this).parents('.start-line').hide();
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
|
|||
|
$('#remind-check').on('change', function() {
|
|||
|
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
|
|||
|
})
|
|||
|
|
|||
|
$("#video_program_is_top").parent().on("click",function(){
|
|||
|
setTimeout(function(){
|
|||
|
if($("#video_program_is_top").parent().hasClass("active")){
|
|||
|
$("div[data-for=is_top]").removeClass("hide");
|
|||
|
}else{
|
|||
|
$("div[data-for=is_top]").addClass("hide");
|
|||
|
$("div[data-for=is_top]").find("input[type=text]").val("");
|
|||
|
}
|
|||
|
},100)
|
|||
|
})
|
|||
|
|
|||
|
});
|
|||
|
</script>
|