seminar2_old/app/views/seminars/index.html.erb

75 lines
2.8 KiB
Plaintext
Raw Normal View History

2016-06-29 06:57:45 +00:00
<% # encoding: utf-8 %>
<%
data = action_data
@seminars = data["seminars"]
@total_pages = data["total_pages"]
@time_now = data["time_now"]
%>
2021-03-31 08:15:12 +00:00
<% begin %>
2016-06-29 06:57:45 +00:00
<table class="table table-hover table-striped seminar-index">
<caption>
2021-10-26 14:10:10 +00:00
<% page = OrbitHelper.page rescue Page.where(:page_id => OrbitHelper.params[:page_id]).first %>
2021-10-26 14:01:36 +00:00
<h3><%= page.name rescue t('seminar.seminar') %></h3>
2016-06-29 06:57:45 +00:00
</caption>
<thead>
<tr>
<th class="col-md-2"><%= t(:category) %></th>
<th class="col-md-3"><%= t('seminar.title') %></th>
<th class="col-md-2"><%= t('seminar_signup.time') %></th>
<th class="col-md-2"><%= t('seminar_signup.place') %></th>
<th class="col-md-2"><%= t('seminar.signup') %></th>
</tr>
</thead>
<tbody>
<%
@seminars.each do |seminar|
2023-01-11 09:44:40 +00:00
registration_is_open = seminar.registration_status.present?
sign_up_not_yet = seminar.signup_start_date && @time_now && seminar.signup_start_date > @time_now
sign_up_overdue = seminar.signup_end_date && @time_now && (seminar.signup_end_date + 1.day <= @time_now)
2023-01-11 09:46:06 +00:00
signup_is_full = seminar.signup_is_full?
2023-01-11 09:44:40 +00:00
seminar_url = OrbitHelper.url_to_show(seminar.to_param)
if !registration_is_open
sign_up = t('seminar.sign_up_not_open')
elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet')
elsif sign_up_overdue
sign_up = t('seminar.sign_up_overdue')
2023-01-11 09:46:06 +00:00
elsif signup_is_full
sign_up = t('seminar.sign_up_is_full')
2023-01-11 09:44:40 +00:00
else
sign_up_text = t('seminar.signup')
sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
end
seminar_title = seminar.title
2016-06-29 06:57:45 +00:00
%>
<tr>
<td><%= seminar.category.title %></td>
2021-06-17 10:07:43 +00:00
<td>
2023-01-11 09:44:40 +00:00
<%= link_to(seminar_title, seminar.get_frontend_url(seminar_url, :show_data), :target=>'_blank', :title=>seminar_title) %>
2021-06-17 10:07:43 +00:00
</td>
2016-06-29 06:57:45 +00:00
<td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td>
<td><%= seminar.act_place %></td>
<td>
<%= sign_up %> <br />
<%=
2023-01-11 09:44:40 +00:00
if registration_is_open && seminar.registration_status.include?('C') && (seminar.contribute_start_date.nil? || seminar.contribute_start_date <= @time_now rescue false) && ( seminar.contribute_end_date.nil? || (seminar.contribute_end_date+1.day >= @time_now rescue false) )
if session[:seminar_signup_id].present? && session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads')
link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
2016-06-29 06:57:45 +00:00
else
2023-01-11 09:44:40 +00:00
button_text = t('seminar_signup.con_login')
link_to(button_text, seminar.get_frontend_url(seminar_url, :con_login), :title=>button_text)
2016-06-29 06:57:45 +00:00
end
end
%>
</td>
</tr>
<% end %>
</tbody>
</table>
2021-03-31 08:15:12 +00:00
<% rescue => e
puts [e,e.backtrace]
end
%>
2016-06-29 06:57:45 +00:00
<%= create_pagination(@total_pages).html_safe if @total_pages > 1 %>