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

73 lines
2.6 KiB
Plaintext

<% # encoding: utf-8 %>
<% @@session = session %>
<%= yield %>
<%
data = action_data
@seminar = data["seminar"]
@seminar_signup = data["seminar_signup"]
@time_now = data["time_now"]
%>
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
<% if !session[:seminar_signup_id].blank? %>
<a href="<%= OrbitHelper.url_to_show(@seminar.to_param) %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary'><%= t('seminar_signup.logout') %></a>
<table class="table table-hover table-striped seminar-index">
<caption>
<h3><%= @seminar.title %></h3>
</caption>
<thead>
<tr>
<th class="col-md-2"><%= t('seminar_signup.file_name') %></th>
<th class="col-md-2"><%= t('seminar_signup.file_note') %></th>
<th class="col-md-2"><%= t('seminar_signup.files') %></th>
<th class="col-md-2"><%= t(:action) %></th>
</tr>
</thead>
<tbody>
<%
@seminar_signup.seminar_signup_contributes.each do |seminar_signup_contribute|
%>
<tr>
<td><%= seminar_signup_contribute.title %></td>
<td><%= seminar_signup_contribute.description.to_s.html_safe %></td>
<td><%= 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 => seminar_signup_contribute.description} if seminar_signup_contribute.file.file %></td>
<td>
<%= link_to t(:edit), OrbitHelper.url_to_show(@seminar.to_param) + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %>
<form method="post" action="<%= del_file_seminars_path %>">
<%= submit_tag t(:delete_), class: "btn btn-primary" %>
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="con_no" value="<%= seminar_signup_contribute.id %>">
</form>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if ( @seminar.contribute_file_count.blank? or @seminar_signup.seminar_signup_contributes.count < @seminar.contribute_file_count.to_i ) %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'), OrbitHelper.url_to_show(@seminar.to_param) + '?method=add_file', :class => 'btn btn-primary' %>
<% end %>
<br />
<br />
檔案上限: <%= @seminar.contribute_file_count.blank? ? '無' : @seminar.contribute_file_count %>
<% else %>
請先登入
<br />
<a href="<%= page_for_seminar_url %>">回列表頁</a>
<% end %>
<% else %>
已截止
<% end %>