custom_announcement/app/views/admin/custom_announcements/_index.html.erb

98 lines
4.3 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| %>
<%= thead(f) %>
<% end %>
</tr>
</thead>
<tbody>
<% @custom_bulletins.each do |b| %>
<tr>
<td>
<%= b.status_for_table %>
</td>
<td>
<%= b.category.title rescue "" %>
<% if (b.category.disable rescue false) %>
<span class='label'><%= t(:disabled) %></span>
<% end %>
</td>
<td>
<% if b.expired? || (b.category.disable rescue false)%>
<%= b.title.to_s.html_safe %>
<% else %>
<a href="<%= page_for_custom_bulletin(b) %>" target="_blank"><%= b.title.to_s.html_safe %></a>
<% end %>
<% if b.expired? %>
<span class='label'><%= t(:expired) %></span>
<% end %>
<% if b.reapproval %>
<span class='label'><%= t("custom_announcement.reapproval") + " " + t(:pending) %></span>
<% end %>
<% if b.rejected %>
<span class='label'><%= t(:rejected) %> : <%= b.rejection_reason rescue "" %></span>
<% end %>
<% if !b.approved? && !b.rejected %>
<span class='label'><%= t(:pending) %></span>
<% end %>
<div class="quick-edit">
<ul class="nav nav-pills">
<li><a href="#" class="detail-row" onclick="$('#<%= "#{b.id.to_s}-detail" %>').slideToggle(300); return false;"><%= t(:detail) %></a></li>
<% if can_edit_or_delete?(b) %>
<li><a href="/admin/custom_announcements<%=params[:custom_module].blank? ? '' : "/#{params[:custom_module]}#{params[:bind_uid].present? ? ('-'+params[:bind_uid]) : ''}"%>/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/custom_announcements/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
<% if ((!b.approved && !b.rejected && !b.reapproval) || (b.rejected && b.reapproval)) && user_can_approve?(b) %>
<li><a href="<%= page_for_custom_bulletin(b) %>" class="approval_button" data-id="<%= b.id.to_s %>" ><%= t("custom_announcement.approval_waiting") %></a></li>
<% end %>
</ul>
</div>
</td>
<td><%= format_value b.postdate %></td>
<td class="<%= b.expired? ? "expired" : "" %>"><%= format_value b.deadline %></td>
<td><%= link_to b.custom_bulletin_comments.count.to_s,"/#{I18n.locale}/admin/custom_announcements/#{params[:custom_module]}#{params[:bind_uid].present? ? ('-'+params[:bind_uid]) : ''}/#{b.id}/comment" %></td>
<td><%= b.update_user.user_name rescue ""%></td>
</tr>
<tr class="footable-row-detail">
<td class="footable-cell-detail" colspan="6">
<div id="<%= "#{b.id.to_s}-detail" %>" class="footable-row-detail-inner" style="display: none;">
<div>
<strong><%= t(:view_count) %></strong> :
<span class="label label-info"><%= b.view_count %></span>
</div>
<div>
<strong><%= t(:tags) %></strong> :
<% b.tags.each do |tag| %>
<span class="label label-warning"><%= tag.name %></span>
<% end %>
</div>
<div>
<strong><%= t("custom_announcement.email_to") %></strong> :
<% b.email_members.each do |member| %>
<span class="label"><%= member.name %></span>
<% end %>
<% unless b.other_mailaddress.nil? %>
<% b.other_mailaddress.split(',').each do |mailaddress| %>
<span class="label"><%= mailaddress %></span>
<% end %>
<% end %>
</div>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag(:div, paginate(@custom_bulletins), class: "pagination pagination-centered") +
content_tag(:div, link_to(t(:new_),(params[:custom_module].blank? ? "#{@module_app.key.pluralize}/new" : "#{params[:custom_module]}#{params[:bind_uid].present? ? ('-'+params[:bind_uid]) : ''}/new"), :class=>"btn btn-primary"), class: "pull-right")
end
%>