Merge branch 'master' into 'master'

Fix bug.



See merge request !20
This commit is contained in:
chiu 2021-08-22 16:49:16 +08:00
commit 55f645a868
6 changed files with 86 additions and 77 deletions

View File

@ -286,6 +286,9 @@ $(function() {
};
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length;
if(templateType == null){
templateType = "typeA";
}
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox();
});
@ -434,7 +437,6 @@ $(function() {
// appendIndex = appendIndex.split("][");
// appendIndex = parseInt(appendIndex[appendIndex.length-2])+1;
appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1;
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'));

View File

@ -531,15 +531,17 @@ class Admin::SeminarsController < OrbitAdminController
end
def update
params[:seminar_main][:registration_status] = (params[:seminar_main][:registration_status] ? params[:seminar_main][:registration_status] : [])
@seminar_params = seminar_params rescue {}
if @seminar_params.count != 0
@seminar_params[:registration_status] = (@seminar_params[:registration_status] ? @seminar_params[:registration_status] : [])
uid = params[:id].split('-').last
@seminar = SeminarMain.find_by(:uid=>uid)
seminar_params["reviewer_ids"] = [] if seminar_params["reviewer_ids"].nil?
seminar_params["organizer_id"] = nil if seminar_params["organizer_id"].nil?
if params[:seminar_main][:seminar_signup_fields]
seminar_params[:seminar_signup_fields].each do |a|
if @seminar_params.has_key?("title_translations")
@seminar_params["reviewer_ids"] = [] if @seminar_params["reviewer_ids"].nil?
@seminar_params["organizer_id"] = nil if @seminar_params["organizer_id"].nil?
end
if @seminar_params[:seminar_signup_fields]
@seminar_params[:seminar_signup_fields].each do |a|
@field_name = 'seminar_main'
field_status = a.last[:id].present?
@attribute_field = SeminarSignupField.add_seminar_signup_field(@seminar, a.last, a.last[:id], field_status)
@ -548,8 +550,8 @@ class Admin::SeminarsController < OrbitAdminController
flash.now[:notice] = "Updated Fields"
@seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to admin_seminars_path
elsif params[:seminar_main][:seminar_submission_fields]
redirect_to admin_seminars_path and return
elsif @seminar_params[:seminar_submission_fields]
params[:seminar_main][:seminar_submission_fields].each do |a|
@field_name = 'seminar_main'
field_status = a.last[:id].present?
@ -588,7 +590,7 @@ class Admin::SeminarsController < OrbitAdminController
@seminar.update(:assign_mode => 1)
end
end
redirect_to admin_seminars_path
redirect_to admin_seminars_path and return
else
if !seminar_params['seminar_links_attributes'].nil?
@ -600,13 +602,14 @@ class Admin::SeminarsController < OrbitAdminController
@seminar.update_user_id = current_user.id
if @seminar.update_attributes(seminar_params)
@seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to params['referer_url']
redirect_to params['referer_url'] and return
else
flash.now[:error] = t('update.error.category')
render action: :edit
render action: :edit and return
end
end
end
redirect_to admin_seminars_path
end
def set_write_off

View File

@ -7,7 +7,7 @@
<% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "field-forms.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| %>

View File

@ -7,7 +7,7 @@
<% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "field-forms-submission.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| %>
<% if flash.now[:notice].present? %>

View File

@ -1,9 +1,13 @@
# -*- encoding: utf-8 -*-
# stub: seminar 0.0.1 ruby lib
require "yaml"
require "erb"
data = File.open(File.join(File.dirname(__FILE__), 'config', 'list.yml')).read
$seminar_list = YAML.safe_load(ERB.new(data).result(binding))
begin
require "yaml"
require "erb"
data = File.open(File.join(File.dirname(__FILE__), 'config', 'list.yml')).read
$seminar_list = YAML.safe_load(ERB.new(data).result(binding)).map{|k,v| [k.to_sym,v]}.to_h
rescue => e
puts [e.to_s,e.backtrace]
end
Gem::Specification.new do |s|
s.name = "seminar"
s.version = "0.0.1"