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

72 lines
2.7 KiB
Plaintext

<% # encoding: utf-8 %>
<%
data = action_data
@seminars = data["seminars"]
@total_pages = data["total_pages"]
@time_now = data["time_now"]
%>
<% begin %>
<table class="table table-hover table-striped seminar-index">
<caption>
<% page = OrbitHelper.page rescue Page.where(:page_id => OrbitHelper.params[:page_id]).first %>
<h3><%= page.name rescue t('seminar.seminar') %></h3>
</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|
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)
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')
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
%>
<tr>
<td><%= seminar.category.title %></td>
<td>
<%= link_to(seminar_title, seminar.get_frontend_url(seminar_url, :show_data), :target=>'_blank', :title=>seminar_title) %>
</td>
<td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td>
<td><%= seminar.act_place %></td>
<td>
<%= sign_up %> <br />
<%=
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)
else
button_text = t('seminar_signup.con_login')
link_to(button_text, seminar.get_frontend_url(seminar_url, :con_login), :title=>button_text)
end
end
%>
</td>
</tr>
<% end %>
</tbody>
</table>
<% rescue => e
puts [e,e.backtrace]
end
%>
<%= create_pagination(@total_pages).html_safe if @total_pages > 1 %>