2014-11-07 08:44:11 +00:00
|
|
|
|
<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>
|
|
|
|
|
<% @news_bulletin.each do |b| %>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>
|
|
|
|
|
<%= b.status_for_table %>
|
|
|
|
|
</td>
|
2015-01-09 06:29:00 +00:00
|
|
|
|
<td><%= b.category.title rescue "" %></td>
|
2014-11-07 08:44:11 +00:00
|
|
|
|
<td>
|
|
|
|
|
<% if b.expired? %>
|
2015-02-24 06:13:42 +00:00
|
|
|
|
<% if b.rejected %>
|
|
|
|
|
<% if !b.title_translations["zh_tw"].blank? %>
|
|
|
|
|
<%= b.title_translations["zh_tw"] %><span class='label'><%= t(:expired)+','+t(:rejected) %> : <%= b.rejection_reason rescue "" %></span><br />
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if !b.title_translations["en"].blank? %>
|
|
|
|
|
<%= b.title_translations["en"] %><span class='label'><%= t(:expired)+','+t(:rejected) %> : <%= b.rejection_reason rescue "" %></span>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<% if !b.title_translations["zh_tw"].blank? %>
|
|
|
|
|
<%= b.title_translations["zh_tw"] %> <span class='label'><%= t(:expired) %></span><br />
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if !b.title_translations["en"].blank? %>
|
|
|
|
|
<%= b.title_translations["en"] %> <span class='label'><%= t(:expired) %></span>
|
|
|
|
|
<% end %>
|
2015-02-13 10:00:33 +00:00
|
|
|
|
<% end %>
|
2014-11-14 09:50:18 +00:00
|
|
|
|
<% elsif b.rejected %>
|
2015-02-13 10:00:33 +00:00
|
|
|
|
<% url = page_for_bulletin(b) %>
|
|
|
|
|
<% if !b.title_translations["zh_tw"].blank? %>
|
|
|
|
|
<a href="<%= url %>" target="_blank"><%= b.title_translations["zh_tw"] %></a> <span class='label'><%= t(:rejected) %> : <%= b.rejection_reason rescue "" %></span><br />
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if !b.title_translations["en"].blank? %>
|
|
|
|
|
<a href="<%= url %>" target="_blank"><%= b.title_translations["en"] %></a> <span class='label'><%= t(:rejected) %> : <%= b.rejection_reason rescue "" %></span>
|
|
|
|
|
<% end %>
|
2014-11-07 08:44:11 +00:00
|
|
|
|
<% elsif !b.approved? %>
|
2015-02-13 10:00:33 +00:00
|
|
|
|
<% url = page_for_news_bulletin(b) %>
|
|
|
|
|
<% if !b.title_translations["zh_tw"].blank? %>
|
|
|
|
|
<a href="<%= url %>" target="_blank"><%= b.title_translations["zh_tw"] %></a> <span class='label'><%= t(:pending) %></span><br />
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if !b.title_translations["en"].blank? %>
|
|
|
|
|
<a href="<%= url %>" target="_blank"><%= b.title_translations["en"] %></a> <span class='label'><%= t(:pending) %></span>
|
|
|
|
|
<% end %>
|
2014-11-07 08:44:11 +00:00
|
|
|
|
<% else %>
|
2015-02-13 10:00:33 +00:00
|
|
|
|
<% url = page_for_news_bulletin(b) %>
|
|
|
|
|
<% if !b.title_translations["zh_tw"].blank? %>
|
|
|
|
|
<a href="<%= url %>" target="_blank"><%= b.title_translations["zh_tw"] %></a><br />
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if !b.title_translations["en"].blank? %>
|
|
|
|
|
<a href="<%= url %>" target="_blank"><%= b.title_translations["en"] %></a>
|
|
|
|
|
<% end %>
|
2014-11-07 08:44:11 +00:00
|
|
|
|
<% 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) %>
|
2015-03-23 08:10:53 +00:00
|
|
|
|
<% if current_user.is_admin? || current_user.is_manager?(@module_app) %>
|
|
|
|
|
<li><a href="/admin/news/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
|
|
|
|
<li><a href="#" class="delete text-error" rel="/admin/news/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
|
2015-03-25 08:34:18 +00:00
|
|
|
|
<% elsif is_user_sub_manager? %>
|
|
|
|
|
<% if !b.rejected && !b.approved %>
|
|
|
|
|
<li><a href="/admin/news/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
|
|
|
|
<% end %>
|
|
|
|
|
<li><a href="#" class="delete text-error" rel="/admin/news/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
|
2015-03-23 08:10:53 +00:00
|
|
|
|
<% else %>
|
|
|
|
|
<% if !b.rejected && !b.approved %>
|
|
|
|
|
<li><a href="/admin/news/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
|
|
|
|
<li><a href="#" class="delete text-error" rel="/admin/news/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% if !b.rejected && !b.approved && user_can_approve? && !b.expired? %>
|
2014-11-14 09:50:18 +00:00
|
|
|
|
<li><a href="#" class="appoval_button" data-approve-link="<%= "/#{I18n.locale.to_s}/news/#{b.to_param}" %>" data-id="<%= b.id.to_s %>"><%= t("news.approve") %></a></li>
|
2014-11-07 08:44:11 +00:00
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
<td><%= format_value b.postdate %></td>
|
|
|
|
|
<td class="<%= b.expired? ? "expired" : "" %>"><%= format_value b.deadline %></td>
|
|
|
|
|
<td>
|
|
|
|
|
<%= content_tag(:div, image_tag(b.image.file.blank? ? "/assets/news_alt.jpg" : b.image.url), {:class => "img-peview", :rel=>"popover", "data-content"=>"#{image_tag(b.image.file.blank? ? "/assets/news_alt.jpg" : b.image.url)}", "data-trigger"=>"hover", "data-placement"=>"left"}) %>
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
<% Unit.where({:id => b.unit_id}).each do |u| %>
|
|
|
|
|
<%= u.name %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% Department.where({:id => b.department}).each do |d| %>
|
|
|
|
|
-<%= d.name %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</td>
|
|
|
|
|
<td><%= b.view_count %></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(:tags) %></strong> :
|
|
|
|
|
<% b.tags.each do |tag| %>
|
|
|
|
|
<span class="label label-warning"><%= tag.name %></span>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<strong><%= t("news.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(@news_bulletin), class: "pagination pagination-centered"
|
|
|
|
|
end
|
|
|
|
|
%>
|
|
|
|
|
|
|
|
|
|
<% content_for :page_specific_css do %>
|
|
|
|
|
<style>
|
|
|
|
|
.img-peview {
|
2015-02-13 10:00:33 +00:00
|
|
|
|
width: 100px;
|
2014-11-07 08:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
td img{
|
2015-02-13 10:00:33 +00:00
|
|
|
|
max-width: 100% !important;
|
2014-11-07 08:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
.popover{
|
|
|
|
|
width: 310px;
|
|
|
|
|
}
|
|
|
|
|
.popover .arrow {
|
|
|
|
|
border-bottom-color: #333;
|
|
|
|
|
border-width: 0 10px 10px;
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
.popover img {
|
2015-02-13 10:00:33 +00:00
|
|
|
|
max-width: 100%;
|
2014-11-07 08:44:11 +00:00
|
|
|
|
height: auto;
|
|
|
|
|
}
|
|
|
|
|
.popover-inner {
|
|
|
|
|
width: auto;
|
|
|
|
|
}
|
|
|
|
|
.popover-title {
|
|
|
|
|
display: none;
|
|
|
|
|
adding: 5px;
|
|
|
|
|
}
|
|
|
|
|
.popover-content {
|
|
|
|
|
text-align: center;
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
padding: 5px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<% end %>
|
2015-03-06 01:31:21 +00:00
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
$('.img-peview').popover({
|
|
|
|
|
html: true
|
2014-11-07 08:44:11 +00:00
|
|
|
|
});
|
2015-03-06 01:31:21 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(".appoval_button").on("click",function(){
|
|
|
|
|
var url = $(this).data("approve-link"),
|
|
|
|
|
modal = $("#approvalModal");
|
|
|
|
|
modal.find("iframe").attr("src", url);
|
|
|
|
|
modal.find("#object_id").val($(this).data("id"));
|
|
|
|
|
modal.modal("show");
|
|
|
|
|
return false;
|
|
|
|
|
})
|
|
|
|
|
</script>
|