diff --git a/app/assets/javascripts/seminar-field-forms-submission.js b/app/assets/javascripts/seminar-field-forms-submission.js index 15ff538..0b8829c 100644 --- a/app/assets/javascripts/seminar-field-forms-submission.js +++ b/app/assets/javascripts/seminar-field-forms-submission.js @@ -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(); } diff --git a/app/assets/javascripts/seminar-field-forms.js b/app/assets/javascripts/seminar-field-forms.js index 3f4b401..20c094f 100644 --- a/app/assets/javascripts/seminar-field-forms.js +++ b/app/assets/javascripts/seminar-field-forms.js @@ -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')) { @@ -452,6 +481,7 @@ $(function() { }); $('#attributes-area').delegate('.dataType', 'change', function() { $(this).children("option:selected").each(function () { + deinit_template_html(target); var target = $(this).closest('.attributes').find('.field-type').not('.default'); attributeIndex = $(this).closest('.attributes').index(); appendIndex = 0 @@ -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(); } diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index 50bae30..6db4690 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -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) 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) @@ -522,20 +522,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 +578,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 diff --git a/app/helpers/admin/seminars_field_helper.rb b/app/helpers/admin/seminars_field_helper.rb index 21ffe5c..09718df 100644 --- a/app/helpers/admin/seminars_field_helper.rb +++ b/app/helpers/admin/seminars_field_helper.rb @@ -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 diff --git a/app/models/seminar_signup_field.rb b/app/models/seminar_signup_field.rb index 2025454..b9c0e4d 100644 --- a/app/models/seminar_signup_field.rb +++ b/app/models/seminar_signup_field.rb @@ -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 diff --git a/app/models/seminar_submission_field.rb b/app/models/seminar_submission_field.rb index ea48ff1..f3fdf67 100644 --- a/app/models/seminar_submission_field.rb +++ b/app/models/seminar_submission_field.rb @@ -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 diff --git a/app/views/admin/seminars/_attribute_field.html.erb b/app/views/admin/seminars/_attribute_field.html.erb index e4d0525..0dba59a 100644 --- a/app/views/admin/seminars/_attribute_field.html.erb +++ b/app/views/admin/seminars/_attribute_field.html.erb @@ -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 %> + +
+
+
+
+ <% @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 %> +
+
+
+ <% @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 %> +
+
+
+ <% 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%> \ No newline at end of file diff --git a/app/views/admin/seminars/_attribute_submission_field.html.erb b/app/views/admin/seminars/_attribute_submission_field.html.erb index 12eadb1..d819c14 100644 --- a/app/views/admin/seminars/_attribute_submission_field.html.erb +++ b/app/views/admin/seminars/_attribute_submission_field.html.erb @@ -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%>
@@ -140,6 +141,35 @@
<% 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 %> + +
+
+
+
+ <% @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 %> +
+
+
+ <% @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 %> +
+
+
+ <% 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%> \ No newline at end of file diff --git a/app/views/admin/seminars/_support_member_form_js.erb b/app/views/admin/seminars/_support_member_form_js.erb index 25aa036..24b80cf 100644 --- a/app/views/admin/seminars/_support_member_form_js.erb +++ b/app/views/admin/seminars/_support_member_form_js.erb @@ -112,7 +112,7 @@ diff --git a/app/views/admin/seminars/seminar_signup_field.html.erb b/app/views/admin/seminars/seminar_signup_field.html.erb index a4c2359..0048bd9 100644 --- a/app/views/admin/seminars/seminar_signup_field.html.erb +++ b/app/views/admin/seminars/seminar_signup_field.html.erb @@ -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 @@
- <%= 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)%>
diff --git a/app/views/admin/seminars/seminar_submission_field.html.erb b/app/views/admin/seminars/seminar_submission_field.html.erb index 9e7a942..1143236 100644 --- a/app/views/admin/seminars/seminar_submission_field.html.erb +++ b/app/views/admin/seminars/seminar_submission_field.html.erb @@ -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 %> diff --git a/app/views/seminars/con_login.html.erb b/app/views/seminars/con_login.html.erb index 7125135..f179018 100644 --- a/app/views/seminars/con_login.html.erb +++ b/app/views/seminars/con_login.html.erb @@ -9,7 +9,7 @@ color: red; } -<% 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 ) %>