This commit is contained in:
BoHung Chiu 2021-04-10 10:47:33 +08:00
parent ec023fb048
commit 31659c6860
3 changed files with 6 additions and 106 deletions

View File

@ -332,8 +332,8 @@ class Admin::SeminarsController < OrbitAdminController
seminar_signup_set_params = seminar_main_params['seminar_signup_field_sets'] seminar_signup_set_params = seminar_main_params['seminar_signup_field_sets']
seminar_submission_set_params = seminar_main_params['seminar_submission_field_sets'] seminar_submission_set_params = seminar_main_params['seminar_submission_field_sets']
seminar_email_sets_params = seminar_main_params['seminar_email_sets'] seminar_email_sets_params = seminar_main_params['seminar_email_sets']
seminar_signup_field_customs_params = seminar_main_params["seminar_signup_field_customs"].to_hash seminar_signup_field_customs_params = seminar_main_params["seminar_signup_field_customs"].to_h rescue {}
seminar_main_params["seminar_signup_field_customs"].each do |k,v| seminar_main_params["seminar_signup_field_customs"].to_h.each do |k,v|
v.delete "title" v.delete "title"
end end
seminar_main_params.delete(:seminar_signup_field_sets) seminar_main_params.delete(:seminar_signup_field_sets)
@ -533,6 +533,9 @@ class Admin::SeminarsController < OrbitAdminController
end end
def set_seminar_signup_admin_setting def set_seminar_signup_admin_setting
page = params[:type] || params[:page] page = params[:type] || params[:page]
if params[:action] == "seminar_signup"
page = params[:type]
end
page = nil if page.blank? page = nil if page.blank?
@seminar_signup_admin_setting = SeminarSignupAdminSetting.where(:seminar_main_id=>params[:id],:page=>page).first @seminar_signup_admin_setting = SeminarSignupAdminSetting.where(:seminar_main_id=>params[:id],:page=>page).first
if @seminar_signup_admin_setting.nil? if @seminar_signup_admin_setting.nil?

View File

@ -118,7 +118,7 @@
<td <%= rowspan %>><%= val.to_s.html_safe %></td> <td <%= rowspan %>><%= val.to_s.html_safe %></td>
<% end %> <% end %>
<% end %> <% end %>
<% (0...count).each do |i|%> <% (1...count+1).each do |i|%>
<tr> <tr>
<% indices.each do |index| %> <% indices.each do |index| %>
<td> <td>

View File

@ -1,103 +0,0 @@
<table class="table main-list">
<thead>
<tr>
<% render :partial => "get_display_fields" %>
<% @field_name_translations.each_with_index do |trans,i|%>
<% next unless @display_field.include?(@field_names[i]) %>
<th class="span2" id="<%=@field_names[i]%>"><%= trans %></th>
<% end %>
</tr>
</thead>
<tbody class="sort-holder">
<% @seminar_signups.each do |seminar_signup| %>
<% len = seminar_signup.seminar_signup_contributes.count %>
<% rowspan = "rowspan=#{len==0? 1 : len}" %>
<% vals = [] %>
<tr>
<% @field_names.each_with_index do |fn,i|%>
<% next unless @display_field.include?(fn) %>
<% names = fn.split(".") %>
<% val = "" %>
<% if names[0] == "seminar_signup_field_set" %>
<% if names[1] == "name" %>
<% val = seminar_signup.name
val += "<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">"
if can_edit_or_delete?(seminar_signup)
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
end
val += "</ul>
</div>"
%>
<% elsif names[1] == 'status' %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% elsif names[1] != 'recaptcha' %>
<% val = seminar_signup.send("#{names[1]}") %>
<% end %>
<% elsif names[0] == "default" %>
<% if names[2] == "name" %>
<% val = seminar_signup.name
val += "<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">"
if can_edit_or_delete?(seminar_signup)
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
end
val += "</ul>
</div>"
%>
<% elsif names[2] == "tel" %>
<% val = seminar_signup.tel %>
<% elsif names[2] == "registration_status" %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% end %>
<% elsif names[0] == "seminar_signup_field_custom" || names[0] == "seminar_signup_fields" %>
<% val = seminar_signup.seminar_signup_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "" %>
<% elsif names[0] == "seminar_signup_contributes" %>
<% 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])} %>
<% 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 "")} %>
<% end %>
<% vals << val %>
<% end %>
<% count = 0 %>
<% indices = [] %>
<% vals.each_with_index do |val,i| %>
<% if val.class == Array %>
<% count = val.count - 1 %>
<% indices << i%>
<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 %>
<% else %>
<%= val[0].html_safe.to_s rescue "" %>
<% end %>
</td>
<% else %>
<td <%= rowspan %>><%= val.to_s.html_safe %></td>
<% end %>
<% end %>
<% (0...count).each do |i|%>
<tr>
<% indices.each do |index| %>
<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 %>
<% else %>
<%= vals[index][i].html_safe.to_s rescue "" %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</tr>
<% end %>
</tbody>
</table>