seminar/app/views/seminars/con_upload.html.erb

112 lines
4.4 KiB
Plaintext
Raw Normal View History

2016-06-29 06:57:45 +00:00
<% # encoding: utf-8 %>
2019-10-29 15:14:20 +00:00
<% @@session = session %>
<%= yield %>
2016-06-29 06:57:45 +00:00
<%
data = action_data
@seminar = data["seminar"]
@seminar_signup = data["seminar_signup"]
@time_now = data["time_now"]
2021-03-26 03:55:59 +00:00
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
name1 = data1['name'][I18n.locale]
name2 = data2['name'][I18n.locale]
name3 = data3['name'][I18n.locale]
seminar_submission_field = @seminar.seminar_submission_fields.where(:markup=>"seminar_preferred_session").first
2021-06-17 10:07:43 +00:00
if data["prefix_url"]
prefix_url = data["prefix_url"]
else
prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end
2016-06-29 06:57:45 +00:00
%>
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
<% begin %>
2016-06-29 06:57:45 +00:00
<% if !session[:seminar_signup_id].blank? %>
2021-03-29 14:51:41 +00:00
<%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>
2021-06-17 10:07:43 +00:00
<a href="<%= prefix_url %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary'><%= t('seminar_signup.logout') %></a>
2016-06-29 06:57:45 +00:00
<table class="table table-hover table-striped seminar-index">
<caption>
<h3><%= @seminar.title %></h3>
</caption>
<thead>
<tr>
2021-03-26 03:55:59 +00:00
<% if show1 %>
<th class="col-md-2"><%= name1 %></th>
<% end %>
<% if show2 %>
<th class="col-md-2"><%= name2 %></th>
<% end %>
<% if show3 %>
<th class="col-md-2"><%= name3 %></th>
<% end %>
<% if seminar_submission_field %>
<th class="col-md-2"><%= seminar_submission_field.title %></th>
<% end %>
2016-06-29 06:57:45 +00:00
<th class="col-md-2"><%= t(:action) %></th>
</tr>
</thead>
<tbody>
<%
@seminar_signup.seminar_signup_contributes.each do |seminar_signup_contribute|
%>
<tr>
<% if show1 %>
<td><%= seminar_signup_contribute.title %></td>
<% end %>
<% if show2 %>
<% 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>
<% end %>
<% if show3 %>
<td><%= link_to seminar_signup_contribute.disp_filename, seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text, :download=>seminar_signup_contribute.disp_filename} if seminar_signup_contribute.file.file %></td>
<% end %>
<% if seminar_submission_field %>
<td><%= seminar_signup_contribute.seminar_submission_values.where(:seminar_submission_field=>seminar_submission_field).first.get_value_by_locale(I18n.locale) %></td>
<% end %>
2016-06-29 06:57:45 +00:00
<td>
2021-06-17 10:07:43 +00:00
<%= link_to t(:edit), prefix_url + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %>
2022-06-08 14:22:24 +00:00
<%= form_tag(del_file_seminars_path, {method: "post"}) do |f| %>
<%= submit_tag t(:delete_), class: "btn btn-primary" %>
<%= hidden_field_tag "referer_url", request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>
<%= hidden_field_tag "con_no", seminar_signup_contribute.id %>
2022-06-08 13:33:20 +00:00
<% end %>
2016-06-29 06:57:45 +00:00
</td>
</tr>
<% end %>
</tbody>
</table>
<% if ( @seminar.contribute_file_count.blank? or @seminar_signup.seminar_signup_contributes.count < @seminar.contribute_file_count.to_i ) %>
2021-06-17 10:07:43 +00:00
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), prefix_url + '?method=add_file', :class => 'btn btn-primary' %>
2016-06-29 06:57:45 +00:00
<% end %>
<br />
<br />
<!-- 檔案上限: <%#= @seminar.contribute_file_count.blank? ? '無' : @seminar.contribute_file_count %> -->
2016-06-29 06:57:45 +00:00
<% else %>
2021-07-14 04:57:47 +00:00
<%= t("seminar.please_login_first") %>
2016-06-29 06:57:45 +00:00
<br />
2021-07-14 04:57:47 +00:00
<a href="<%= page_for_seminar_url %>"><%=t("seminar.back")%></a>
2016-06-29 06:57:45 +00:00
<% end %>
<%
rescue => e
puts e
end%>
2016-06-29 06:57:45 +00:00
<% else %>
2021-07-14 04:57:47 +00:00
<%= t("seminar.out_of_date") %>
<% end %>