active/app/views/admin/actives/_form.html.erb

680 lines
30 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 "validator" %>
<% 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>
<li><a href="#settings" data-toggle="tab"><%= t("act.settings") %></a></li>
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
<li><a href="#imageupload" data-toggle="tab"><%= t('act.image') %></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>
<!-- postdate Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('act.postdate') %></label>
<div class="controls">
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @act.new_record? %>
</div>
</div>
<!-- end_date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('act.end_date') %></label>
<div class="controls">
<%= f.datetime_picker :end_date, :no_label => true, :new_record => @act.new_record? %>
</div>
</div>
<!-- Act Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('act.act_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :act_start_date, :no_label => true, :new_record => @act.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('act.act_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :act_end_date, :no_label => true, :new_record => @act.new_record? %>
</div>
</div>
<!-- Sign up Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('act.sign_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :sign_start_date, :no_label => true, :new_record => @act.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('act.sign_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :sign_end_date, :no_label => true, :new_record => @act.new_record? %>
</div>
</div>
<!-- Sign up -->
<div class="control-group">
<label class="control-label muted"><%= t('act.is_sign_up') %></label>
<div class="controls">
<label class="radio inline"><%= f.radio_button :sign_up, "yes", checked: @act.sign_up == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :sign_up, "no", checked: @act.sign_up == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<div class="control-group" style="display: none;" id="external_link_check_box">
<%= f.label :is_external_link, t("act.is_external_link"), :class => "control-label muted" %>
<div class="controls">
<%= f.check_box :is_external_link %>
</div>
</div>
<div class="control-group" style="display: none;" id="external_link_box">
<%= f.label :external_link, t("act.external_link"), :class => "control-label muted" %>
<div class="controls">
<%= f.text_field :external_link %>
<div class="hint"><%= t("act.external_link_hint") %></div>
</div>
</div>
</div>
<div class="tab-pane fade" id="settings">
<!-- Name -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_name') %></label>
<div class="controls">
<label for="act_enabled_name" class="checkbox inline">
<%= f.check_box :enabled_name, :class => "enabler" %>
<%= t(:enable)%>
</label>
</div>
<div class="controls required">
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_name, "yes", checked: @act.has_name == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_name, "no", checked: @act.has_name == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Tel No -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_tel') %></label>
<div class="controls">
<label for="act_enabled_tel" class="checkbox inline">
<%= f.check_box :enabled_tel, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_tel ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_tel, "yes", checked: @act.has_tel == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_tel, "no", checked: @act.has_tel == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Mobile No -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_phone') %></label>
<div class="controls">
<label for="act_enabled_phone" class="checkbox inline">
<%= f.check_box :enabled_phone, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_phone ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_phone, "yes", checked: @act.has_phone == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_phone, "no", checked: @act.has_phone == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Fax No -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_fax') %></label>
<div class="controls">
<label for="act_enabled_fax" class="checkbox inline">
<%= f.check_box :enabled_fax, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_fax ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_fax, "yes", checked: @act.has_fax == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_fax, "no", checked: @act.has_fax == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Email Id -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_email') %></label>
<div class="controls">
<label for="act_enabled_email" class="checkbox inline">
<%= f.check_box :enabled_email, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_email ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_email, "yes", checked: @act.has_email == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_email, "no", checked: @act.has_email == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- ID No -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_idno') %></label>
<div class="controls">
<label for="act_enabled_idno" class="checkbox inline">
<%= f.check_box :enabled_idno, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_idno ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_idno, "yes", checked: @act.has_idno == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_idno, "no", checked: @act.has_idno == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Gender -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_sex') %></label>
<div class="controls">
<label for="act_enabled_sex" class="checkbox inline">
<%= f.check_box :enabled_sex, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_sex ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_sex, "yes", checked: @act.has_sex == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_sex, "no", checked: @act.has_sex == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Birthday -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_birthday') %></label>
<div class="controls">
<label for="act_enabled_birthday" class="checkbox inline">
<%= f.check_box :enabled_birthday, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_birthday ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_birthday, "yes", checked: @act.has_birthday == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_birthday, "no", checked: @act.has_birthday == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Organization -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_organization') %></label>
<div class="controls">
<label for="act_enabled_organization" class="checkbox inline">
<%= f.check_box :enabled_organization, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_organization ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_organization, "yes", checked: @act.has_organization == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_organization, "no", checked: @act.has_organization == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Title -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_title') %></label>
<div class="controls">
<label for="act_enabled_title" class="checkbox inline">
<%= f.check_box :enabled_title, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_title ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_title, "yes", checked: @act.has_title == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_title, "no", checked: @act.has_title == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Address -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_address') %></label>
<div class="controls">
<label for="act_enabled_address" class="checkbox inline">
<%= f.check_box :enabled_address, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_address ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_address, "yes", checked: @act.has_address == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_address, "no", checked: @act.has_address == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Emergency Contact Number -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_emergency_contact_number') %></label>
<div class="controls">
<label for="act_enabled_emergency_contact_number" class="checkbox inline">
<%= f.check_box :enabled_emergency_contact_number, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_emergency_contact_number ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_emergency_contact_number, "yes", checked: @act.has_emergency_contact_number == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_emergency_contact_number, "no", checked: @act.has_emergency_contact_number == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Emergency Contact Person -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_emergency_contact_person') %></label>
<div class="controls">
<label for="act_enabled_emergency_contact_person" class="checkbox inline">
<%= f.check_box :enabled_emergency_contact_person, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_emergency_contact_person ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_emergency_contact_person, "yes", checked: @act.has_emergency_contact_person == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_emergency_contact_person, "no", checked: @act.has_emergency_contact_person == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Vegetarian -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_vegetarian') %></label>
<div class="controls">
<label for="act_enabled_vegetarian" class="checkbox inline">
<%= f.check_box :enabled_vegetarian, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_vegetarian ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_vegetarian, "yes", checked: @act.has_vegetarian == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_vegetarian, "no", checked: @act.has_vegetarian == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Note -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_note') %></label>
<div class="controls">
<label for="act_enabled_note" class="checkbox inline">
<%= f.check_box :enabled_note, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_note ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_note, "yes", checked: @act.has_note == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_note, "no", checked: @act.has_note == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
</div>
<!-- Status Module -->
<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 @act.is_top? || (!@act.top_end_date.nil? && @act.top_end_date > Time.now) %>">
<%= f.check_box :is_top %> <%= t(:top) %>
</label>
<label class="checkbox inline btn <%= 'active' if @act.is_hot? %>">
<%= f.check_box :is_hot %> <%= t(:hot) %>
</label>
<label class="checkbox inline btn <%= 'active' if @act.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
<div class="control-group <%= @act.is_top? || (!@act.top_end_date.nil? && @act.top_end_date > Time.now) ? "" : "hide" %>" data-for="is_top">
<label for="" class="control-label muted"><%= t('act.top_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :top_end_date, :no_label => true, :new_record => @act.new_record? %>
</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>
<!-- Images Module -->
<div class="tab-pane fade" id="imageupload">
<!-- 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 @act.image.file %>" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left">
<% if @act.image.file %>
<%= image_tag @act.image %>
<% else %>
<img src="http://www.placehold.it/50x50/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 :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: (@act.image_description_translations[locale.to_s] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</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" : '' %>">
<!-- Title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t(:title) %></label>
<div class="controls">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_area locale, class: "ckeditor_reduce input-block-level", placeholder: t(:title), value: (@act.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Subtitle-->
<div class="control-group input-title">
<label class="control-label muted"><%= t(:subtitle) %></label>
<div class="controls">
<%= f.fields_for :subtitle_translations do |f| %>
<%= f.text_area locale, class: "ckeditor input-block-level", placeholder: t(:subtitle), value: (@act.subtitle_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t('act.content') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :content_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@act.content_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<!-- Place-->
<div class="control-group input-title">
<label class="control-label muted"><%= t('act.place') %></label>
<div class="controls">
<%= f.fields_for :place_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t('act.place'), value: (@act.place_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Note -->
<div class="control-group input-subtitle">
<label class="control-label muted"><%= t('act.note') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :note_translations do |f| %>
<%= f.text_area locale, rows: 2, class: "input-block-level", value: (@act.note_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 @act && !@act.act_links.blank? %>
<div class="exist">
<% @act.act_links.each_with_index do |act_link, i| %>
<%= f.fields_for :act_links, act_link do |f| %>
<%= render :partial => 'form_link', :object => act_link, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'act_link_field_count', @act.act_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 @act && !@act.act_files.blank? %>
<div class="exist">
<% @act.act_files.each_with_index do |act_file, i| %>
<%= f.fields_for :act_files, act_file do |f| %>
<%= render :partial => 'form_file', :object => act_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'act_file_field_count', @act.act_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 %>">
<%= link_to t('cancel'), admin_actives_path, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<script>
$(function() {
$("#act_is_top").parent().on("click",function(){
setTimeout(function(){
if($("#act_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)
})
$(".enabler").on("click",function(){
var parent = $(this).parent().parent().parent();
if($(this).is(":checked")){
parent.find(".required").show();
}else{
parent.find(".required").hide();
}
})
$("#main-wrap").after("");
$(document).on('click', '#add_link', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_act_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, :act_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_act_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, :act_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', '.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')
});
$("#act_is_external_link").on("change",function(){
if($(this).is(":checked") && $("input[name=\"act[sign_up]\"]:checked").val()=='yes'){
$("#external_link_box").show();
}else{
$("#external_link_box").hide();
}
}).trigger('change');
$("input[name=\"act[sign_up]\"]").change(function(){
if($("input[name=\"act[sign_up]\"]:checked").val()=='yes'){
$("#external_link_check_box").show();
}else{
$("#external_link_check_box").hide();
}
$("#act_is_external_link").trigger('change')
}).trigger('change');
var config = {}
config.autoGrow_minHeight = 50;
config.allowedContent = false;
config.disallowedContent = 'img';
config.toolbar = [
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] },
'/',
{ name: 'insert', items: [ 'SpecialChar'] },
{ name: 'styles', items: [ 'Font' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] }
];
var ckeditor_reduce = $('.ckeditor_reduce')
ckeditor_reduce.each(function(i,v){
CKEDITOR.replace(v,config);
});
});
</script>
<% end %>