forked from spen/seminar
Compare commits
33 Commits
Author | SHA1 | Date |
---|---|---|
chiu | 8addfd0631 | |
邱博亞 | 496dc1181f | |
chiu | d62248c9e0 | |
邱博亞 | 5a31d2c709 | |
邱博亞 | aadc929ae0 | |
邱博亞 | f05280d97d | |
chiu | be3af16a12 | |
邱博亞 | 382df44068 | |
邱博亞 | e4790f8490 | |
邱博亞 | cb7cad9c74 | |
邱博亞 | 8b9bfaab8d | |
邱博亞 | 52755f9afe | |
chiu | 397046e9b4 | |
邱博亞 | ca4a2f86f2 | |
chiu | a934972e72 | |
邱博亞 | 1e52c3bf91 | |
邱博亞 | d6b2d23462 | |
邱博亞 | 40831d3b8c | |
邱博亞 | 1ae15033a8 | |
chiu | 31112700c3 | |
chiu | dd935ebf89 | |
chiu | 78012b43f2 | |
chiu | 2b3c4bbb6f | |
chiu | dde6e2a8cf | |
chiu | 81040a3413 | |
chiu | ac824fb5ed | |
chiu | 55d504d0d9 | |
chiu | f25c6b6934 | |
chiu | 81ea8c4f67 | |
chiu | f2ab125ae6 | |
chiu | 651f6cb29c | |
chiu | 3627bdc4b2 | |
chiu | f952165f34 |
|
@ -110,6 +110,7 @@ function setData(l, type, ol) {
|
|||
_markup: fields+"["+l+"][markup]",
|
||||
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
|
||||
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
|
||||
_instructions: ["instructions_" +l, fields+"["+l+"]["+type+"][instructions]"],
|
||||
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
|
||||
_destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
|
||||
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
|
||||
|
@ -117,6 +118,34 @@ function setData(l, type, ol) {
|
|||
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
|
||||
function getAddressForm(trigger, element, decide) {
|
||||
if(decide) {
|
||||
|
@ -256,11 +285,11 @@ $(function() {
|
|||
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
|
||||
seminar_mainType = $(this).data('seminar_mains')
|
||||
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')) {
|
||||
$("#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')) {
|
||||
$("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
|
||||
init_template_html($("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target')));
|
||||
}
|
||||
inputAppendLength();
|
||||
};
|
||||
|
@ -288,7 +317,7 @@ $(function() {
|
|||
};
|
||||
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
|
||||
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();
|
||||
});
|
||||
|
||||
|
@ -439,7 +468,7 @@ $(function() {
|
|||
console.log(appendIndex)
|
||||
attributeIndex = $(this).closest('.attributes').index();
|
||||
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();
|
||||
};
|
||||
if($(this).hasClass('remove-input')) {
|
||||
|
@ -454,6 +483,7 @@ $(function() {
|
|||
$('#attributes-area').delegate('.dataType', 'change', function() {
|
||||
$(this).children("option:selected").each(function () {
|
||||
var target = $(this).closest('.attributes').find('.field-type').not('.default');
|
||||
deinit_template_html(target);
|
||||
attributeIndex = $(this).closest('.attributes').index();
|
||||
appendIndex = 0
|
||||
// $(this).closest('.attributes').find('.add-target').find('.input-append').length;
|
||||
|
@ -467,7 +497,7 @@ $(function() {
|
|||
if($(this).attr('ref')) {
|
||||
templateType = $(this).attr('ref');
|
||||
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') {
|
||||
inputAppendLength();
|
||||
}
|
||||
|
@ -481,7 +511,7 @@ $(function() {
|
|||
if($(this).attr('ref')) {
|
||||
templateType = $(this).attr('ref');
|
||||
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') {
|
||||
inputAppendLength();
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@ function setData(l, type, ol) {
|
|||
_markup: fields+"["+l+"][markup]",
|
||||
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
|
||||
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
|
||||
_instructions: ["instructions_" +l, fields+"["+l+"]["+type+"][instructions]"],
|
||||
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
|
||||
_destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
|
||||
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
|
||||
|
@ -117,6 +118,34 @@ function setData(l, type, ol) {
|
|||
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
|
||||
function getAddressForm(trigger, element, decide) {
|
||||
if(decide) {
|
||||
|
@ -256,11 +285,11 @@ $(function() {
|
|||
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
|
||||
seminar_mainType = $(this).data('seminar_mains')
|
||||
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')) {
|
||||
$("#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')) {
|
||||
$("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
|
||||
init_template_html($("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target')));
|
||||
}
|
||||
inputAppendLength();
|
||||
};
|
||||
|
@ -288,7 +317,7 @@ $(function() {
|
|||
};
|
||||
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
|
||||
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();
|
||||
});
|
||||
|
||||
|
@ -438,7 +467,7 @@ $(function() {
|
|||
appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1;
|
||||
attributeIndex = $(this).closest('.attributes').index();
|
||||
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();
|
||||
};
|
||||
if($(this).hasClass('remove-input')) {
|
||||
|
@ -453,6 +482,7 @@ $(function() {
|
|||
$('#attributes-area').delegate('.dataType', 'change', function() {
|
||||
$(this).children("option:selected").each(function () {
|
||||
var target = $(this).closest('.attributes').find('.field-type').not('.default');
|
||||
deinit_template_html(target);
|
||||
attributeIndex = $(this).closest('.attributes').index();
|
||||
appendIndex = 0
|
||||
// $(this).closest('.attributes').find('.add-target').find('.input-append').length;
|
||||
|
@ -466,7 +496,7 @@ $(function() {
|
|||
if($(this).attr('ref')) {
|
||||
templateType = $(this).attr('ref');
|
||||
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') {
|
||||
inputAppendLength();
|
||||
}
|
||||
|
@ -480,7 +510,7 @@ $(function() {
|
|||
if($(this).attr('ref')) {
|
||||
templateType = $(this).attr('ref');
|
||||
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') {
|
||||
inputAppendLength();
|
||||
}
|
||||
|
|
|
@ -334,6 +334,7 @@ class SeminarsController < ApplicationController
|
|||
seminar_url = (@prefix_url ? @prefix_url : OrbitHelper.url_to_show(seminar.to_param))
|
||||
if !registration_is_open
|
||||
sign_up = t('seminar.sign_up_not_open')
|
||||
sign_up_not_yet = true
|
||||
elsif sign_up_not_yet
|
||||
sign_up = t('seminar.sign_up_not_yet')
|
||||
elsif sign_up_overdue
|
||||
|
@ -345,7 +346,7 @@ class SeminarsController < ApplicationController
|
|||
sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
|
||||
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
|
||||
button_text = t('seminar_signup.uploads')
|
||||
contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
|
||||
|
@ -360,6 +361,7 @@ class SeminarsController < ApplicationController
|
|||
'sign_up' => sign_up,
|
||||
'contribute_action' => contribute_action,
|
||||
'time_now' => time_now,
|
||||
'sign_up_not_yet' => sign_up_not_yet,
|
||||
'contribute_time_range' => SeminarMain.time_range(seminar.contribute_start_date, seminar.contribute_end_date),
|
||||
'sign_up_time_range' => SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date),
|
||||
'seminar_time_range' => SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date)
|
||||
|
@ -522,20 +524,24 @@ class SeminarsController < ApplicationController
|
|||
|
||||
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
|
||||
update_params.permit!
|
||||
if !update_params['seminar_submission_values'].nil?
|
||||
if update_params['seminar_submission_values']['0']['value'].class==String
|
||||
value = update_params['seminar_submission_values']['0']['value']
|
||||
if !value.to_s.blank?
|
||||
flag = false
|
||||
end
|
||||
if update_params['seminar_submission_values'].present?
|
||||
if update_params['seminar_submission_values']['0']['value'].nil?
|
||||
flag = false
|
||||
else
|
||||
update_params['seminar_submission_values']['0']['value'].each do |key,value|
|
||||
if !value.to_s.blank?
|
||||
if update_params['seminar_submission_values']['0']['value'].class==String
|
||||
value = update_params['seminar_submission_values']['0']['value']
|
||||
if !value.to_s.blank?
|
||||
flag = false
|
||||
end
|
||||
else
|
||||
update_params['seminar_submission_values']['0']['value'].each do |key,value|
|
||||
if !value.to_s.blank?
|
||||
flag = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -574,20 +580,24 @@ class SeminarsController < ApplicationController
|
|||
|
||||
def update
|
||||
@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!
|
||||
unless update_params['seminar_submission_values'].nil?
|
||||
flag = true
|
||||
if update_params['seminar_submission_values']['0']['value'].class==String
|
||||
value = update_params['seminar_submission_values']['0']['value']
|
||||
if !value.to_s.blank?
|
||||
flag = false
|
||||
end
|
||||
if update_params['seminar_submission_values'].present?
|
||||
if update_params['seminar_submission_values']['0']['value'].nil?
|
||||
flag = false
|
||||
else
|
||||
update_params['seminar_submission_values']['0']['value'].each do |key,value|
|
||||
if !value.to_s.blank?
|
||||
flag = true
|
||||
if update_params['seminar_submission_values']['0']['value'].class==String
|
||||
value = update_params['seminar_submission_values']['0']['value']
|
||||
if !value.to_s.blank?
|
||||
flag = false
|
||||
end
|
||||
else
|
||||
update_params['seminar_submission_values']['0']['value'].each do |key,value|
|
||||
if !value.to_s.blank?
|
||||
flag = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if flag
|
||||
|
|
|
@ -26,7 +26,21 @@ module Admin::SeminarsFieldHelper
|
|||
end
|
||||
|
||||
def lang_tab(str,lang)
|
||||
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
|
||||
|
||||
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
|
||||
|
|
|
@ -24,6 +24,7 @@ class SeminarSignupField
|
|||
field :typeD, type: Hash, default: {cross_lang: false}
|
||||
field :typeE, type: Hash, default: {}
|
||||
field :typeF, type: Hash, default: {}
|
||||
field :typeG, type: Hash, default: {}
|
||||
belongs_to :seminar_main
|
||||
has_many :seminar_signup_values, autosave: true, dependent: :destroy
|
||||
accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true
|
||||
|
|
|
@ -24,6 +24,7 @@ class SeminarSubmissionField
|
|||
field :typeD, type: Hash, default: {cross_lang: false}
|
||||
field :typeE, type: Hash, default: {}
|
||||
field :typeF, type: Hash, default: {cross_lang: "true"}
|
||||
field :typeG, type: Hash, default: {}
|
||||
belongs_to :seminar_main
|
||||
has_many :seminar_submission_values, autosave: true, dependent: :destroy
|
||||
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true
|
||||
|
|
|
@ -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"]}%>
|
||||
<% 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"].present? ? 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%>
|
||||
|
||||
</div>
|
|
@ -128,6 +128,7 @@
|
|||
<%= 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"]}%>
|
||||
<% 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%>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:options)%></label>
|
||||
|
@ -140,6 +141,35 @@
|
|||
</div>
|
||||
</div>
|
||||
<% 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"].present? ? 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%>
|
||||
|
||||
</div>
|
|
@ -112,7 +112,7 @@
|
|||
|
||||
|
||||
<script id="template-type" type="text/x-tmpl">
|
||||
{{if templateType == 'typeA' || templateType == 'typeD' || templateType == 'typeG'}}
|
||||
{{if templateType == 'typeA' || templateType == 'typeD'}}
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:enabled_for)%></label>
|
||||
<div class="controls">
|
||||
|
@ -122,7 +122,7 @@
|
|||
<%= t(:cross_lang) %>
|
||||
</label>
|
||||
{{/if}}
|
||||
{{if templateType == 'typeA' || templateType == 'typeG'}}
|
||||
{{if templateType == 'typeA'}}
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true">
|
||||
<%= t(:add_more)%>
|
||||
|
@ -257,6 +257,35 @@
|
|||
</div>
|
||||
</div>
|
||||
{{/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>
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<% content_for :page_specific_css do -%>
|
||||
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
|
||||
<%= stylesheet_link_tag "lib/pageslide.css" %>
|
||||
<%= stylesheet_link_tag "lib/main-forms.css" %>
|
||||
<%= stylesheet_link_tag "lib/togglebox.css" %>
|
||||
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
|
||||
<%= stylesheet_link_tag "lib/pageslide.css" %>
|
||||
<%= stylesheet_link_tag "lib/main-forms.css" %>
|
||||
<%= stylesheet_link_tag "lib/togglebox.css" %>
|
||||
<% end -%>
|
||||
|
||||
<% content_for :page_specific_javascript do -%>
|
||||
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
|
||||
<%= javascript_include_tag "seminar-field-forms.js" %>
|
||||
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
|
||||
<%= javascript_include_tag "seminar-field-forms.js" %>
|
||||
<% 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? %>
|
||||
<%= flash.now[:notice]%>
|
||||
<% end %>
|
||||
|
@ -19,7 +19,7 @@
|
|||
<fieldset>
|
||||
|
||||
<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 class="form-actions">
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<% content_for :page_specific_css do -%>
|
||||
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
|
||||
<%= stylesheet_link_tag "lib/pageslide.css" %>
|
||||
<%= stylesheet_link_tag "lib/main-forms.css" %>
|
||||
<%= stylesheet_link_tag "lib/togglebox.css" %>
|
||||
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
|
||||
<%= stylesheet_link_tag "lib/pageslide.css" %>
|
||||
<%= stylesheet_link_tag "lib/main-forms.css" %>
|
||||
<%= stylesheet_link_tag "lib/togglebox.css" %>
|
||||
<% end -%>
|
||||
|
||||
<% content_for :page_specific_javascript do -%>
|
||||
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
|
||||
<%= javascript_include_tag "seminar-field-forms-submission.js" %>
|
||||
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
|
||||
<%= javascript_include_tag "seminar-field-forms-submission.js" %>
|
||||
<% 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? %>
|
||||
<%= flash.now[:notice]%>
|
||||
<% end %>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
color: red;
|
||||
}
|
||||
</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">
|
||||
<div class="sign-in have-other-sign-in">
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
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]
|
||||
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
|
||||
show1 = !(data1.disabled) rescue false
|
||||
show2 = !(data2.disabled) rescue false
|
||||
show3 = !(data3.disabled) rescue false
|
||||
show1 = data1 ? !(data1.disabled) : false
|
||||
show2 = data2 ? !(data2.disabled) : false
|
||||
show3 = data3 ? !(data3.disabled) : false
|
||||
name1 = data1['name'][I18n.locale]
|
||||
name2 = data2['name'][I18n.locale]
|
||||
name3 = data3['name'][I18n.locale]
|
||||
|
@ -22,7 +22,7 @@
|
|||
prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
|
||||
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 %>
|
||||
<% if !session[:seminar_signup_id].blank? %>
|
||||
<%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
@sign_up_time_range = data["sign_up_time_range"]
|
||||
@seminar_time_range = data["seminar_time_range"]
|
||||
@contribute_time_range = data["contribute_time_range"]
|
||||
@contribute_action = data["contribute_action"]
|
||||
@contribute_action = data["contribute_action"]
|
||||
@sign_up_not_yet = data["sign_up_not_yet"]
|
||||
%>
|
||||
|
||||
|
||||
|
@ -19,7 +20,7 @@
|
|||
<th class="seminarive-title-field"><%= t(:category) %></th>
|
||||
<td class="seminarive-title-value"><%= @seminar.category.title %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr <%= 'class="hidden"'.html_safe if @seminar_time_range.blank? %>>
|
||||
<th class="seminarive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('seminar.event_during') %></th>
|
||||
<td class="seminarive-title-value"><%= @seminar_time_range %></td>
|
||||
</tr>
|
||||
|
@ -39,7 +40,7 @@
|
|||
<td class="seminarive-title-value"><%= nl2br(@seminar.content) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<tr <%= 'class="hidden"'.html_safe if @sign_up_time_range.blank? %>>
|
||||
<th class="seminarive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('seminar.signup_during') %></th>
|
||||
<td class="seminarive-title-value"><%= @sign_up_time_range %></td>
|
||||
</tr>
|
||||
|
@ -49,7 +50,7 @@
|
|||
<td class="seminarive-title-value"><%= @contribute_time_range %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<tr <%= 'class="hidden"'.html_safe if @sign_up_not_yet && @contribute_action.blank? %>>
|
||||
<th class="seminarive-title-field"><%= t('seminar.signup') %></th>
|
||||
<td class="seminarive-title-value"><%= @sign_up %><br /><%= @contribute_action %></td>
|
||||
</tr>
|
||||
|
|
|
@ -45,3 +45,7 @@ markups:
|
|||
ext_support: false
|
||||
panel: typeF
|
||||
display_only: seminar_submission_field
|
||||
instructions:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeG
|
|
@ -5,7 +5,9 @@ en:
|
|||
label: ""
|
||||
lists:
|
||||
markups:
|
||||
seminar_preferred_session: Preferred Session
|
||||
seminar_preferred_session: Preferred Session
|
||||
instructions: Instructions
|
||||
|
||||
restful_actions:
|
||||
edit_seminar_review: Review
|
||||
copy: Copy
|
||||
|
@ -46,12 +48,12 @@ en:
|
|||
home_setting: Home Setting
|
||||
sub_page_setting: Sub Page Setting
|
||||
menu:
|
||||
introduction: Introduction
|
||||
news: News
|
||||
registration: Registration
|
||||
registered_participants: Registered Participants
|
||||
submission: Submission
|
||||
album: Album
|
||||
introduction: Introduction
|
||||
news: News
|
||||
registration: Registration
|
||||
registered_participants: Registered Participants
|
||||
submission: Submission
|
||||
album: Album
|
||||
introduction: Introduction
|
||||
announcement_limit: Announcement ;imit
|
||||
album_limit: Album limit
|
||||
|
@ -160,7 +162,7 @@ en:
|
|||
contribute_file_count: Count of Contribute Files #投稿檔案數
|
||||
|
||||
frontend:
|
||||
seminar: Semianr #研討會前台
|
||||
seminar: Semianr #研討會前台
|
||||
|
||||
seminar_item:
|
||||
new_item: New Item #新增項目
|
||||
|
|
|
@ -5,7 +5,8 @@ zh_tw:
|
|||
label: ""
|
||||
lists:
|
||||
markups:
|
||||
seminar_preferred_session: Preferred Session
|
||||
seminar_preferred_session: Preferred Session
|
||||
instructions: "說明文字 Instructions"
|
||||
|
||||
restful_actions:
|
||||
edit_seminar_review: 審查
|
||||
|
@ -47,12 +48,12 @@ zh_tw:
|
|||
home_setting: 首頁設定
|
||||
sub_page_setting: 內頁設定
|
||||
menu:
|
||||
introduction: 介紹
|
||||
news: 公告
|
||||
registration: 註冊
|
||||
registered_participants: 註冊參與者
|
||||
submission: 投稿
|
||||
album: 相簿
|
||||
introduction: 介紹
|
||||
news: 公告
|
||||
registration: 註冊
|
||||
registered_participants: 註冊參與者
|
||||
submission: 投稿
|
||||
album: 相簿
|
||||
introduction: 介紹
|
||||
announcement_limit: 公告上限
|
||||
album_limit: 相簿上限
|
||||
|
@ -161,7 +162,7 @@ zh_tw:
|
|||
contribute_file_count: 投稿檔案數
|
||||
|
||||
frontend:
|
||||
seminar: 研討會前台
|
||||
seminar: 研討會前台
|
||||
|
||||
seminar_item:
|
||||
new_item: 新增項目
|
||||
|
|
|
@ -320,9 +320,9 @@ module CustomAnnouncementsHelper
|
|||
if @target_action == "index"
|
||||
filename = overridehtml.nil? ? params[:layout_type] : overridehtml
|
||||
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")
|
||||
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
|
||||
end
|
||||
end
|
||||
|
@ -333,7 +333,7 @@ module CustomAnnouncementsHelper
|
|||
begin
|
||||
data = @data# rescue nil
|
||||
rescue Exception => e
|
||||
write_debug_file(e,'custom_announcements',@target_action) if Site::DEBUG
|
||||
write_debug_file(e,'custom_announcements',@target_action) if Site::DEBUG
|
||||
end
|
||||
if !data.nil?
|
||||
wrap_elements = doc.css("*[data-list][data-level='0']")
|
||||
|
@ -362,7 +362,7 @@ module CustomAnnouncementsHelper
|
|||
else
|
||||
filename = overridehtml.nil? ? @target_action : overridehtml
|
||||
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)
|
||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||
file.close
|
||||
|
@ -464,7 +464,7 @@ module CustomAnnouncementsHelper
|
|||
layout_types = []
|
||||
@key = Site.first.template
|
||||
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)
|
||||
hash = JSON.parse(info) rescue {}
|
||||
frontends = hash["frontend"] || []
|
||||
|
|
|
@ -2,153 +2,155 @@ require "yaml"
|
|||
module CustomAnnouncement
|
||||
class Engine < ::Rails::Engine
|
||||
initializer "custom_announcement" do
|
||||
begin
|
||||
translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
||||
data = {}
|
||||
key1 = {}
|
||||
key2 = {}
|
||||
key3 = {}
|
||||
key4 = {}
|
||||
key1_attr = []
|
||||
key2_attr = []
|
||||
key3_attr = []
|
||||
key4_attr = []
|
||||
data_item = {}
|
||||
key_item1 = {}
|
||||
key_item2 = {}
|
||||
key_item3 = {}
|
||||
value_item1 = {}
|
||||
value_item2 = {}
|
||||
value_item3 = {}
|
||||
value2_item1 = {}
|
||||
value2_item2 = {}
|
||||
key1_options = ['small_size','medium_size','orignal_size']
|
||||
key2_options = ['not_enable_tabs','enable_tabs_with_categories_include_all','enable_tabs_with_categories']
|
||||
key3_options = ['default','upper_left','lower_left','upper_right','lower_right']
|
||||
key4_options = ['the_same_as_data_count','display_all_in_other_tabs']
|
||||
key1_options.each_with_index do |k,i|
|
||||
key1_attr[i] = {}
|
||||
end
|
||||
key2_options.each_with_index do |k,i|
|
||||
key2_attr[i] = {}
|
||||
end
|
||||
key3_options.each_with_index do |k,i|
|
||||
key3_attr[i] = {}
|
||||
end
|
||||
key4_options.each_with_index do |k,i|
|
||||
key4_attr[i] = {}
|
||||
end
|
||||
translate_data.each do |t_data|
|
||||
v = t_data.values
|
||||
k = t_data.keys[0]
|
||||
key1[k] = v[0]['custom_announcement']['picture_showing_size']
|
||||
key2[k] = v[0]['custom_announcement']['tabs_options']
|
||||
key3[k] = v[0]['custom_announcement']['read_more_position_options']
|
||||
key4[k] = v[0]['custom_announcement']['all_tabs_setting']
|
||||
key1_options.each_with_index do |kk,i|
|
||||
key1_attr[i][k] = v[0]['custom_announcement'][kk]
|
||||
end
|
||||
key2_options.each_with_index do |kk,i|
|
||||
key2_attr[i][k] = v[0]['custom_announcement'][kk]
|
||||
end
|
||||
key3_options.each_with_index do |kk,i|
|
||||
key3_attr[i][k] = v[0]['custom_announcement'][kk]
|
||||
end
|
||||
key4_options.each_with_index do |kk,i|
|
||||
key4_attr[i][k] = v[0]['custom_announcement'][kk]
|
||||
end
|
||||
key_item1[k] = v[0]['custom_announcement']['showing_back_and_next']
|
||||
key_item2[k] = v[0]['custom_announcement']['enable_search']
|
||||
value_item1[k] = v[0]['custom_announcement']['not_show']
|
||||
value_item2[k] = v[0]['custom_announcement']['show_bottom']
|
||||
value_item3[k] = v[0]['custom_announcement']['show_top']
|
||||
value2_item1[k] = v[0]['custom_announcement']['no']
|
||||
value2_item2[k] = v[0]['custom_announcement']['yes']
|
||||
end
|
||||
data[key1] = key1_attr
|
||||
data[key2] = key2_attr
|
||||
data[key3] = key3_attr
|
||||
data[key4] = key4_attr
|
||||
data_item[key_item1] = [value_item1,value_item2,value_item3]
|
||||
data_item[key_item2] = [value2_item1,value2_item2]
|
||||
require File.expand_path('../../../app/models/custom_anns_cache', __FILE__)
|
||||
if defined? CustomAnnsCache
|
||||
CustomAnnsCache.destroy_all
|
||||
end
|
||||
rescue => e
|
||||
puts ['error in custom_announcement',e]
|
||||
end
|
||||
OrbitApp.registration "CustomAnnouncement", :type => "ModuleApp" do
|
||||
module_label "custom_announcement.custom_announcement"
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
widget_methods ["widget","random_custom_announcement_widget", "tag_cloud"]
|
||||
widget_settings [{"data_count"=>30,"enable_custom_widget_data"=>true}]
|
||||
taggable "CustomBulletin"
|
||||
categorizable
|
||||
authorizable
|
||||
frontend_enabled
|
||||
feeds_url "/xhr/custom_announcements/feeds"
|
||||
data_count 1..30
|
||||
Rails.application.config.to_prepare do
|
||||
begin
|
||||
show_options data
|
||||
show_option_items data_item
|
||||
rescue => e
|
||||
puts ['there_was_no_show_option_method',e]
|
||||
translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
||||
data = {}
|
||||
key1 = {}
|
||||
key2 = {}
|
||||
key3 = {}
|
||||
key4 = {}
|
||||
key1_attr = []
|
||||
key2_attr = []
|
||||
key3_attr = []
|
||||
key4_attr = []
|
||||
data_item = {}
|
||||
key_item1 = {}
|
||||
key_item2 = {}
|
||||
key_item3 = {}
|
||||
value_item1 = {}
|
||||
value_item2 = {}
|
||||
value_item3 = {}
|
||||
value2_item1 = {}
|
||||
value2_item2 = {}
|
||||
key1_options = ['small_size','medium_size','orignal_size']
|
||||
key2_options = ['not_enable_tabs','enable_tabs_with_categories_include_all','enable_tabs_with_categories']
|
||||
key3_options = ['default','upper_left','lower_left','upper_right','lower_right']
|
||||
key4_options = ['the_same_as_data_count','display_all_in_other_tabs']
|
||||
key1_options.each_with_index do |k,i|
|
||||
key1_attr[i] = {}
|
||||
end
|
||||
key2_options.each_with_index do |k,i|
|
||||
key2_attr[i] = {}
|
||||
end
|
||||
key3_options.each_with_index do |k,i|
|
||||
key3_attr[i] = {}
|
||||
end
|
||||
key4_options.each_with_index do |k,i|
|
||||
key4_attr[i] = {}
|
||||
end
|
||||
translate_data.each do |t_data|
|
||||
v = t_data.values
|
||||
k = t_data.keys[0]
|
||||
key1[k] = v[0]['custom_announcement']['picture_showing_size']
|
||||
key2[k] = v[0]['custom_announcement']['tabs_options']
|
||||
key3[k] = v[0]['custom_announcement']['read_more_position_options']
|
||||
key4[k] = v[0]['custom_announcement']['all_tabs_setting']
|
||||
key1_options.each_with_index do |kk,i|
|
||||
key1_attr[i][k] = v[0]['custom_announcement'][kk]
|
||||
end
|
||||
key2_options.each_with_index do |kk,i|
|
||||
key2_attr[i][k] = v[0]['custom_announcement'][kk]
|
||||
end
|
||||
key3_options.each_with_index do |kk,i|
|
||||
key3_attr[i][k] = v[0]['custom_announcement'][kk]
|
||||
end
|
||||
key4_options.each_with_index do |kk,i|
|
||||
key4_attr[i][k] = v[0]['custom_announcement'][kk]
|
||||
end
|
||||
key_item1[k] = v[0]['custom_announcement']['showing_back_and_next']
|
||||
key_item2[k] = v[0]['custom_announcement']['enable_search']
|
||||
value_item1[k] = v[0]['custom_announcement']['not_show']
|
||||
value_item2[k] = v[0]['custom_announcement']['show_bottom']
|
||||
value_item3[k] = v[0]['custom_announcement']['show_top']
|
||||
value2_item1[k] = v[0]['custom_announcement']['no']
|
||||
value2_item2[k] = v[0]['custom_announcement']['yes']
|
||||
end
|
||||
data[key1] = key1_attr
|
||||
data[key2] = key2_attr
|
||||
data[key3] = key3_attr
|
||||
data[key4] = key4_attr
|
||||
data_item[key_item1] = [value_item1,value_item2,value_item3]
|
||||
data_item[key_item2] = [value2_item1,value2_item2]
|
||||
require File.expand_path('../../../app/models/custom_anns_cache', __FILE__)
|
||||
if defined? CustomAnnsCache
|
||||
CustomAnnsCache.destroy_all
|
||||
end
|
||||
rescue => e
|
||||
puts ['error in custom_announcement',e]
|
||||
end
|
||||
side_bar do
|
||||
set_sidebar_order(100) rescue nil
|
||||
head_label_i18n 'custom_announcement.custom_announcement', icon_class: "icon-bullhorn"
|
||||
available_for "users"
|
||||
active_for_controllers (['admin/custom_announcements'])
|
||||
head_link_path "admin_custom_announcements_path"
|
||||
OrbitApp.registration "CustomAnnouncement", :type => "ModuleApp" do
|
||||
module_label "custom_announcement.custom_announcement"
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
widget_methods ["widget","random_custom_announcement_widget", "tag_cloud"]
|
||||
widget_settings [{"data_count"=>30,"enable_custom_widget_data"=>true}]
|
||||
taggable "CustomBulletin"
|
||||
categorizable
|
||||
authorizable
|
||||
frontend_enabled
|
||||
feeds_url "/xhr/custom_announcements/feeds"
|
||||
data_count 1..30
|
||||
begin
|
||||
show_options data
|
||||
show_option_items data_item
|
||||
rescue => e
|
||||
puts ['there_was_no_show_option_method',e]
|
||||
end
|
||||
side_bar do
|
||||
set_sidebar_order(100) rescue nil
|
||||
head_label_i18n 'custom_announcement.custom_announcement', icon_class: "icon-bullhorn"
|
||||
available_for "users"
|
||||
active_for_controllers (['admin/custom_announcements'])
|
||||
head_link_path "admin_custom_announcements_path"
|
||||
|
||||
context_link 'custom_announcement.all_articles',
|
||||
:link_path=>"admin_custom_announcements_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'index'},
|
||||
:available_for => 'users'
|
||||
# context_link 'new_',
|
||||
# :link_path=>"new_admin_custom_announcement_path" ,
|
||||
# :priority=>2,
|
||||
# :active_for_action=>{'admin/custom_announcements'=>'new'},
|
||||
# :available_for => 'sub_managers'
|
||||
context_link 'categories',
|
||||
:link_path=>"admin_module_app_categories_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_announcement').id}",
|
||||
:priority=>3,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'categories'},
|
||||
:active_for_category => 'CustomAnnouncement',
|
||||
:available_for => 'managers'
|
||||
context_link 'tags',
|
||||
:link_path=>"admin_module_app_tags_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_announcement').id}",
|
||||
:priority=>4,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'tags'},
|
||||
:active_for_tag => 'CustomAnnouncement',
|
||||
:available_for => 'managers'
|
||||
context_link 'custom_announcement.feed_list',
|
||||
:link_path=>"admin_custom_announcement_feed_path" ,
|
||||
:priority=>5,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'feed'},
|
||||
:available_for => 'managers'
|
||||
context_link 'custom_announcement.import',
|
||||
:link_path=>"admin_custom_announcement_import_path" ,
|
||||
:priority=>6,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'import'},
|
||||
:available_for => 'managers'
|
||||
context_link 'custom_announcement.settings',
|
||||
:link_path=>"admin_custom_announcement_settings_path" ,
|
||||
:priority=>6,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'settings'},
|
||||
:available_for => 'managers'
|
||||
end
|
||||
|
||||
context_link 'custom_announcement.all_articles',
|
||||
:link_path=>"admin_custom_announcements_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'index'},
|
||||
:available_for => 'users'
|
||||
# context_link 'new_',
|
||||
# :link_path=>"new_admin_custom_announcement_path" ,
|
||||
# :priority=>2,
|
||||
# :active_for_action=>{'admin/custom_announcements'=>'new'},
|
||||
# :available_for => 'sub_managers'
|
||||
context_link 'categories',
|
||||
:link_path=>"admin_module_app_categories_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_announcement').id}",
|
||||
:priority=>3,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'categories'},
|
||||
:active_for_category => 'CustomAnnouncement',
|
||||
:available_for => 'managers'
|
||||
context_link 'tags',
|
||||
:link_path=>"admin_module_app_tags_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_announcement').id}",
|
||||
:priority=>4,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'tags'},
|
||||
:active_for_tag => 'CustomAnnouncement',
|
||||
:available_for => 'managers'
|
||||
context_link 'custom_announcement.feed_list',
|
||||
:link_path=>"admin_custom_announcement_feed_path" ,
|
||||
:priority=>5,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'feed'},
|
||||
:available_for => 'managers'
|
||||
context_link 'custom_announcement.import',
|
||||
:link_path=>"admin_custom_announcement_import_path" ,
|
||||
:priority=>6,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'import'},
|
||||
:available_for => 'managers'
|
||||
context_link 'custom_announcement.settings',
|
||||
:link_path=>"admin_custom_announcement_settings_path" ,
|
||||
:priority=>6,
|
||||
:active_for_action=>{'admin/custom_announcements'=>'settings'},
|
||||
:available_for => 'managers'
|
||||
end
|
||||
|
||||
# temp = YAML.load_file(File.join(Rails.root,"config","mongoid.yml"))
|
||||
# dbsettings = temp["production"]["sessions"]["default"]
|
||||
# s = Moped::Session.new(dbsettings["hosts"])
|
||||
# s.use dbsettings["database"]
|
||||
# s[:custom_bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
|
||||
end
|
||||
# temp = YAML.load_file(File.join(Rails.root,"config","mongoid.yml"))
|
||||
# dbsettings = temp["production"]["sessions"]["default"]
|
||||
# s = Moped::Session.new(dbsettings["hosts"])
|
||||
# s.use dbsettings["database"]
|
||||
# s[:custom_bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
|
||||
end
|
||||
end
|
||||
end
|
|
@ -502,7 +502,7 @@ class Admin::CustomGalleriesController < OrbitAdminController
|
|||
theater_link: admin_image_path(values),
|
||||
description: values.description,
|
||||
title: values.title,
|
||||
file: values.file.as_json[:file],
|
||||
file: values.file.as_json,
|
||||
custom_gallery_custom_album_id: values.custom_album_id,
|
||||
order: values.order,
|
||||
tags: values.tags}
|
||||
|
|
|
@ -242,7 +242,7 @@ class CustomGalleriesController < ApplicationController
|
|||
title: values.title,
|
||||
alt_title: alt_text,
|
||||
url: values.file.url,
|
||||
file: values.file.as_json[:file],
|
||||
file: values.file.as_json,
|
||||
custom_gallery_custom_album_id: values.custom_album_id,
|
||||
tags: values.tags}
|
||||
end
|
||||
|
|
|
@ -1,94 +1,96 @@
|
|||
module CustomGallery
|
||||
class Engine < ::Rails::Engine
|
||||
initializer "custom_gallery" do
|
||||
begin
|
||||
translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
||||
data = {}
|
||||
key1 = {}
|
||||
value1 = {}
|
||||
value2 = {}
|
||||
value3 = {}
|
||||
translate_data.each do |t_data|
|
||||
v = t_data.values
|
||||
k = t_data.keys[0]
|
||||
key1[k] = v[0]['custom_gallery']['inner_page_layout']
|
||||
value1[k] = v[0]['custom_gallery']['grid_style']
|
||||
value2[k] = v[0]['custom_gallery']['card_style']
|
||||
value3[k] = v[0]['custom_gallery']['slideshow_style']
|
||||
Rails.application.config.to_prepare do
|
||||
begin
|
||||
translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
|
||||
data = {}
|
||||
key1 = {}
|
||||
value1 = {}
|
||||
value2 = {}
|
||||
value3 = {}
|
||||
translate_data.each do |t_data|
|
||||
v = t_data.values
|
||||
k = t_data.keys[0]
|
||||
key1[k] = v[0]['custom_gallery']['inner_page_layout']
|
||||
value1[k] = v[0]['custom_gallery']['grid_style']
|
||||
value2[k] = v[0]['custom_gallery']['card_style']
|
||||
value3[k] = v[0]['custom_gallery']['slideshow_style']
|
||||
end
|
||||
data[key1] = [value1,value2,value3]
|
||||
rescue => e
|
||||
puts ['error in custom_gallery',e]
|
||||
end
|
||||
data[key1] = [value1,value2,value3]
|
||||
rescue => e
|
||||
puts ['error in custom_gallery',e]
|
||||
end
|
||||
|
||||
require File.expand_path('../../../app/models/custom_album_setting', __FILE__)
|
||||
if defined?(CustomAlbumSetting)
|
||||
if CustomAlbumSetting.first.nil?
|
||||
CustomAlbumSetting.create()
|
||||
elsif CustomAlbumSetting.count > 1
|
||||
CustomAlbumSetting.all.to_a[1..-1].each do |custom_album_setting|
|
||||
custom_album_setting.destroy
|
||||
require File.join(CustomGallery::Engine.root, 'app/models/custom_album_setting')
|
||||
if defined?(CustomAlbumSetting)
|
||||
if CustomAlbumSetting.first.nil?
|
||||
CustomAlbumSetting.create()
|
||||
elsif CustomAlbumSetting.count > 1
|
||||
CustomAlbumSetting.all.to_a[1..-1].each do |custom_album_setting|
|
||||
custom_album_setting.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
OrbitApp.registration "CustomGallery", :type => "ModuleApp" do
|
||||
module_label "custom_gallery.custom_gallery"
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
widget_methods ["widget","custom_album_widget"]
|
||||
# widget_settings []
|
||||
widget_settings [{"data_count"=>30,"enable_custom_widget_data"=>true}]
|
||||
models_to_cache [:custom_album,:custom_album_image]
|
||||
taggable "CustomAlbum"
|
||||
categorizable
|
||||
authorizable
|
||||
frontend_enabled
|
||||
data_count 1..30
|
||||
begin
|
||||
show_option_items data
|
||||
rescue => e
|
||||
puts ['there_was_no_show_option_method',e]
|
||||
end
|
||||
side_bar do
|
||||
set_sidebar_order(100) rescue nil
|
||||
head_label_i18n 'custom_gallery.custom_gallery', icon_class: "fa fa-file-image-o"
|
||||
available_for "users"
|
||||
active_for_controllers (['admin/custom_galleries','admin/images'])
|
||||
head_link_path "admin_custom_galleries_path"
|
||||
|
||||
OrbitApp.registration "CustomGallery", :type => "ModuleApp" do
|
||||
module_label "custom_gallery.custom_gallery"
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
widget_methods ["widget","custom_album_widget"]
|
||||
# widget_settings []
|
||||
widget_settings [{"data_count"=>30,"enable_custom_widget_data"=>true}]
|
||||
models_to_cache [:custom_album,:custom_album_image]
|
||||
taggable "CustomAlbum"
|
||||
categorizable
|
||||
authorizable
|
||||
frontend_enabled
|
||||
data_count 1..30
|
||||
begin
|
||||
show_option_items data
|
||||
rescue => e
|
||||
puts ['there_was_no_show_option_method',e]
|
||||
end
|
||||
side_bar do
|
||||
set_sidebar_order(100) rescue nil
|
||||
head_label_i18n 'custom_gallery.custom_gallery', icon_class: "fa fa-file-image-o"
|
||||
available_for "users"
|
||||
active_for_controllers (['admin/custom_galleries','admin/images'])
|
||||
head_link_path "admin_custom_galleries_path"
|
||||
|
||||
context_link 'custom_gallery.all',
|
||||
:link_path=>"admin_custom_galleries_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/custom_galleries'=>"index"},
|
||||
:available_for => 'users'
|
||||
context_link 'custom_gallery.all',
|
||||
:link_path=>"admin_custom_galleries_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/custom_galleries'=>"index"},
|
||||
:available_for => 'users'
|
||||
|
||||
# context_link 'custom_gallery.new',
|
||||
# :link_path=>"new_admin_custom_gallery_path" ,
|
||||
# :priority=>2,
|
||||
# :active_for_action=>{'admin/custom_galleries'=>"new"},
|
||||
# :available_for => 'sub_managers'
|
||||
# context_link 'custom_gallery.new',
|
||||
# :link_path=>"new_admin_custom_gallery_path" ,
|
||||
# :priority=>2,
|
||||
# :active_for_action=>{'admin/custom_galleries'=>"new"},
|
||||
# :available_for => 'sub_managers'
|
||||
|
||||
context_link 'categories',
|
||||
:link_path=>"admin_module_app_categories_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_gallery').id}",
|
||||
:priority=>3,
|
||||
:active_for_action=>{'admin/custom_galleries'=>'categories'},
|
||||
:active_for_category => 'CustomGallery',
|
||||
:available_for => 'managers'
|
||||
|
||||
context_link 'tags',
|
||||
:link_path=>"admin_module_app_tags_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_gallery').id}",
|
||||
:priority=>4,
|
||||
:active_for_action=>{'admin/custom_galleries'=>'tags'},
|
||||
:active_for_tag => 'CustomGallery',
|
||||
:available_for => 'managers'
|
||||
context_link 'setting',
|
||||
:link_path=>"admin_custom_galleries_setting_path" ,
|
||||
:priority=>5,
|
||||
:active_for_action=>{'admin/custom_galleries'=>'setting'},
|
||||
:available_for => 'managers'
|
||||
end
|
||||
context_link 'categories',
|
||||
:link_path=>"admin_module_app_categories_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_gallery').id}",
|
||||
:priority=>3,
|
||||
:active_for_action=>{'admin/custom_galleries'=>'categories'},
|
||||
:active_for_category => 'CustomGallery',
|
||||
:available_for => 'managers'
|
||||
|
||||
context_link 'tags',
|
||||
:link_path=>"admin_module_app_tags_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_gallery').id}",
|
||||
:priority=>4,
|
||||
:active_for_action=>{'admin/custom_galleries'=>'tags'},
|
||||
:active_for_tag => 'CustomGallery',
|
||||
:available_for => 'managers'
|
||||
context_link 'setting',
|
||||
:link_path=>"admin_custom_galleries_setting_path" ,
|
||||
:priority=>5,
|
||||
:active_for_action=>{'admin/custom_galleries'=>'setting'},
|
||||
:available_for => 'managers'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,55 +1,56 @@
|
|||
module Seminar
|
||||
class Engine < ::Rails::Engine
|
||||
initializer "seminar" do
|
||||
OrbitApp.registration "Seminar", :type => "ModuleApp" do
|
||||
module_label "seminar.seminar"
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
authorizable
|
||||
categorizable
|
||||
frontend_enabled
|
||||
data_count 1..20
|
||||
widget_methods ["widget"]
|
||||
widget_settings [{"data_count"=>30}]
|
||||
side_bar do
|
||||
head_label_i18n 'seminar.seminar', icon_class: "icon-globe"
|
||||
available_for "users"
|
||||
active_for_controllers (['admin/seminars'])
|
||||
head_link_path "admin_seminars_path"
|
||||
initializer "seminar" do
|
||||
Rails.application.config.to_prepare do
|
||||
OrbitApp.registration "Seminar", :type => "ModuleApp" do
|
||||
module_label "seminar.seminar"
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
authorizable
|
||||
categorizable
|
||||
frontend_enabled
|
||||
data_count 1..20
|
||||
widget_methods ["widget"]
|
||||
widget_settings [{"data_count"=>30}]
|
||||
side_bar do
|
||||
head_label_i18n 'seminar.seminar', icon_class: "icon-globe"
|
||||
available_for "users"
|
||||
active_for_controllers (['admin/seminars'])
|
||||
head_link_path "admin_seminars_path"
|
||||
|
||||
context_link 'list_',
|
||||
:link_path=>"admin_seminars_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/seminars'=>'index'},
|
||||
:available_for => 'users'
|
||||
context_link 'new_',
|
||||
:link_path=>"new_admin_seminar_path" ,
|
||||
:priority=>2,
|
||||
:active_for_action=>{'admin/seminars'=>'new'},
|
||||
:available_for => 'sub_managers'
|
||||
context_link 'categories',
|
||||
:link_path=>"admin_module_app_categories_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'seminar').id}",
|
||||
:priority=>3,
|
||||
:active_for_action=>{'admin/seminars'=>'categories'},
|
||||
:active_for_category => 'Seminar',
|
||||
:available_for => 'managers'
|
||||
context_link 'seminar.set_seminar_items',
|
||||
:link_path=>"admin_seminar_items_path" ,
|
||||
:priority=>4,
|
||||
:active_for_action=>{'admin/seminars'=>'seminar_items'},
|
||||
:available_for => 'managers'
|
||||
context_link 'seminar.set_seminar_agreements',
|
||||
:link_path=>"admin_seminar_agreements_path" ,
|
||||
:priority=>5,
|
||||
:active_for_action=>{'admin/seminars'=>'seminar_agreements'},
|
||||
:available_for => 'managers'
|
||||
context_link 'seminar.enquiry_for_applicants',
|
||||
:link_path=>"admin_seminar_enquiry_for_applicants_path" ,
|
||||
:priority=>6,
|
||||
:active_for_action=>{'admin/seminars'=>'enquiry_for_applicants'},
|
||||
:available_for => 'users'
|
||||
context_link 'list_',
|
||||
:link_path=>"admin_seminars_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/seminars'=>'index'},
|
||||
:available_for => 'users'
|
||||
context_link 'new_',
|
||||
:link_path=>"new_admin_seminar_path" ,
|
||||
:priority=>2,
|
||||
:active_for_action=>{'admin/seminars'=>'new'},
|
||||
:available_for => 'sub_managers'
|
||||
context_link 'categories',
|
||||
:link_path=>"admin_module_app_categories_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'seminar').id}",
|
||||
:priority=>3,
|
||||
:active_for_action=>{'admin/seminars'=>'categories'},
|
||||
:active_for_category => 'Seminar',
|
||||
:available_for => 'managers'
|
||||
context_link 'seminar.set_seminar_items',
|
||||
:link_path=>"admin_seminar_items_path" ,
|
||||
:priority=>4,
|
||||
:active_for_action=>{'admin/seminars'=>'seminar_items'},
|
||||
:available_for => 'managers'
|
||||
context_link 'seminar.set_seminar_agreements',
|
||||
:link_path=>"admin_seminar_agreements_path" ,
|
||||
:priority=>5,
|
||||
:active_for_action=>{'admin/seminars'=>'seminar_agreements'},
|
||||
:available_for => 'managers'
|
||||
context_link 'seminar.enquiry_for_applicants',
|
||||
:link_path=>"admin_seminar_enquiry_for_applicants_path" ,
|
||||
:priority=>6,
|
||||
:active_for_action=>{'admin/seminars'=>'enquiry_for_applicants'},
|
||||
:available_for => 'users'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue