seminar/app/views/admin/seminars/_seminar_signup_render_tabl...

156 lines
9.1 KiB
Plaintext

<table class="table main-list">
<thead>
<tr>
<% render :partial => "get_display_fields" %>
<% if @seminar.nil? %>
<th><%= t('seminar.title') %></th>
<% end %>
<% if @drag%>
<th></th>
<% end %>
<% @field_name_translations.each_with_index do |trans,i|%>
<% next unless @display_field.include?(@field_names[i]) %>
<th class="span2" id="<%=@field_names[i]%>"><%= trans %></th>
<% end %>
</tr>
</thead>
<tbody class="sort-holder" <%=@reviewer_id.nil? ? "" : "data-id=#{@reviewer_id}" %>>
<% display_title = @seminar.nil? %>
<% @seminar_signups.each do |seminar_signup| %>
<% @seminar = seminar_signup.seminar_main if display_title %>
<% len = seminar_signup.seminar_signup_contributes.count %>
<% rowspan = "rowspan=#{len==0? 1 : len}" %>
<% vals = [] %>
<tr data-id="<%=seminar_signup.id.to_s%>">
<% if @drag%>
<td <%=rowspan%>><span class="brand"><i class="icons-list-2"></i></span></td>
<% end %>
<% vals << seminar_signup.seminar_main.title if display_title %>
<% @display_field.each_with_index do |fn,i|%>
<% names = fn.split(".") %>
<% val = "" %>
<% if names[0] == "seminar_signup_field_set" %>
<% if names[1] == "name" %>
<% val = seminar_signup.name
val += "<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">"
if can_edit_or_delete?(seminar_signup)
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
end
val += "</ul>
</div>"
%>
<% elsif names[1] == 'status' %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% elsif names[1] != 'recaptcha' %>
<% val = seminar_signup.send("#{names[1]}") %>
<% end %>
<% elsif names[0] == "default" %>
<% if names[2] == "name" %>
<% val = seminar_signup.name
val += "<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">"
if can_edit_or_delete?(seminar_signup)
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
end
val += "</ul>
</div>"
%>
<% elsif names[2] == "tel" %>
<% val = seminar_signup.tel %>
<% elsif names[2] == "registration_status" %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% end %>
<% elsif names[0] == "seminar_signup_field_custom" || names[0] == "seminar_signup_fields" %>
<% val = seminar_signup.seminar_signup_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "" %>
<% elsif names[0] == "seminar_signup_contributes" %>
<% if names[1] == "file" %>
<% val = seminar_signup.seminar_signup_contributes.to_a %>
<% else %>
<% if names[1] == "description" %>
<% descriptions = seminar_signup.seminar_signup_contributes.collect{|s| s.send(names[1])} %>
<% if @seminar.enable_summary_choice
descriptions = descriptions.map do |description|
if (description.to_s.to_i.to_s == description)
description = @seminar.summary_chioices[description.to_i] rescue description
else
description = description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue description
end
end
end %>
<% val = descriptions %>
<% else %>
<% val = seminar_signup.seminar_signup_contributes.collect{|s| s.send(names[1]).to_s} %>
<% end %>
<% end %>
<% elsif names[0] == "seminar_submission_fields" %>
<% val = seminar_signup.seminar_signup_contributes.collect{|s| (s.seminar_submission_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "")} %>
<% elsif names[0] == "seminar_signup" %>
<% val = (seminar_signup.send("display_"+names[1]) rescue seminar_signup.send(names[1])) rescue nil %>
<% end %>
<% vals << val %>
<% end %>
<% count = 0 %>
<% indices = [] %>
<% vals.each_with_index do |val,i| %>
<% if val.class == Array %>
<% count = val.count - 1 %>
<% indices << i%>
<td>
<% if val[0].class == SeminarSignupContribute #File %>
<% seminar_signup_contribute = val[0] %>
<% 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 %>
<%= 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 => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %>
<% else %>
<%= val[0].html_safe.to_s rescue "" %>
<% end %>
</td>
<% else %>
<td <%= rowspan %>><%= val.to_s.html_safe %></td>
<% end %>
<% end %>
<% (0...count).each do |i|%>
<tr>
<% indices.each do |index| %>
<td>
<% if vals[index][i].class == SeminarSignupContribute #File %>
<% seminar_signup_contribute = vals[index][i] %>
<% 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 %>
<%= 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 => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %>
<% else %>
<%= vals[index][i].html_safe.to_s rescue "" %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</tr>
<% end %>
<% if @include_blank && @seminar_signups.count == 0 %>
<tr class="blank_tr">
<% if @drag %>
<td rowspan="3"></td>
<% end %>
<% (0...@display_field.count).each do |f| %>
<td rowspan="3"></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>