forked from spen/seminar
parent
aafaedf32d
commit
8f293afd87
|
@ -59,6 +59,11 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
@fields_values << f.option_list
|
||||
end
|
||||
end
|
||||
if @seminar.enable_summary_choice
|
||||
@fields << "seminar_signup_contributes.description"
|
||||
@fields_translations << I18n.t("seminar_signup.description")
|
||||
@fields_values << @seminar.summary_chioices.map.with_index{|v,i| [i.to_s,{I18n.locale=>v}]}.to_h
|
||||
end
|
||||
@fields_values = @fields_values.collect.with_index{|fields_values,i| [i, fields_values.values.map{|v| v[I18n.locale]} ] }.to_h
|
||||
end
|
||||
def update_reviewer_setting
|
||||
|
|
|
@ -150,6 +150,15 @@ class SeminarsController < ApplicationController
|
|||
end
|
||||
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
|
||||
seminar_reviews.each{|sr| sr.save}
|
||||
@seminar = @seminar_signup.seminar_main
|
||||
unassigned_seminar_signup_ids = @seminar.seminar_signup_ids.map{|s| s.to_s}
|
||||
unassigned_seminar_signup_ids.push(@seminar_signup.id.to_s)
|
||||
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
|
||||
seminar_reviews.each do |sr|
|
||||
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
|
||||
end
|
||||
@seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
|
||||
@seminar.save
|
||||
else
|
||||
@seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
|
||||
@seminar.save
|
||||
|
|
|
@ -52,7 +52,7 @@ module Admin::SeminarsFieldHelper
|
|||
@prefiled_value ||=[]
|
||||
control_group_wrapper do
|
||||
a = self.typeE[:option_list].collect do |key,value|
|
||||
label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), { :id=>"#{get_basic_field_name_org}_#{self.id}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline"))
|
||||
label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), { :id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline"))
|
||||
end.join.html_safe rescue ""
|
||||
end
|
||||
end
|
||||
|
@ -138,7 +138,7 @@ module Admin::SeminarsFieldHelper
|
|||
@prefiled_value ||=[]
|
||||
control_group_wrapper do
|
||||
self.typeE[:option_list].collect do |key,value|
|
||||
label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {:required=>@require})+value[I18n.locale.to_s],@markup_options.merge(:class=>"radio inline"))
|
||||
label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {:required=>@require,:id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"radio inline"))
|
||||
end.join.html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,13 +6,19 @@ class SeminarMain
|
|||
# encoding: utf-8
|
||||
include OrbitCategory::Categorizable
|
||||
include Slug
|
||||
|
||||
ChoiceTypes = ["checkbox","radio","select"]
|
||||
field :signup_note, localize: true
|
||||
field :title, as: :slug_title, type: String, localize: true
|
||||
field :speaker, localize: true
|
||||
field :content, localize: true
|
||||
field :act_place, localize: true
|
||||
|
||||
field :enable_summary_choice, :type => Boolean, :default => false
|
||||
field :summary_chioice_type, :type => String, :default => "checkbox"
|
||||
field :summary_chioices, :type => Array, :default => ["A. Energy Conversion","B. Biocatalysis","C. Electrocatalysis",
|
||||
" D. Photocatalysis","E. Catalytic and Porous Materials",
|
||||
"F. Environmental and Reaction Engineering","G. Industrial Applications",
|
||||
"H. Student Oral Presentation Contest (in English)","I. Student Poster Competition"
|
||||
]
|
||||
field :seminar_start_date, :type => Date, :default => Time.now
|
||||
field :seminar_end_date, :type => Date, :default => Time.now
|
||||
|
||||
|
|
|
@ -33,9 +33,11 @@ class SeminarReview
|
|||
next if fn.nil?
|
||||
if fn == "seminar_signup_fields"
|
||||
default_seminar_signup_ids += SeminarSignupValue.where(:seminar_signup_field_id=>id,:val.in=>self.default_topics_values[i].to_a).pluck(:seminar_signup_id)
|
||||
elsif "seminar_submission_fields"
|
||||
elsif fn == "seminar_submission_fields"
|
||||
seminar_signup_contribute_ids = SeminarSubmissionValue.where(:seminar_submission_field_id=>id,:val.in=>self.default_topics_values[i].to_a).pluck(:seminar_signup_contribute)
|
||||
default_seminar_signup_ids += SeminarSignupContribute.where(:id.in=>seminar_signup_contribute_ids).pluck(:seminar_signup_id)
|
||||
elsif fn == "seminar_signup_contributes"
|
||||
default_seminar_signup_ids += SeminarSignupContribute.where(:description.in=>self.default_topics_values[i].to_a).pluck(:seminar_signup_id)
|
||||
end
|
||||
end
|
||||
default_seminar_signup_ids.uniq!
|
||||
|
|
|
@ -22,6 +22,10 @@ class SeminarSignup
|
|||
|
||||
accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true
|
||||
accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true
|
||||
before_create do
|
||||
unit = self.unit_translations.values.select{|v| v.present?}.first
|
||||
self.unit_translations = I18n.available_locales.map{|l| [l.to_s,unit]}.to_h
|
||||
end
|
||||
after_destroy do
|
||||
seminar_main = self.seminar_main
|
||||
seminar_reviews = seminar_main.seminar_reviews
|
||||
|
|
|
@ -233,6 +233,27 @@
|
|||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><%=t('seminar_signup.enable_summary_choice')%></div>
|
||||
<div class="controls"><%= f.check_box :enable_summary_choice %></div>
|
||||
</div>
|
||||
<% hidden_style = (f.object.enable_summary_choice) ? "" : "style=display:none" %>
|
||||
<div class="control-group summary_choice_block" <%=hidden_style%>>
|
||||
<div class="control-label"><%=t('seminar_signup.summary_choice_type')%></div>
|
||||
<div class="controls"><%= f.select :summary_chioice_type,f.object.class::ChoiceTypes.map{|c| [t("seminar_signup.#{c}"),c]} %></div>
|
||||
</div>
|
||||
<div class="control-group summary_choice_block" <%=hidden_style%>>
|
||||
<div class="control-label"><%=t('seminar_signup.choices')%></div>
|
||||
<div class="controls">
|
||||
<% f.object.summary_chioices.each do |choice| %>
|
||||
<div>
|
||||
<span class="remove_btn">X</span>
|
||||
<%= text_field_tag "seminar_main[summary_chioices][]",choice, {:id=>nil} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<button type="button" class="btn btn-primary btn-small" id="add_summary_choice"><%=t(:new_)%></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Custom Set Module -->
|
||||
<div class="tab-pane fade in " id="custom_set" style="padding: 1.2em;">
|
||||
|
@ -494,7 +515,26 @@
|
|||
$(this).parents('.start-line').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click','#add_summary_choice',function(){
|
||||
$(this).before("<div><span class=\"remove_btn\">X</span><input name=\"seminar_main[summary_chioices][]\" type=\"text\"></div>")
|
||||
})
|
||||
$(document).on('click','.remove_btn',function(){
|
||||
$(this).parent().remove();
|
||||
})
|
||||
$("input[name=\"seminar_main[enable_summary_choice]\"]").change(function(){
|
||||
if($(this).prop("checked")){
|
||||
$(".summary_choice_block").css("display","");
|
||||
}else{
|
||||
$(".summary_choice_block").css("display","none");
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<style type="text/css">
|
||||
.remove_btn{
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
|
@ -15,7 +15,9 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody class="sort-holder" <%=@reviewer_id.nil? ? "" : "data-id=#{@reviewer_id}" %>>
|
||||
<% display_title = @seminar.nil? %>
|
||||
<% @seminar_signups.each do |seminar_signup| %>
|
||||
<% @seminar = seminar_signup.seminar_main if display_title %>
|
||||
<% len = seminar_signup.seminar_signup_contributes.count %>
|
||||
<% rowspan = "rowspan=#{len==0? 1 : len}" %>
|
||||
<% vals = [] %>
|
||||
|
@ -23,7 +25,7 @@
|
|||
<% if @drag%>
|
||||
<td <%=rowspan%>><span class="brand"><i class="icons-list-2"></i></span></td>
|
||||
<% end %>
|
||||
<% vals << seminar_signup.seminar_main.title if @seminar.nil? %>
|
||||
<% vals << seminar_signup.seminar_main.title if display_title %>
|
||||
<% @display_field.each_with_index do |fn,i|%>
|
||||
<% names = fn.split(".") %>
|
||||
<% val = "" %>
|
||||
|
@ -67,7 +69,21 @@
|
|||
<% if names[1] == "file" %>
|
||||
<% val = seminar_signup.seminar_signup_contributes.to_a %>
|
||||
<% else %>
|
||||
<% val = seminar_signup.seminar_signup_contributes.collect{|s| s.send(names[1])} %>
|
||||
<% if names[1] == "description" %>
|
||||
<% descriptions = seminar_signup.seminar_signup_contributes.collect{|s| s.send(names[1])} %>
|
||||
<% if @seminar.enable_summary_choice
|
||||
descriptions = descriptions.map do |description|
|
||||
if (description.to_s.to_i.to_s == description)
|
||||
description = @seminar.summary_chioices[description.to_i] rescue description
|
||||
else
|
||||
description = description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue description
|
||||
end
|
||||
end
|
||||
end %>
|
||||
<% val = descriptions %>
|
||||
<% else %>
|
||||
<% val = seminar_signup.seminar_signup_contributes.collect{|s| s.send(names[1]).to_s} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif names[0] == "seminar_submission_fields" %>
|
||||
<% val = seminar_signup.seminar_signup_contributes.collect{|s| (s.seminar_submission_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "")} %>
|
||||
|
@ -83,7 +99,15 @@
|
|||
<td>
|
||||
<% if val[0].class == SeminarSignupContribute #File %>
|
||||
<% seminar_signup_contribute = val[0] %>
|
||||
<%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(seminar_signup_contribute.description).text} if seminar_signup_contribute.file.file %>
|
||||
<% description = seminar_signup_contribute.description.to_s %>
|
||||
<% if @seminar.enable_summary_choice
|
||||
if (seminar_signup_contribute.description.to_s.to_i.to_s == seminar_signup_contribute.description)
|
||||
description = @seminar.summary_chioices[seminar_signup_contribute.description.to_i] rescue seminar_signup_contribute.description
|
||||
else
|
||||
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
||||
end
|
||||
end %>
|
||||
<%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %>
|
||||
<% else %>
|
||||
<%= val[0].html_safe.to_s rescue "" %>
|
||||
<% end %>
|
||||
|
@ -98,7 +122,15 @@
|
|||
<td>
|
||||
<% if vals[index][i].class == SeminarSignupContribute #File %>
|
||||
<% seminar_signup_contribute = vals[index][i] %>
|
||||
<%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(seminar_signup_contribute.description).text} if seminar_signup_contribute.file.file %>
|
||||
<% description = seminar_signup_contribute.description.to_s %>
|
||||
<% if @seminar.enable_summary_choice
|
||||
if (seminar_signup_contribute.description.to_s.to_i.to_s == seminar_signup_contribute.description)
|
||||
description = @seminar.summary_chioices[seminar_signup_contribute.description.to_i] rescue seminar_signup_contribute.description
|
||||
else
|
||||
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
||||
end
|
||||
end %>
|
||||
<%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %>
|
||||
<% else %>
|
||||
<%= vals[index][i].html_safe.to_s rescue "" %>
|
||||
<% end %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<% member_id = member.id.to_s %>
|
||||
<% member_pic_url = ((member.avatar.file.present? rescue false) ? member.avatar.url : "/assets/member-pic.png") %>
|
||||
<li class="filter-item selected_item selected_member check-item" data-id="<%=member_id%>" style="margin: 0 10px 10px 0;">
|
||||
<label style="height: 100%;padding: 0;">
|
||||
<label style="height: 100%;padding: 0;max-width: 20%;">
|
||||
<img style="max-height: 100%;" alt="Member pic" class="member-pic" src="<%=member_pic_url%>">
|
||||
<span class="user-name" style="float: right;width: 95px;padding-top: 8px;font-size: 1em;position: absolute;padding-left: 0.5em;"><%=member_name%></span>
|
||||
</label>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
$(".select_field_types").off("change").on("change",function(){
|
||||
var selectedIndex = $(this).prop("selectedIndex");
|
||||
var index = $(this).data("index");
|
||||
var length = $(this).parent().parent().find(".border-block").length;
|
||||
var length = $(this).parent().parent().find(".border-block").length - 1;
|
||||
$(this).siblings(".fields_value_block").html(fields_values[selectedIndex].replaceAll("new_index",index).replaceAll("new_value_index",length))
|
||||
})
|
||||
$(".remove_btn").off("click").on("click",function(){
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
<fieldset>
|
||||
<% unless f.object.new_record? %>
|
||||
<%= f.hidden_field :id %>
|
||||
<% end %>
|
||||
<% if @seminar.seminar_submission_field_sets.count != 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]
|
||||
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
|
||||
show1 = !(data1.disabled)
|
||||
show2 = !(data2.disabled)
|
||||
show3 = !(data3.disabled)
|
||||
name1 = data1['name'][I18n.locale]
|
||||
name2 = data2['name'][I18n.locale]
|
||||
name3 = data3['name'][I18n.locale]
|
||||
plc1 = data1['placeholder'][I18n.locale]
|
||||
plc2 = data2['placeholder'][I18n.locale]==t('seminar_signup.description') ? '' : data2['placeholder'][I18n.locale]
|
||||
plc3 = data3['placeholder'][I18n.locale]==t('seminar_signup.file') ? '' : data3['placeholder'][I18n.locale]
|
||||
else
|
||||
show1 = true
|
||||
show2 = true
|
||||
show3 = true
|
||||
name1 = t('seminar_signup.title')
|
||||
name2 = t('seminar_signup.description')
|
||||
name3 = t('seminar_signup.file')
|
||||
plc1 = t('seminar_signup.title')
|
||||
plc2 = ''
|
||||
plc3 = ''
|
||||
end
|
||||
%>
|
||||
<% if show1 %>
|
||||
<div class="form-group">
|
||||
<label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
|
||||
<div class="col-sm-10">
|
||||
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show2 %>
|
||||
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
|
||||
<span style="margin-right: 0.5em;">
|
||||
<% required = @seminar.enable_summary_choice %>
|
||||
<label for="description" class="col-sm-2 control-label" style="display: contents;">
|
||||
<%=required ? '*' : '' %><%= name2 %>
|
||||
</label>
|
||||
<br>
|
||||
<%= "(#{plc2})" if !(plc2.to_s.blank?) %>
|
||||
</span>
|
||||
<div class="col-sm-10" id="description" required="required">
|
||||
<% if @seminar.enable_summary_choice %>
|
||||
<% check_choices = Array(f.object.description) %>
|
||||
<% if @seminar.summary_chioice_type == "select" %>
|
||||
<%= f.select :description,options_for_select(@seminar.summary_chioices.map.with_index{|v,i| [v,i]},check_choices),{},{:style=>"float: left;",:required=>"required"} %>
|
||||
<% else %>
|
||||
<% multiple = @seminar.summary_chioice_type == "checkbox" %>
|
||||
<% @seminar.summary_chioices.each_with_index do |c,i| %>
|
||||
<label class="inline-label">
|
||||
<input type="<%=@seminar.summary_chioice_type%>" name="<%=f.object_name%>[description]<%= (multiple ? '[]' : '')%>" value="<%=i%>" <%= "checked=checked" if check_choices.include?(i.to_s)%>>
|
||||
<%=c%>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show3 %>
|
||||
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
|
||||
<span style="margin-right: 0.5em;">
|
||||
<label for="note" class="col-sm-2 control-label" style="display: contents;">
|
||||
*<%= name3 %>
|
||||
</label>
|
||||
<br>
|
||||
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
|
||||
</span>
|
||||
<div class="col-sm-10">
|
||||
<label style="float: left;border-color: #666666" class="btn">
|
||||
<%= f.file_field :file, :required => f.object.new_record?, :style=>"position: absolute;width: 0.00000001em;" %>
|
||||
<%= t('seminar_signup.load_file') %>
|
||||
</label>
|
||||
<div class="filename" style="float: left;margin-left: 0.3em; "><%= f.object["file"] if f.object.file.present? %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @seminar.seminar_submission_fields.asc(:_id).each do |rf| %>
|
||||
<div class="form-group" style="<%= rf.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
|
||||
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup_contribute",@con, rf.to_require,rf) %>
|
||||
</div>
|
||||
<% @form_index = @form_index +1 %>
|
||||
<% end %>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
||||
<input type="hidden" name="seminar_signup_contribute[seminar_signup_id]" value="<%= session[:seminar_signup_id] %>">
|
||||
<%= f.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %>
|
||||
<%= f.button "Delete", type: 'reset', class: 'btn' %>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<script type="text/javascript">
|
||||
$("input[type=\"file\"]").change(function(){
|
||||
var file_name = "";
|
||||
if($(this).prop("files").length != 0){
|
||||
file_name = $(this).prop("files")[0].name;
|
||||
}
|
||||
$(this).parent().next(".filename").text(file_name)
|
||||
})
|
||||
$("form.form-horizontal").submit(function(){
|
||||
var flag = true;
|
||||
$("div[required=\"required\"]").each(function(i,v){
|
||||
if($(v).find("input:checked").length == 0){
|
||||
$(v).find("input").attr("required","required");
|
||||
flag = false;
|
||||
}else{
|
||||
$(v).find("input").removeAttr("required");
|
||||
}
|
||||
})
|
||||
return flag;
|
||||
})
|
||||
$("form.form-horizontal [type=\"submit\"]").click(function(){
|
||||
var flag = true;
|
||||
$("div[required=\"required\"]").each(function(i,v){
|
||||
if($(v).find("input:checked").length == 0){
|
||||
$(v).find("input").attr("required","required");
|
||||
flag = false;
|
||||
}else{
|
||||
$(v).find("input").removeAttr("required")
|
||||
}
|
||||
})
|
||||
return flag;
|
||||
})
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.inline-label{
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
|
@ -16,83 +16,11 @@
|
|||
<% if ( @seminar.contribute_file_count.blank? or @seminar_signup.seminar_signup_contributes.count < @seminar.contribute_file_count.to_i ) %>
|
||||
|
||||
<%= form_for @con, url: add_file_proc_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup-contribute"} do |f| %>
|
||||
<fieldset>
|
||||
<% if @seminar.seminar_submission_field_sets.count != 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]
|
||||
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
|
||||
show1 = !(data1.disabled)
|
||||
show2 = !(data2.disabled)
|
||||
show3 = !(data3.disabled)
|
||||
name1 = data1['name'][I18n.locale]
|
||||
name2 = data2['name'][I18n.locale]
|
||||
name3 = data3['name'][I18n.locale]
|
||||
plc1 = data1['placeholder'][I18n.locale]
|
||||
plc2 = data2['placeholder'][I18n.locale]==t('seminar_signup.description') ? '' : data2['placeholder'][I18n.locale]
|
||||
plc3 = data3['placeholder'][I18n.locale]==t('seminar_signup.file') ? '' : data3['placeholder'][I18n.locale]
|
||||
else
|
||||
show1 = true
|
||||
show2 = true
|
||||
show3 = true
|
||||
name1 = t('seminar_signup.title')
|
||||
name2 = t('seminar_signup.description')
|
||||
name3 = t('seminar_signup.file')
|
||||
plc1 = t('seminar_signup.title')
|
||||
plc2 = ''
|
||||
plc3 = ''
|
||||
end
|
||||
%>
|
||||
<% if show1 %>
|
||||
<div class="form-group">
|
||||
<label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
|
||||
<div class="col-sm-10">
|
||||
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
|
||||
</div>
|
||||
</div>
|
||||
<% begin %>
|
||||
<%= render :partial => 'seminars/contribute_form',:locals=>{:f=>f} %>
|
||||
<%rescue => e%>
|
||||
<%= e %>
|
||||
<% end %>
|
||||
<% if show2 %>
|
||||
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
|
||||
<span style="margin-right: 0.5em;">
|
||||
<label for="note" class="col-sm-2 control-label" style="display: contents;">
|
||||
<%= name2 %>
|
||||
</label>
|
||||
<br>
|
||||
<%= "(#{plc2})" if !(plc2.to_s.blank?) %>
|
||||
</span>
|
||||
<div class="col-sm-10">
|
||||
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show3 %>
|
||||
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
|
||||
<span style="margin-right: 0.5em;">
|
||||
<label for="note" class="col-sm-2 control-label" style="display: contents;">
|
||||
*<%= name3 %>
|
||||
</label>
|
||||
<br>
|
||||
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
|
||||
</span>
|
||||
<div class="col-sm-10">
|
||||
<%= f.file_field :file, :required => true %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @seminar.seminar_submission_fields.asc(:_id).each do |rf| %>
|
||||
<div class="form-group" style="<%= rf.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
|
||||
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup_contribute",@con, rf.to_require,rf) %>
|
||||
</div>
|
||||
<% @form_index = @form_index +1 %>
|
||||
<% end %>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
||||
<input type="hidden" name="seminar_signup_contribute[seminar_signup_id]" value="<%= session[:seminar_signup_id] %>">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
|
||||
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
|
|
|
@ -24,20 +24,20 @@
|
|||
<%= form_tag con_login_proc_seminars_path, :class => 'content' do %>
|
||||
<div class="control-group clear">
|
||||
<label for="user_email">
|
||||
<i class="icon-user"></i>
|
||||
<i class="icon-user"></i><%=t('seminar_signup.email_address')%>
|
||||
</label>
|
||||
<%= text_field_tag :user_name, params[:user_name], :placeholder => t("users.user_id"), :id=>"user_email" %>
|
||||
<%= text_field_tag :user_name, params[:user_name], :placeholder => t('seminar_signup.email_address'), :id=>"user_email" %>
|
||||
</div>
|
||||
<div class="control-group clear">
|
||||
<label for="user_password">
|
||||
<i class="icon-lock"></i>
|
||||
<i class="icon-lock"></i><%=t("seminar_signup._password")%>
|
||||
</label>
|
||||
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %>
|
||||
</div>
|
||||
<br/>
|
||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
||||
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
|
||||
<button class="btn btn-primary" name="button" type="submit"><%= t(:login) %></button>
|
||||
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.login') %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -51,3 +51,9 @@
|
|||
已截止
|
||||
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var max_width = Math.max.apply(null, $(".form .control-group label").map(function(i,el){return $(el).width()}));
|
||||
$(".form .control-group label").width(max_width);
|
||||
})
|
||||
</script>
|
|
@ -8,7 +8,7 @@
|
|||
@time_now = data["time_now"]
|
||||
%>
|
||||
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
|
||||
|
||||
<% begin %>
|
||||
<% if !session[:seminar_signup_id].blank? %>
|
||||
|
||||
<a href="<%= OrbitHelper.url_to_show(@seminar.to_param) %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary'><%= t('seminar_signup.logout') %></a>
|
||||
|
@ -31,8 +31,16 @@
|
|||
%>
|
||||
<tr>
|
||||
<td><%= seminar_signup_contribute.title %></td>
|
||||
<td><%= seminar_signup_contribute.description.to_s.html_safe %></td>
|
||||
<td><%= link_to File.basename(seminar_signup_contribute.file.path), seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(seminar_signup_contribute.description).text} if seminar_signup_contribute.file.file %></td>
|
||||
<% description = seminar_signup_contribute.description.to_s %>
|
||||
<% if @seminar.enable_summary_choice
|
||||
if (seminar_signup_contribute.description.to_s.to_i.to_s == seminar_signup_contribute.description)
|
||||
description = @seminar.summary_chioices[seminar_signup_contribute.description.to_i] rescue seminar_signup_contribute.description
|
||||
else
|
||||
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
||||
end
|
||||
end %>
|
||||
<td><%= description.html_safe %></td>
|
||||
<td><%= link_to File.basename(seminar_signup_contribute.file.path), seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %></td>
|
||||
<td>
|
||||
<%= link_to t(:edit), OrbitHelper.url_to_show(@seminar.to_param) + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %>
|
||||
<form method="post" action="<%= del_file_seminars_path %>">
|
||||
|
@ -49,7 +57,7 @@
|
|||
|
||||
<% if ( @seminar.contribute_file_count.blank? or @seminar_signup.seminar_signup_contributes.count < @seminar.contribute_file_count.to_i ) %>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'), OrbitHelper.url_to_show(@seminar.to_param) + '?method=add_file', :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), OrbitHelper.url_to_show(@seminar.to_param) + '?method=add_file', :class => 'btn btn-primary' %>
|
||||
|
||||
<% end %>
|
||||
<br />
|
||||
|
@ -63,7 +71,10 @@
|
|||
<a href="<%= page_for_seminar_url %>">回列表頁</a>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%
|
||||
rescue => e
|
||||
puts e
|
||||
end%>
|
||||
<% else %>
|
||||
|
||||
已截止
|
||||
|
|
|
@ -14,84 +14,11 @@
|
|||
<% if !session[:seminar_signup_id].blank? %>
|
||||
|
||||
<%= form_for @con, url: edit_file_proc_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup-contribute"} do |f| %>
|
||||
<fieldset>
|
||||
<% if @seminar.seminar_submission_field_sets.count != 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]
|
||||
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
|
||||
show1 = !(data1.disabled)
|
||||
show2 = !(data2.disabled)
|
||||
show3 = !(data3.disabled)
|
||||
name1 = data1['name'][I18n.locale]
|
||||
name2 = data2['name'][I18n.locale]
|
||||
name3 = data3['name'][I18n.locale]
|
||||
plc1 = data1['placeholder'][I18n.locale]
|
||||
plc2 = data2['placeholder'][I18n.locale]==t('seminar_signup.description') ? '' : data2['placeholder'][I18n.locale]
|
||||
plc3 = data3['placeholder'][I18n.locale]==t('seminar_signup.file') ? '' : data3['placeholder'][I18n.locale]
|
||||
else
|
||||
show1 = true
|
||||
show2 = true
|
||||
show3 = true
|
||||
name1 = t('seminar_signup.title')
|
||||
name2 = t('seminar_signup.description')
|
||||
name3 = t('seminar_signup.file')
|
||||
plc1 = t('seminar_signup.title')
|
||||
plc2 = ''
|
||||
plc3 = ''
|
||||
end
|
||||
%>
|
||||
<% if show1 %>
|
||||
<div class="form-group">
|
||||
<label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
|
||||
<div class="col-sm-10">
|
||||
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
|
||||
</div>
|
||||
</div>
|
||||
<% begin %>
|
||||
<%= render :partial => 'seminars/contribute_form',:locals=>{:f=>f} %>
|
||||
<%rescue => e%>
|
||||
<%= e %>
|
||||
<% end %>
|
||||
<% if show2 %>
|
||||
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
|
||||
<span style="margin-right: 0.5em;">
|
||||
<label for="note" class="col-sm-2 control-label" style="display: contents;">
|
||||
<%= name2 %>
|
||||
</label>
|
||||
<br>
|
||||
<%= "(#{plc2})" if !(plc2.to_s.blank?) %>
|
||||
</span>
|
||||
<div class="col-sm-10">
|
||||
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show3 %>
|
||||
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
|
||||
<span style="margin-right: 0.5em;">
|
||||
<label for="note" class="col-sm-2 control-label" style="display: contents;">
|
||||
*<%= name3 %>
|
||||
</label>
|
||||
<br>
|
||||
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
|
||||
</span>
|
||||
<div class="col-sm-10">
|
||||
<%= f.file_field :file %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @seminar.seminar_submission_fields.asc(:_id).each do |rf| %>
|
||||
<div class="form-group" style="<%= rf.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
|
||||
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup_contribute",@con, rf.to_require,rf) %>
|
||||
</div>
|
||||
<% @form_index = @form_index +1 %>
|
||||
<% end %>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
||||
<input type="hidden" name="seminar_signup_contribute[id]" value="<%= @con[:_id] %>">
|
||||
<input type="hidden" name="seminar_signup_contribute[seminar_signup_id]" value="<%= session[:seminar_signup_id] %>">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
|
||||
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
|
|
|
@ -36,53 +36,37 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<div class="col-sm-12" style="text-align: center;"> *(<%= t('seminar.required') %>) </div>
|
||||
</div>
|
||||
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
||||
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
|
||||
<% if signup_field.field_name == 'name' %>
|
||||
<div>
|
||||
<div class="col-sm-12" style="text-align: center;"> *(<%= t('seminar.required') %>) </div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
|
||||
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
|
||||
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
|
||||
<% if !(['status','address','note'].include? signup_field.field_name) %>
|
||||
<% if !(['address','note'].include? signup_field.field_name) %>
|
||||
*
|
||||
<% end %>
|
||||
<%= signup_field['name'][I18n.locale] %>
|
||||
</label>
|
||||
<% if signup_field.field_name == 'status' %>
|
||||
|
||||
<% status_translations = ['G','C'].map{|c| [c, t("seminar.registration_status_#{c}")] }.to_h %>
|
||||
<% status_translations = {'G'=>'No','C'=>'Yes'} if (signup_field.name.values.select{|v| v.include?('?') || v.include?('是否')}.count != 0 rescue false) %>
|
||||
<div class="col-sm-10">
|
||||
<% if @seminar.registration_status.include?('G') %>
|
||||
<label class="radio-inline">
|
||||
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('seminar.registration_status_G') %>
|
||||
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= status_translations['G'] %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% if @seminar.registration_status.include?('C') %>
|
||||
<label class="radio-inline">
|
||||
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar.registration_status.count == 1 and @seminar.registration_status.include?('C') ? true : false) %> <%= t('seminar.registration_status_C') %>
|
||||
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar.registration_status.count == 1 and @seminar.registration_status.include?('C') ? true : false) %> <%= status_translations['C'] %>
|
||||
</label>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif signup_field.field_name == 'unit' %>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-append">
|
||||
<div class="tab-content">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="unit_<%= locale %>">
|
||||
<%= f.fields_for "unit_translations".to_sym do |f| %>
|
||||
<%= f.text_field locale, :class=>"input-medium form-control", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="btn-group" data-toggle="buttons-radio">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#unit_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.text_field 'unit', :class=>"input-medium form-control", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
|
||||
</div>
|
||||
<% elsif signup_field.field_name == 'address' %>
|
||||
<div class="col-sm-10">
|
||||
|
@ -151,10 +135,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="col-sm-12" style="text-align: center;"> *(<%= t('seminar.required') %>) </div>
|
||||
</div>
|
||||
|
||||
<!-- Name to Last Name -->
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-2 control-label">*<%= t('seminar_signup.name') %></label>
|
||||
|
@ -234,8 +214,8 @@
|
|||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last %>">
|
||||
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
|
||||
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
|
||||
<%= f.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %>
|
||||
<%= f.button "Delete", type: 'reset', class: 'btn' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -245,6 +225,7 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
|
||||
var validated = false,
|
||||
chks = false,
|
||||
pwd = $('#seminar_signup_password')
|
||||
|
|
|
@ -137,10 +137,21 @@ en:
|
|||
recaptcha: Verification code
|
||||
signup_field: Sign Up Field #圈選項目
|
||||
uploads: Uploads #上傳檔案
|
||||
con_login: Contributor Login #投稿者登入
|
||||
con_login: Submission #投稿者登入
|
||||
file_name: File Name #稿件名稱
|
||||
file_note: Summary #摘要
|
||||
files: Files #檔案
|
||||
logout: Log Out #登出
|
||||
logouting: Logging Out #登出中
|
||||
success_message: 'Registration successful, thank you.'
|
||||
email_address: Email address
|
||||
_password: Password
|
||||
login: Login
|
||||
new_: 'Load abstract'
|
||||
load_file: load file
|
||||
enable_summary_choice: Enable summary choice
|
||||
summary_choice_type: Summary choice type
|
||||
select: Select box
|
||||
checkbox: Multiple choice
|
||||
radio: Single choice
|
||||
choices: Choices
|
|
@ -48,7 +48,7 @@ zh_tw:
|
|||
email_add_file: 新增上傳
|
||||
auto_send_email_set: 自動發信設定
|
||||
click_to_contribute: 按此登入投稿
|
||||
required: 必填
|
||||
required: '必填, necessary'
|
||||
already_used: 已存在
|
||||
please_enter_email: 請輸入Email
|
||||
available: 可使用
|
||||
|
@ -132,15 +132,26 @@ zh_tw:
|
|||
note: 註解
|
||||
time: (開始/結束)時間
|
||||
place: 地點
|
||||
agree: 同意接受本站個資及隱私權保護宣告
|
||||
agree: 同意接受本站個資及隱私權保護宣告(Agree upon personal data protection declaration of this web)
|
||||
privacy_statement: '個資及隱私權保護宣告'
|
||||
recaptcha: 驗證碼
|
||||
signup_field: 圈選項目
|
||||
uploads: 上傳檔案
|
||||
con_login: 投稿者登入
|
||||
con_login: Submission
|
||||
file_name: 稿件名稱
|
||||
file_note: 摘要
|
||||
files: 檔案
|
||||
logout: 登出
|
||||
logout: Logout
|
||||
logouting: 登出中
|
||||
success_message: '您的報名已成功,感謝您的參與。'
|
||||
email_address: Email address
|
||||
_password: Password
|
||||
login: Login
|
||||
new_: '新增(load abstract)'
|
||||
load_file: load file
|
||||
enable_summary_choice: 開啟摘要選項
|
||||
summary_choice_type: 摘要選項類型
|
||||
select: 下拉選單
|
||||
checkbox: 多選
|
||||
radio: 單選
|
||||
choices: 選項
|
Loading…
Reference in New Issue