survey/app/views/admin/surveys/_index.html.erb

61 lines
2.7 KiB
Plaintext

<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<% if f == 'survey.results_count' %>
<th class='span2'><%= t(f)%></th>
<% else %>
<%= thead(f) %>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<% @surveys.each do |survey| %>
<tr>
<td>
<% if survey.expired? %>
<%= survey.title %> <span class='label'><%= t(:expired) %></span>
<% else %>
<a href="<%= page_for_survey(survey) %>" target="_blank"><%= survey.title %></a>
<% end %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(survey) %>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/duplicate_it"><%= t('survey.duplicate_it') %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/jump"><%= t('survey.jump') %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/set_answers"><%= t('survey.set_answers') %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/export?format=xlsx" data-survey-id="<%= survey.id.to_s %>" class="export-xls"><%= t('survey.export_csv') %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/set_sections"><%= t('survey.set_sections') %></a></li>
<li><a href="<%=page_for_survey(survey)%>?method=result&force_chart=true" target="_blank"><%= t('survey.chart') %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/surveys/<%=survey.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td><%= (survey.postdate) ? (format_value survey.postdate) : t(:no_deadline) %></td>
<td><%= (survey.deadline) ? (format_value survey.deadline) : t(:no_deadline) %></td>
<td>
<a href="/admin/surveys/<%=survey.id.to_s%>/answer_sets"> <%= survey.survey_answer_groups.count %></a>
<%# if survey.needs_login %>
<!-- <a href="/admin/surveys/<%=survey.id.to_s%>/answer_sets"> <%#= survey.survey_answers.count %></a> -->
<%# else %>
<%#= survey.survey_answers.count %>
<%# end %>
</td>
<td><%= survey.update_user.user_name rescue ''%></td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@surveys), class: "pagination pagination-centered"
end
%>