Application_Form/app/views/application_forms/index.html.erb

73 lines
3.3 KiB
Plaintext
Raw Normal View History

2022-03-10 02:11:18 +00:00
<% # encoding: utf-8 %>
<%
data = action_data
@application_forms = data["application_forms"]
@total_pages = data["total_pages"]
@time_now = data["time_now"]
%>
<% begin %>
<table class="table table-hover table-striped application_form-index">
<caption>
<% page = OrbitHelper.page rescue Page.where(:page_id => OrbitHelper.params[:page_id]).first %>
<h3><%= page.name rescue t('application_form.application_form') %></h3>
</caption>
<thead>
<tr>
<th class="col-md-2"><%= t(:category) %></th>
<th class="col-md-3"><%= t('application_form.title') %></th>
<th class="col-md-2"><%= t('application_form_signup.time') %></th>
<th class="col-md-2"><%= t('application_form_signup.place') %></th>
<th class="col-md-2"><%= t('application_form.signup') %></th>
</tr>
</thead>
<tbody>
<%
@application_forms.each do |application_form|
if !application_form.registration_status.blank? and (application_form.signup_start_date <= @time_now rescue false) and ( application_form.signup_end_date.nil? or application_form.signup_end_date+1 >= @time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '" target="_blank">' + t('application_form.signup') + '</a>').html_safe
elsif application_form.registration_status.blank?
sign_up = t('application_form.sign_up_not_open')
elsif (application_form.signup_start_date > @time_now rescue false)
sign_up = t('application_form.sign_up_not_yet')
else
sign_up = t('application_form.sign_up_overdue')
end
%>
<tr>
<td><%= application_form.category.title %></td>
<td>
<% if (application_form.enable_custom_template rescue false) %>
<%= ('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '/home/introduction" target="_blank">' + application_form.title + '</a>').html_safe %>
<% else %>
<%= ('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '?method=show_data" target="_blank">' + application_form.title + '</a>').html_safe %>
<% end %>
</td>
<td><%= ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) %></td>
<td><%= application_form.act_place %></td>
<td>
<%= sign_up %> <br />
<%=
if !application_form.registration_status.blank? and application_form.registration_status.include?('C') and (application_form.contribute_start_date <= @time_now rescue false) and ( application_form.contribute_end_date.nil? or (application_form.contribute_end_date+1 >= @time_now rescue false) )
if !session[:application_form_signup_id].blank?
if session[:application_form_main_id] == application_form.id
('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '?method=con_upload">' + t('application_form_signup.uploads') + '</a>').html_safe
else
('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '?method=con_login">' + t('application_form_signup.con_login') + '</a>').html_safe
end
else
('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '?method=con_login">' + t('application_form_signup.con_login') + '</a>').html_safe
end
end
%>
</td>
</tr>
<% end %>
</tbody>
</table>
<% rescue => e
puts [e,e.backtrace]
end
%>
<%= create_pagination(@total_pages).html_safe if @total_pages > 1 %>