Merge pull request 'master' (#16) from 123/seminar:master into master

Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/16
This commit is contained in:
chiu 2024-02-28 07:00:37 +00:00
commit a934972e72
20 changed files with 532 additions and 349 deletions

View File

@ -110,6 +110,7 @@ function setData(l, type, ol) {
_markup: fields+"["+l+"][markup]", _markup: fields+"["+l+"][markup]",
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol], _option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"], _placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
_instructions: ["instructions_" +l, fields+"["+l+"]["+type+"][instructions]"],
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"], _title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
_destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"], _destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"], _to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
@ -117,6 +118,34 @@ function setData(l, type, ol) {
return data; return data;
} }
// Deinit Template HTML (ex: ckeditor)
function deinit_template_html(_this) {
var ckeditor_areas = _this.find('.ckeditor');
if (typeof(CKEDITOR) == 'object') {
ckeditor_areas.each(function(i,v) {
var name = $(v).attr('name');
if (CKEDITOR.instances[name]) {
CKEDITOR.instances[name].destroy();
}
})
}
return _this;
}
// Init Template HTML (ex: ckeditor)
function init_template_html(_this) {
var ckeditor_areas = _this.find('.ckeditor');
if (typeof(CKEDITOR) == 'object') {
ckeditor_areas.each(function(i,v) {
var name = $(v).attr('name');
if (!CKEDITOR.instances[name]) {
CKEDITOR.replace(name);
}
})
}
return _this;
}
// Get Default Address Form // Get Default Address Form
function getAddressForm(trigger, element, decide) { function getAddressForm(trigger, element, decide) {
if(decide) { if(decide) {
@ -256,11 +285,11 @@ $(function() {
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0]; nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
seminar_mainType = $(this).data('seminar_mains') seminar_mainType = $(this).data('seminar_mains')
if($(this).hasClass('textInput')) { if($(this).hasClass('textInput')) {
$("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target')); init_template_html($("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target')));
} else if ($(this).hasClass('textLengInput')) { } else if ($(this).hasClass('textLengInput')) {
$("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target')); init_template_html($("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target')));
} else if ($(this).hasClass('address')) { } else if ($(this).hasClass('address')) {
$("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target')); init_template_html($("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target')));
} }
inputAppendLength(); inputAppendLength();
}; };
@ -288,7 +317,7 @@ $(function() {
}; };
attributesHeaderLength = $('.attributes:not(:hidden)').length+1; attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length; attributesLength = $('#attributes-area .attributes').length;
$("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" ); init_template_html($("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" ));
$('.toggle-check').togglebox(); $('.toggle-check').togglebox();
}); });
@ -439,7 +468,7 @@ $(function() {
console.log(appendIndex) console.log(appendIndex)
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref'); templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref');
$("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target')); init_template_html($("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target')));
inputAppendLength(); inputAppendLength();
}; };
if($(this).hasClass('remove-input')) { if($(this).hasClass('remove-input')) {
@ -454,6 +483,7 @@ $(function() {
$('#attributes-area').delegate('.dataType', 'change', function() { $('#attributes-area').delegate('.dataType', 'change', function() {
$(this).children("option:selected").each(function () { $(this).children("option:selected").each(function () {
var target = $(this).closest('.attributes').find('.field-type').not('.default'); var target = $(this).closest('.attributes').find('.field-type').not('.default');
deinit_template_html(target);
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
appendIndex = 0 appendIndex = 0
// $(this).closest('.attributes').find('.add-target').find('.input-append').length; // $(this).closest('.attributes').find('.add-target').find('.input-append').length;
@ -467,7 +497,7 @@ $(function() {
if($(this).attr('ref')) { if($(this).attr('ref')) {
templateType = $(this).attr('ref'); templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target); init_template_html($("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target));
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength(); inputAppendLength();
} }
@ -481,7 +511,7 @@ $(function() {
if($(this).attr('ref')) { if($(this).attr('ref')) {
templateType = $(this).attr('ref'); templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target); init_template_html($("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target));
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength(); inputAppendLength();
} }

View File

@ -110,6 +110,7 @@ function setData(l, type, ol) {
_markup: fields+"["+l+"][markup]", _markup: fields+"["+l+"][markup]",
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol], _option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"], _placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
_instructions: ["instructions_" +l, fields+"["+l+"]["+type+"][instructions]"],
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"], _title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
_destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"], _destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"], _to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
@ -117,6 +118,34 @@ function setData(l, type, ol) {
return data; return data;
} }
// Deinit Template HTML (ex: ckeditor)
function deinit_template_html(_this) {
var ckeditor_areas = _this.find('.ckeditor');
if (typeof(CKEDITOR) == 'object') {
ckeditor_areas.each(function(i,v) {
var name = $(v).attr('name');
if (CKEDITOR.instances[name]) {
CKEDITOR.instances[name].destroy();
}
})
}
return _this;
}
// Init Template HTML (ex: ckeditor)
function init_template_html(_this) {
var ckeditor_areas = _this.find('.ckeditor');
if (typeof(CKEDITOR) == 'object') {
ckeditor_areas.each(function(i,v) {
var name = $(v).attr('name');
if (!CKEDITOR.instances[name]) {
CKEDITOR.replace(name);
}
})
}
return _this;
}
// Get Default Address Form // Get Default Address Form
function getAddressForm(trigger, element, decide) { function getAddressForm(trigger, element, decide) {
if(decide) { if(decide) {
@ -256,11 +285,11 @@ $(function() {
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0]; nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
seminar_mainType = $(this).data('seminar_mains') seminar_mainType = $(this).data('seminar_mains')
if($(this).hasClass('textInput')) { if($(this).hasClass('textInput')) {
$("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target')); init_template_html($("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target')));
} else if ($(this).hasClass('textLengInput')) { } else if ($(this).hasClass('textLengInput')) {
$("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target')); init_template_html($("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target')));
} else if ($(this).hasClass('address')) { } else if ($(this).hasClass('address')) {
$("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target')); init_template_html($("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target')));
} }
inputAppendLength(); inputAppendLength();
}; };
@ -288,7 +317,7 @@ $(function() {
}; };
attributesHeaderLength = $('.attributes:not(:hidden)').length+1; attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length; attributesLength = $('#attributes-area .attributes').length;
$("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" ); init_template_html($("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" ));
$('.toggle-check').togglebox(); $('.toggle-check').togglebox();
}); });
@ -438,7 +467,7 @@ $(function() {
appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1; appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1;
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref'); templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref');
$("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target')); init_template_html($("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target')));
inputAppendLength(); inputAppendLength();
}; };
if($(this).hasClass('remove-input')) { if($(this).hasClass('remove-input')) {
@ -452,6 +481,7 @@ $(function() {
}); });
$('#attributes-area').delegate('.dataType', 'change', function() { $('#attributes-area').delegate('.dataType', 'change', function() {
$(this).children("option:selected").each(function () { $(this).children("option:selected").each(function () {
deinit_template_html(target);
var target = $(this).closest('.attributes').find('.field-type').not('.default'); var target = $(this).closest('.attributes').find('.field-type').not('.default');
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
appendIndex = 0 appendIndex = 0
@ -466,7 +496,7 @@ $(function() {
if($(this).attr('ref')) { if($(this).attr('ref')) {
templateType = $(this).attr('ref'); templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target); init_template_html($("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target));
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength(); inputAppendLength();
} }
@ -480,7 +510,7 @@ $(function() {
if($(this).attr('ref')) { if($(this).attr('ref')) {
templateType = $(this).attr('ref'); templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target); init_template_html($("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target));
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength(); inputAppendLength();
} }

View File

@ -345,7 +345,7 @@ class SeminarsController < ApplicationController
sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text) sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
end end
if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && (seminar.contribute_start_date.nil? || seminar.contribute_start_date <= time_now) && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now )
if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads') button_text = t('seminar_signup.uploads')
contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text) contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
@ -522,10 +522,13 @@ class SeminarsController < ApplicationController
def add_file_proc def add_file_proc
update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values']) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'].to_h)
flag = true flag = true
update_params.permit! update_params.permit!
if !update_params['seminar_submission_values'].nil? if update_params['seminar_submission_values'].present?
if update_params['seminar_submission_values']['0']['value'].nil?
flag = false
else
if update_params['seminar_submission_values']['0']['value'].class==String if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value'] value = update_params['seminar_submission_values']['0']['value']
if !value.to_s.blank? if !value.to_s.blank?
@ -538,6 +541,7 @@ class SeminarsController < ApplicationController
end end
end end
end end
end
else else
flag = false flag = false
end end
@ -574,9 +578,12 @@ class SeminarsController < ApplicationController
def update def update
@con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id]) @con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id])
update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values']) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'].to_h)
update_params.permit! update_params.permit!
unless update_params['seminar_submission_values'].nil? if update_params['seminar_submission_values'].present?
if update_params['seminar_submission_values']['0']['value'].nil?
flag = false
else
flag = true flag = true
if update_params['seminar_submission_values']['0']['value'].class==String if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value'] value = update_params['seminar_submission_values']['0']['value']
@ -590,6 +597,7 @@ class SeminarsController < ApplicationController
end end
end end
end end
end
if flag if flag
update_params['seminar_submission_values']['0']['value']['en'] = ' ' update_params['seminar_submission_values']['0']['value']['en'] = ' '
end end

View File

@ -29,6 +29,20 @@ module Admin::SeminarsFieldHelper
content_tag(:div,str,:class=>"tab-pane fade",:id=>(get_field_name_base+"tab_#{lang}")) content_tag(:div,str,:class=>"tab-pane fade",:id=>(get_field_name_base+"tab_#{lang}"))
end end
def render_instructions
control_group_wrapper_for_sm do |key,value|
if !@prefiled_value.nil?
value = can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value
else
value = nil
end
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
instructions = (typeG["instructions"].blank? ? "" : typeG["instructions"][key])
name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base
instructions.html_safe
end
end
def render_address def render_address
control_group_wrapper_for_sm do |key,value| control_group_wrapper_for_sm do |key,value|
value = (can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value) rescue nil value = (can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value) rescue nil

View File

@ -24,6 +24,7 @@ class SeminarSignupField
field :typeD, type: Hash, default: {cross_lang: false} field :typeD, type: Hash, default: {cross_lang: false}
field :typeE, type: Hash, default: {} field :typeE, type: Hash, default: {}
field :typeF, type: Hash, default: {} field :typeF, type: Hash, default: {}
field :typeG, type: Hash, default: {}
belongs_to :seminar_main belongs_to :seminar_main
has_many :seminar_signup_values, autosave: true, dependent: :destroy has_many :seminar_signup_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true

View File

@ -24,6 +24,7 @@ class SeminarSubmissionField
field :typeD, type: Hash, default: {cross_lang: false} field :typeD, type: Hash, default: {cross_lang: false}
field :typeE, type: Hash, default: {} field :typeE, type: Hash, default: {}
field :typeF, type: Hash, default: {cross_lang: "true"} field :typeF, type: Hash, default: {cross_lang: "true"}
field :typeG, type: Hash, default: {}
belongs_to :seminar_main belongs_to :seminar_main
has_many :seminar_submission_values, autosave: true, dependent: :destroy has_many :seminar_submission_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true

View File

@ -129,6 +129,34 @@
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
<% end if show_seminar_type_panel(attribute_field,"typeE") != 'typeE hide' %> <% end if show_seminar_type_panel(attribute_field,"typeE") != 'typeE hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeG")}" do%>
<% typeG_field_name = "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeG][instructions]" %>
<%= content_tag :div, class: "control-group" do %>
<label class="control-label muted" for=""><%= t('lists.markups.instructions') %></label>
<div class="controls">
<div class="input-append">
<div class="btn-group-clearfix">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<%= link_to t(locale).to_s,"##{name_to_id(typeG_field_name)}_#{locale}",:class=>"btn #{active}",:data=>{:toggle=>"tab"}%>
<% end %>
</div>
</div>
<div class="tab-content">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active in" : "'") %>
<%= content_tag :div, {class: "tab-pane fade #{active}", id: "#{name_to_id(typeG_field_name)}_#{locale}"} do %>
<% locale_value = attribute_field["typeG"]["instructions"][locale.to_s] %>
<%= text_area(typeG_field_name, locale, value: locale_value, placeholder: "#{t(locale).to_s}", data: {:type=>"lang_#{locale}"}, class: 'ckeditor') %>
<% end %>
<% end %>
</div>
</div>
</div>
<% end %>
<% end if show_seminar_type_panel(attribute_field,"typeG") != 'typeG hide' %>
<%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","id",:value=>attribute_field.id%> <%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","id",:value=>attribute_field.id%>
</div> </div>

View File

@ -128,6 +128,7 @@
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeE")}" do%> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeE")}" do%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%>
<% end if show_seminar_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%>
<div class="control-group"> <div class="control-group">
<label class="control-label muted" for=""><%= t(:options)%></label> <label class="control-label muted" for=""><%= t(:options)%></label>
@ -140,6 +141,35 @@
</div> </div>
</div> </div>
<% end if show_seminar_type_panel(attribute_submission_field,"typeF") != 'typeF hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeF") != 'typeF hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeG")}" do%>
<% typeG_field_name = "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeG][instructions]" %>
<%= content_tag :div, class: "control-group" do %>
<label class="control-label muted" for=""><%= t('lists.markups.instructions') %></label>
<div class="controls">
<div class="input-append">
<div class="btn-group-clearfix">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<%= link_to t(locale).to_s,"##{name_to_id(typeG_field_name)}_#{locale}",:class=>"btn #{active}",:data=>{:toggle=>"tab"}%>
<% end %>
</div>
</div>
<div class="tab-content">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active in" : "'") %>
<%= content_tag :div, {class: "tab-pane fade #{active}", id: "#{name_to_id(typeG_field_name)}_#{locale}"} do %>
<% locale_value = attribute_submission_field["typeG"]["instructions"][locale.to_s] %>
<%= text_area(typeG_field_name, locale, value: locale_value, placeholder: "#{t(locale).to_s}", data: {:type=>"lang_#{locale}"}, class: 'ckeditor') %>
<% end %>
<% end %>
</div>
</div>
</div>
<% end %>
<% end if show_seminar_type_panel(attribute_submission_field,"typeG") != 'typeG hide' %>
<%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","id",:value=>attribute_submission_field.id%> <%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","id",:value=>attribute_submission_field.id%>
</div> </div>

View File

@ -112,7 +112,7 @@
<script id="template-type" type="text/x-tmpl"> <script id="template-type" type="text/x-tmpl">
{{if templateType == 'typeA' || templateType == 'typeD' || templateType == 'typeG'}} {{if templateType == 'typeA' || templateType == 'typeD'}}
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t(:enabled_for)%></label> <label class="control-label muted"><%= t(:enabled_for)%></label>
<div class="controls"> <div class="controls">
@ -122,7 +122,7 @@
<%= t(:cross_lang) %> <%= t(:cross_lang) %>
</label> </label>
{{/if}} {{/if}}
{{if templateType == 'typeA' || templateType == 'typeG'}} {{if templateType == 'typeA'}}
<label class="checkbox inline"> <label class="checkbox inline">
<input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true"> <input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true">
<%= t(:add_more)%> <%= t(:add_more)%>
@ -257,6 +257,35 @@
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{if templateType == 'typeG'}}
<div class="control-group">
<label class="control-label muted">
<%= t('lists.markups.instructions') %>
</label>
<div class="controls">
<div class="input-append">
<div class="btn-group-clearfix">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<a class="btn <%= active %>" href="${'#'+_instructions[0]+'_<%= locale %>'}" data-toggle="tab">
<%= t(locale).to_s %>
</a>
<% end %>
</div>
</div>
<div class="tab-content">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<div class="tab-pane <%= active %> fade in" id="${_instructions[0]+'_<%= locale %>'}">
<textarea class="ckeditor" data-type="lang_<%= locale %>" placeholder="<%= t(locale).to_s %>" name="${_instructions[1]+'[<%= locale %>]'}"></textarea>
</div>
<% end %>
</div>
</div>
</div>
</div>
{{/if}}
</script> </script>

View File

@ -10,7 +10,7 @@
<%= javascript_include_tag "seminar-field-forms.js" %> <%= javascript_include_tag "seminar-field-forms.js" %>
<% end -%> <% end -%>
<%= form_for @attribute,:url => admin_seminar_path(@attribute) , :html => { :class=> "form-horizontal main-forms" } do |f| %> <%= form_for @attribute, url: admin_seminar_path(@attribute) , html: { class: "form-horizontal main-forms" } do |f| %>
<% if flash.now[:notice].present? %> <% if flash.now[:notice].present? %>
<%= flash.now[:notice]%> <%= flash.now[:notice]%>
<% end %> <% end %>
@ -19,7 +19,7 @@
<fieldset> <fieldset>
<div id="attributes-area" class="input-area sortable"> <div id="attributes-area" class="input-area sortable">
<%= render partial: "attribute_field",collection: @attribute.seminar_signup_fields.asc(:sort_number, :_id)%> <%= render partial: "attribute_field", collection: @attribute.seminar_signup_fields.asc(:sort_number, :_id)%>
</div> </div>
<div class="form-actions"> <div class="form-actions">

View File

@ -9,7 +9,7 @@
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %> <%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "seminar-field-forms-submission.js" %> <%= javascript_include_tag "seminar-field-forms-submission.js" %>
<% end -%> <% end -%>
<%= form_for @attribute,:url => admin_seminar_path(@attribute) , :html => { :class=> "form-horizontal main-forms" } do |f| %> <%= form_for @attribute, url: admin_seminar_path(@attribute) , html: { class: "form-horizontal main-forms" } do |f| %>
<% if flash.now[:notice].present? %> <% if flash.now[:notice].present? %>
<%= flash.now[:notice]%> <%= flash.now[:notice]%>
<% end %> <% end %>

View File

@ -9,7 +9,7 @@
color: red; color: red;
} }
</style> </style>
<% if (@seminar.contribute_start_date <= @time_now && (@seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) rescue false) %> <% if (@seminar.contribute_start_date.nil? || @seminar.contribute_start_date <= @time_now) && (@seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
<section id="main-wrap"> <section id="main-wrap">
<div class="sign-in have-other-sign-in"> <div class="sign-in have-other-sign-in">

View File

@ -9,9 +9,9 @@
data1 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0] data1 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0]
data2 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0] data2 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0]
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0] data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
show1 = !(data1.disabled) rescue false show1 = data1 ? !(data1.disabled) : false
show2 = !(data2.disabled) rescue false show2 = data2 ? !(data2.disabled) : false
show3 = !(data3.disabled) rescue false show3 = data3 ? !(data3.disabled) : false
name1 = data1['name'][I18n.locale] name1 = data1['name'][I18n.locale]
name2 = data2['name'][I18n.locale] name2 = data2['name'][I18n.locale]
name3 = data3['name'][I18n.locale] name3 = data3['name'][I18n.locale]
@ -22,7 +22,7 @@
prefix_url = OrbitHelper.url_to_show(@seminar.to_param) prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end end
%> %>
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %> <% if (@seminar.contribute_start_date.nil? || @seminar.contribute_start_date <= @time_now) && ( @seminar.contribute_end_date.nil? || @seminar.contribute_end_date+1 >= @time_now ) %>
<% begin %> <% begin %>
<% if !session[:seminar_signup_id].blank? %> <% if !session[:seminar_signup_id].blank? %>
<%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%> <%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>

View File

@ -45,3 +45,7 @@ markups:
ext_support: false ext_support: false
panel: typeF panel: typeF
display_only: seminar_submission_field display_only: seminar_submission_field
instructions:
muti_lang_input_supprt: false
ext_support: false
panel: typeG

View File

@ -6,6 +6,8 @@ en:
lists: lists:
markups: markups:
seminar_preferred_session: Preferred Session seminar_preferred_session: Preferred Session
instructions: Instructions
restful_actions: restful_actions:
edit_seminar_review: Review edit_seminar_review: Review
copy: Copy copy: Copy

View File

@ -6,6 +6,7 @@ zh_tw:
lists: lists:
markups: markups:
seminar_preferred_session: Preferred Session seminar_preferred_session: Preferred Session
instructions: "說明文字 Instructions"
restful_actions: restful_actions:
edit_seminar_review: 審查 edit_seminar_review: 審查

View File

@ -320,9 +320,9 @@ module CustomAnnouncementsHelper
if @target_action == "index" if @target_action == "index"
filename = overridehtml.nil? ? params[:layout_type] : overridehtml filename = overridehtml.nil? ? params[:layout_type] : overridehtml
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb")
if !File.exists?f if !File.exist?(f)
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "index.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "index.html.erb")
if !File.exists?f if !File.exist?(f)
return "<div class='well'>Maybe the administrator has changed the theme, please select the index page design again from the page settings.</div>".html_safe return "<div class='well'>Maybe the administrator has changed the theme, please select the index page design again from the page settings.</div>".html_safe
end end
end end
@ -362,7 +362,7 @@ module CustomAnnouncementsHelper
else else
filename = overridehtml.nil? ? @target_action : overridehtml filename = overridehtml.nil? ? @target_action : overridehtml
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb")
if File.exists?f if File.exist?(f)
file = File.open(f) file = File.open(f)
doc = Nokogiri::HTML(file, nil, "UTF-8") doc = Nokogiri::HTML(file, nil, "UTF-8")
file.close file.close
@ -464,7 +464,7 @@ module CustomAnnouncementsHelper
layout_types = [] layout_types = []
@key = Site.first.template @key = Site.first.template
f = File.join("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/info.json") f = File.join("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/info.json")
if File.exists?f if File.exist?(f)
info = File.read(f) info = File.read(f)
hash = JSON.parse(info) rescue {} hash = JSON.parse(info) rescue {}
frontends = hash["frontend"] || [] frontends = hash["frontend"] || []

View File

@ -2,6 +2,7 @@ require "yaml"
module CustomAnnouncement module CustomAnnouncement
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "custom_announcement" do initializer "custom_announcement" do
Rails.application.config.to_prepare do
begin begin
translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))} translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
data = {} data = {}
@ -151,4 +152,5 @@ module CustomAnnouncement
# s[:custom_bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 }) # s[:custom_bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
end end
end end
end
end end

View File

@ -1,6 +1,7 @@
module CustomGallery module CustomGallery
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "custom_gallery" do initializer "custom_gallery" do
Rails.application.config.to_prepare do
begin begin
translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))} translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
data = {} data = {}
@ -21,7 +22,7 @@ module CustomGallery
puts ['error in custom_gallery',e] puts ['error in custom_gallery',e]
end end
require File.expand_path('../../../app/models/custom_album_setting', __FILE__) require File.join(CustomGallery::Engine.root, 'app/models/custom_album_setting')
if defined?(CustomAlbumSetting) if defined?(CustomAlbumSetting)
if CustomAlbumSetting.first.nil? if CustomAlbumSetting.first.nil?
CustomAlbumSetting.create() CustomAlbumSetting.create()
@ -92,4 +93,5 @@ module CustomGallery
end end
end end
end end
end
end end

View File

@ -1,6 +1,7 @@
module Seminar module Seminar
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "seminar" do initializer "seminar" do
Rails.application.config.to_prepare do
OrbitApp.registration "Seminar", :type => "ModuleApp" do OrbitApp.registration "Seminar", :type => "ModuleApp" do
module_label "seminar.seminar" module_label "seminar.seminar"
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
@ -49,7 +50,7 @@ module Seminar
:active_for_action=>{'admin/seminars'=>'enquiry_for_applicants'}, :active_for_action=>{'admin/seminars'=>'enquiry_for_applicants'},
:available_for => 'users' :available_for => 'users'
end end
end
end end
end end
end end