ask/app/views/admin/asks/_index.html.erb

64 lines
2.4 KiB
Plaintext

<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<% tmp = f.to_s.gsub(/ask\./,'') %>
<% if @ask_setting.default_setting[tmp].nil? || @ask_setting.default_setting[tmp] %>
<%= thead(f) %>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<% @askquestions.each do |b| %>
<tr>
<td>
<% if b.situation == 'is_waiting' %>
<span class='label label-important'><%= t('ask.is_waiting') %></span>
<% elsif b.situation == 'is_processed' %>
<span class='label label-warning'><%= t('ask.is_processed') %></span>
<% elsif b.situation == 'is_referral' %>
<span class='label'><%= t('ask.is_referral') %></span>
<% elsif b.situation == 'is_published' %>
<span class='label label-success'><%= t('ask.is_published') %></span>
<% end %>
</td>
<td>
<%= b.category.title rescue 'category not set' %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(b) %>
<li><a href="/<%= I18n.locale %>/admin/asks/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/asks/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
<li><a href="/<%= I18n.locale %>/admin/asks/<%=b.id.to_s%>/print" target="_blank"><%= t('ask.print') %></a></li>
</ul>
</div>
</td>
<td>
<% if b.situation == 'is_published' %>
<%= link_to b.title,((Page.where(:module=>'ask').first.url+"?item=#{b.id}") rescue "javascript:alert('#{t('ask.no_index_page')}')") %>
<% else %>
<%= b.title %>
<% end %>
</td>
<td>
<%= b.name %>
</td>
<% if @ask_setting.default_setting['phone'] %>
<td><%= b.phone %></td>
<% end %>
<% if @ask_setting.default_setting['appointment'] %>
<td><%= b.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
<% end %>
<td><%= b.created_at.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@askquestions), class: "pagination pagination-centered"
end
%>