forked from spen/seminar
557 lines
23 KiB
Plaintext
557 lines
23 KiB
Plaintext
<%
|
|
multi_helper = Admin::SeminarsHelper::MultiLang
|
|
new_record = @seminar.new_record? && @seminar.copy_id.nil?
|
|
%>
|
|
<% 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" %>
|
|
<% end %>
|
|
<style type="text/css">
|
|
.col-sm-10.controls{
|
|
margin-left:0px;
|
|
}
|
|
.input-append input{
|
|
width: 150px;
|
|
}
|
|
</style>
|
|
<!-- 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="#signup" data-toggle="tab"><%= t('seminar.signup') %></a></li>
|
|
<li><a href="#review" data-toggle="tab"><%= t('seminar.review') %></a></li>
|
|
<li><a href="#signup_set" data-toggle="tab"><%= t('seminar.signup_set') %></a></li>
|
|
<li><a href="#submission_set" data-toggle="tab"><%= t('seminar.submission_set') %></a></li>
|
|
<li><a href="#custom_set" data-toggle="tab"><%= t('seminar.custom_set') %></a></li>
|
|
<li><a href="#auto_send_email_set" data-toggle="tab"><%= t('seminar.auto_send_email_set') %></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>
|
|
|
|
<!-- Seminar Date Time Picker -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.seminar_start_date') %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :seminar_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.seminar_end_date') %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :seminar_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.organizer') %></label>
|
|
<div class="controls">
|
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'seminar_main[organizer_id]', email_members:Array(f.object.organizer), index: "1", select_name: 'organizer_id'} %>
|
|
</div>
|
|
</div>
|
|
<% if params[:action] == "copy" %>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.clone_signups') %></label>
|
|
<div class="controls">
|
|
<%= check_box_tag("clone_signups",true) %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
|
|
<!-- Sign up Module -->
|
|
<div class="tab-pane fade in " id="signup">
|
|
|
|
<!-- host -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t("seminar.registration_status") %></label>
|
|
<div class="controls">
|
|
<% ['G','C'].each do |t| %>
|
|
<label class="checkbox inline">
|
|
<input type="checkbox" name="seminar_main[registration_status][]" value="<%=t%>" <%=(!@seminar.registration_status.blank? and @seminar.registration_status.include?(t)) ? "checked" : "" %> ><%= t("seminar.registration_status_#{t}") %>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Sign up Date Time Picker -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.signup_start_date') %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :signup_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.signup_end_date') %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :signup_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Contribute Date Time Picker -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.contribute_start_date') %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :contribute_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.contribute_end_date') %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :contribute_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.contribute_file_count') %></label>
|
|
<div class="controls">
|
|
<%= f.text_field :contribute_file_count %>
|
|
(<%= t('seminar.blank_no_limit') %>)
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.note') %></label>
|
|
<div class="controls">
|
|
<%= multi_helper.multiple_lang_tag(nil,'text_area','signup_note_translations',(@seminar.signup_note_translations rescue {}),{rows: 5, class: "input-block-level ckeditor"},'',{},true) %>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- Review Module -->
|
|
<div class="tab-pane fade in " id="review">
|
|
<div class="control-group big-group">
|
|
<label class="control-label muted"><%= t("seminar.reviewer") %></label>
|
|
<div class="controls">
|
|
<% if !@member.nil? %>
|
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'seminar_main[reviewer_ids][]', email_members:@member, index: "2", select_name: 'reviewer_ids'} %>
|
|
<% else %>
|
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'seminar_main[reviewer_ids][]', email_members:[], index: "2", select_name: 'reviewer_ids'} %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.review_start_date') %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :review_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
|
</div>
|
|
</div>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('seminar.review_end_date') %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :review_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Signup Set Module -->
|
|
<div class="tab-pane fade in " id="signup_set" style="padding: 1.2em;">
|
|
<table>
|
|
<thead>
|
|
<th><%= t('seminar.field_name') %></th>
|
|
<th><%= t('seminar.name') %></th>
|
|
<th><%= t('seminar.placeholder') %></th>
|
|
<th><%= t('seminar.disable') %></th>
|
|
<th><%= t('seminar.hidden') %></th>
|
|
</thead>
|
|
<tbody>
|
|
<% @signup_sets.each_with_index do |attr_signup,signup_index| %>
|
|
<tr>
|
|
<td>
|
|
<%= t("seminar_signup.#{attr_signup.field_name}") %>
|
|
</td>
|
|
<td>
|
|
<%= show_set_field(attr_signup,'seminar_signup_field_sets_attributes',signup_index,'name') %>
|
|
</td>
|
|
<td>
|
|
<%= show_set_field(attr_signup,'seminar_signup_field_sets_attributes',signup_index,'placeholder') %>
|
|
</td>
|
|
<td>
|
|
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
|
|
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][disabled]" %>' value="false">
|
|
<%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][disabled]", true ,attr_signup.disabled) %>
|
|
</td>
|
|
<td>
|
|
<% if attr_signup.field_name != 'recaptcha' %>
|
|
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]" %>' value="false">
|
|
<%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
<!-- Submission Set Module -->
|
|
<div class="tab-pane fade in " id="submission_set" style="padding: 1.2em;">
|
|
<table>
|
|
<thead>
|
|
<th><%= t('seminar.field_name') %></th>
|
|
<th><%= t('seminar.name') %></th>
|
|
<th><%= t('seminar.placeholder') %></th>
|
|
<th><%= t('seminar.disable') %></th>
|
|
<th><%= t('seminar.hidden') %></th>
|
|
</thead>
|
|
<tbody>
|
|
<% @submission_set.each_with_index do |attr_signup,submission_index| %>
|
|
<tr>
|
|
<td>
|
|
<%= t("seminar_signup.#{attr_signup.field_name}") %>
|
|
</td>
|
|
<td>
|
|
<%= show_set_field(attr_signup,'seminar_submission_field_sets_attributes',submission_index,'name') %>
|
|
</td>
|
|
<td>
|
|
<%= show_set_field(attr_signup,'seminar_submission_field_sets_attributes',submission_index,'placeholder') %>
|
|
</td>
|
|
<td>
|
|
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_submission_field_sets_attributes][#{submission_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
|
|
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_submission_field_sets_attributes][#{submission_index}][disabled]" %>' value="false">
|
|
<%= check_box_tag("seminar_main[seminar_submission_field_sets_attributes][#{submission_index}][disabled]", true ,attr_signup.disabled) %>
|
|
</td>
|
|
<td>
|
|
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_submission_field_sets_attributes][#{submission_index}][hidden]" %>' value="false">
|
|
<%= check_box_tag("seminar_main[seminar_submission_field_sets_attributes][#{submission_index}][hidden]", true ,attr_signup.hidden) %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<div class="control-group">
|
|
<div class="control-label"><%=t('seminar_signup.enable_summary_choice')%></div>
|
|
<div class="controls"><%= f.check_box :enable_summary_choice %></div>
|
|
</div>
|
|
<% hidden_style = (f.object.enable_summary_choice) ? "" : "style=display:none" %>
|
|
<div class="control-group summary_choice_block" <%=hidden_style%>>
|
|
<div class="control-label"><%=t('seminar_signup.summary_choice_type')%></div>
|
|
<div class="controls"><%= f.select :summary_chioice_type,f.object.class::ChoiceTypes.map{|c| [t("seminar_signup.#{c}"),c]} %></div>
|
|
</div>
|
|
<div class="control-group summary_choice_block" <%=hidden_style%>>
|
|
<div class="control-label"><%=t('seminar_signup.choices')%></div>
|
|
<div class="controls">
|
|
<% f.object.summary_chioices.each do |choice| %>
|
|
<div>
|
|
<span class="remove_btn">X</span>
|
|
<%= text_field_tag "seminar_main[summary_chioices][]",choice, {:id=>nil} %>
|
|
</div>
|
|
<% end %>
|
|
<button type="button" class="btn btn-primary btn-small" id="add_summary_choice"><%=t(:new_)%></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Custom Set Module -->
|
|
<div class="tab-pane fade in " id="custom_set" style="padding: 1.2em;">
|
|
<table>
|
|
<thead>
|
|
<th style="padding-right: 2em;"><%= t('seminar.field_name') %></th>
|
|
<th><%= t('seminar.hidden') %></th>
|
|
</thead>
|
|
<tbody>
|
|
<% @custom_set.each_with_index do |attr_custom,custom_index| %>
|
|
<%
|
|
seminar_signup_field = SeminarSignupField.where(id:attr_custom.seminar_signup_field_id).first
|
|
next if seminar_signup_field.nil?
|
|
%>
|
|
<tr>
|
|
<td>
|
|
<%= seminar_signup_field.title rescue '' %>
|
|
</td>
|
|
<td>
|
|
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_customs_attributes][#{custom_index}][hidden]" %>' value="false">
|
|
<%= check_box_tag("seminar_main[seminar_signup_field_customs_attributes][#{custom_index}][hidden]", true ,attr_custom.hidden) %>
|
|
</td>
|
|
<% if !attr_custom.new_record? %>
|
|
<input for="field_0" id="seminar_main_seminar_signup_field_customs_attributes_<%= custom_index.to_s %>_id" name="seminar_main[seminar_signup_field_customs_attributes][<%= custom_index.to_s %>][id]" type="hidden" value="<%= attr_custom.id.to_s %>">
|
|
<% elsif f.object.copy_id.present? %>
|
|
<input name="seminar_main[seminar_signup_field_customs_attributes][<%= custom_index.to_s %>][title]" type="hidden" value="<%= attr_custom.seminar_signup_field.title.to_s %>">
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- Email Set Module -->
|
|
<div class="tab-pane fade in " id="auto_send_email_set" style="padding: 1.2em;">
|
|
<ul class="nav nav-pills module-nav">
|
|
<li class="active">
|
|
<a href="#email_set0" data-toggle="tab">
|
|
<%= t('seminar.email_signup') %>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="#email_set1" data-toggle="tab">
|
|
<%= t('seminar.email_submission') %>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="#email_set2" data-toggle="tab">
|
|
<%= t('seminar.email_add_file') %>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="#email_set3" data-toggle="tab">
|
|
<%= t('seminar.email_edit_file') %>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content">
|
|
<% (0..3).each do |index1| %>
|
|
<% active_email_set = index1==0 ? ' active' : '' %>
|
|
<div class="tab-pane<%= active_email_set %>" id="email_set<%= index1 %>" style="padding: 1.2em;">
|
|
<table style="width:100%;">
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<%= t('seminar.disable') %>
|
|
</td>
|
|
<td>
|
|
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_email_sets][#{index1}][disabled]" %>' value="false">
|
|
<%= check_box_tag("seminar_main[seminar_email_sets][#{index1}][disabled]", true ,@email_set[index1].disabled) %>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<%= t('seminar.email_title') %>
|
|
</td>
|
|
<td>
|
|
<%= show_set_field(@email_set[index1],'seminar_email_sets',index1,'title','text_field') %>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<%= t('seminar.email_content') %>
|
|
</td>
|
|
<td>
|
|
<div class="form-group">
|
|
<%= show_set_field(@email_set[index1],'seminar_email_sets',index1,'content','text_area') %>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
|
|
</table>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</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('seminar.title') %></label>
|
|
<div class="controls">
|
|
<%= f.fields_for :title_translations do |f| %>
|
|
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@seminar.title_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Speaker -->
|
|
<div class="control-group input-title">
|
|
<label class="control-label muted"><%= t('seminar.speaker') %></label>
|
|
<div class="controls">
|
|
<%= f.fields_for :speaker_translations do |f| %>
|
|
<%= f.text_field locale, class: "input-block-level", placeholder: t('seminar.speaker'), value: (@seminar.speaker_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Content -->
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted"><%= t('seminar.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 => (@seminar.content_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Place-->
|
|
<div class="control-group input-title">
|
|
<label class="control-label muted"><%= t('seminar.act_place') %></label>
|
|
<div class="controls">
|
|
<%= f.fields_for :act_place_translations do |f| %>
|
|
<%= f.text_field locale, class: "input-block-level", placeholder: t('seminar.act_place'), value: (@seminar.act_place_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<!-- Link -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:link) %></label>
|
|
<div class="controls add-input">
|
|
|
|
<!-- Exist -->
|
|
<% if @seminar && !@seminar.seminar_links.blank? %>
|
|
<div class="exist">
|
|
<% @seminar.seminar_links.each_with_index do |seminar_link, i| %>
|
|
<%= f.fields_for :seminar_links, seminar_link do |f| %>
|
|
<%= render :partial => 'form_link', :object => seminar_link, :locals => {:f => f, :i => i} %>
|
|
<% end %>
|
|
<% end %>
|
|
<hr>
|
|
</div>
|
|
<% end %>
|
|
|
|
<!-- Add -->
|
|
<div class="add-target">
|
|
</div>
|
|
<p class="add-btn">
|
|
<%= hidden_field_tag 'seminar_link_field_count', @seminar.seminar_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 @seminar && !@seminar.seminar_files.blank? %>
|
|
<div class="exist">
|
|
<% @seminar.seminar_files.each_with_index do |seminar_file, i| %>
|
|
<%= f.fields_for :seminar_files, seminar_file do |f| %>
|
|
<%= render :partial => 'form_file', :object => seminar_file, :locals => {:f => f, :i => i} %>
|
|
<% end %>
|
|
<% end %>
|
|
<hr>
|
|
</div>
|
|
<% end %>
|
|
|
|
<!-- Add -->
|
|
<div class="add-target">
|
|
</div>
|
|
<p class="add-btn">
|
|
<%= hidden_field_tag 'seminar_file_field_count', @seminar.seminar_files.to_a.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[:seminarion] rescue "" %>
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
|
<%= link_to t('cancel'), admin_seminars_path, :class=>"btn" %>
|
|
</div>
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
<script>
|
|
$(function() {
|
|
$("#main-wrap").after("");
|
|
|
|
$(document).on('click', '#add_link', function(){
|
|
var new_id = $(this).prev().attr('value');
|
|
var old_id = new RegExp("new_seminar_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, :seminar_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_seminar_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, :seminar_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();
|
|
}
|
|
});
|
|
$(document).on('click','#add_summary_choice',function(){
|
|
$(this).before("<div><span class=\"remove_btn\">X</span><input name=\"seminar_main[summary_chioices][]\" type=\"text\"></div>")
|
|
})
|
|
$(document).on('click','.remove_btn',function(){
|
|
$(this).parent().remove();
|
|
})
|
|
$("input[name=\"seminar_main[enable_summary_choice]\"]").change(function(){
|
|
if($(this).prop("checked")){
|
|
$(".summary_choice_block").css("display","");
|
|
}else{
|
|
$(".summary_choice_block").css("display","none");
|
|
}
|
|
})
|
|
});
|
|
</script>
|
|
<% end %>
|
|
<style type="text/css">
|
|
.remove_btn{
|
|
color: red;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
}
|
|
</style> |