add sync_data
This commit is contained in:
parent
39386930ef
commit
ce2ec4fc1a
|
@ -167,4 +167,24 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
|||
@part = PagePart.find params[:part_id]
|
||||
end
|
||||
|
||||
|
||||
def sync_data
|
||||
@create_users = ( params[:dept].blank? or !params[:dept].kind_of?(Array)) ? [] : User.where(:sid.in => params[:dept]).collect{|p| p.id}
|
||||
@page_num = params[:page_num].blank? ? '10' : params[:page_num]
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:category_id.nin => ['53abbd0b45ef444e6a0001a0','53abbd2045ef444e6a00095d','53abbd0745ef444e6a000001'], :create_user_id.in => @create_users).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
end
|
||||
|
||||
def show_sync_data
|
||||
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
|
||||
if @bulletin and !@bulletin.disable?
|
||||
if @bulletin.enabled_for_lang(I18n.locale.to_s)
|
||||
impressionist(@bulletin)
|
||||
else
|
||||
render :text => "<div class='alert alert-error'>#{t('sys.can_not_display_due_to_no_context')}</div>".html_safe
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => 403
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
.h1{
|
||||
font: 22px/1.5 'open sans','微軟正黑體',sans-serif;
|
||||
margin: 0 0 10px;
|
||||
padding: 0;
|
||||
}
|
||||
.info {
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
border: 1px solid #DDDDDD;
|
||||
font: 13px/1 'arial',sans-serif;
|
||||
margin: 0 0 20px;
|
||||
overflow: hidden;
|
||||
padding: 10px;
|
||||
}
|
||||
.info span {
|
||||
margin: 0 7px 0 0;
|
||||
border-right: 1px solid #ddd;
|
||||
padding: 0 10px 0 0;
|
||||
}
|
||||
.news_paragraph{
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
.linkAndFile{
|
||||
border-top: 1px solid #CCCCCC;
|
||||
border-left: 1px solid #CCCCCC;
|
||||
border-right: 1px solid #CCCCCC;
|
||||
border-radius: 5px 5px 0 0;
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
padding: 10px 10px 0 10px;
|
||||
}
|
||||
.fb{
|
||||
border-bottom : 1px solid #CCCCCC;
|
||||
border-left: 1px solid #CCCCCC;
|
||||
border-right: 1px solid #CCCCCC;
|
||||
border-radius: 0 0 5px 5px;
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
padding: 5px 10px 5px 10px;
|
||||
}
|
||||
.linkAndFile>div{
|
||||
border-bottom: 1px solid #CCCCCC;
|
||||
display: block;
|
||||
margin: 0 0 5px;
|
||||
overflow: hidden;
|
||||
padding: 0 0 5px;
|
||||
}
|
||||
.icons-link, .icons-paperclip{
|
||||
float: left;
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
.showLink, .showFile {
|
||||
float: left;
|
||||
}
|
||||
.showLink a, .showFile a{
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
.fb a{
|
||||
margin: 0 5px 0 0;
|
||||
}
|
||||
.showLink:before, .showFile:before {
|
||||
content: "●";
|
||||
margin: 0 10px 0 5px;
|
||||
color: #333;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1 class="h1"><%= @bulletin.title %></h1>
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
<span class="category"><%= t('announcement.categories') %> : <%= @bulletin.category.title rescue nil %></span>
|
||||
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
||||
<%
|
||||
unit_field = User.get_member_list_attribute_field("staff","unit")
|
||||
unit = User.get_member_list_attribute_value(@bulletin.create_user_id,unit_field.id).get_value_by_locale(I18n.locale) rescue nil
|
||||
%>
|
||||
<span><%= t('announcement.default_widget.bulletin_create_dept') + ": " + unit unless unit.blank? %></span>
|
||||
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_paragraph">
|
||||
<%= @bulletin.text.html_safe rescue '' %>
|
||||
</div>
|
||||
<div class="linkAndFile">
|
||||
<% if @bulletin.bulletin_links.size > 0 %>
|
||||
<div>
|
||||
<i class="icons-link"></i>
|
||||
<div class="showLink">
|
||||
<% @bulletin.bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @bulletin.bulletin_files.size > 0 %>
|
||||
<div>
|
||||
<i class="icons-paperclip"></i>
|
||||
<div class="showFile">
|
||||
<% @bulletin.bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= share_links(@bulletin, 'announcement') %>
|
|
@ -0,0 +1,103 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
<style type="text/css">
|
||||
th {
|
||||
background: #fff;
|
||||
border-bottom: 2px solid #333;
|
||||
padding: 10px 5px;
|
||||
font: 15px/1 '微軟正黑體',sans-serif;
|
||||
text-align: left;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
td {
|
||||
padding: 10px 5px;
|
||||
font: 13px/1.5 'arial',sans-serif;
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
tr{
|
||||
background: #fafafa
|
||||
}
|
||||
.odd{
|
||||
background: #fff;
|
||||
}
|
||||
td a {
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
}
|
||||
td a:hover {
|
||||
color: #000;
|
||||
}
|
||||
.pagination{
|
||||
margin: 10px 0;
|
||||
}
|
||||
.pagination ul{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.pagination li:first-child {
|
||||
border-radius: 5px 0 0 5px;
|
||||
}
|
||||
.pagination li {
|
||||
background: none repeat scroll 0 0 #FFFFFF !important;
|
||||
border: 1px solid #ccc;
|
||||
border-right: 0px solid #ccc;
|
||||
display: block;
|
||||
float: left;
|
||||
font: 13px/30px 'open sans',sans-serif !important;
|
||||
padding: 0 10px !important;
|
||||
}
|
||||
.pagination li:last-child {
|
||||
border-radius: 0 5px 5px 0;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
.pagination li a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
.pagination li a:hover {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Popup window code
|
||||
function newPopup(url) {
|
||||
popupWindow = window.open(
|
||||
url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
|
||||
}
|
||||
</script>
|
||||
|
||||
<table class="table table-bordered">
|
||||
|
||||
<tr>
|
||||
<th><%= t('announcement.categories') %></th>
|
||||
<th><%= t('announcement.default_widget.title') %></th>
|
||||
<th><%= t('announcement.default_widget.postdate') %></th>
|
||||
<th><%= t('announcement.default_widget.bulletin_create_dept') %></th>
|
||||
</tr>
|
||||
|
||||
<% @bulletins.each_with_index do |post, i| %>
|
||||
<tr <%= (i % 2 == 0) ? 'class=odd' : '' %>>
|
||||
<td><%= post.category.title rescue nil %></td>
|
||||
<td><a href="JavaScript:newPopup('<%= panel_announcement_widget_show_sync_data_path(post) %>');"><%= post.title %></a></td>
|
||||
<td><%= display_date(post.postdate) %></td>
|
||||
<%
|
||||
unit_field = User.get_member_list_attribute_field("staff","unit")
|
||||
unit = User.get_member_list_attribute_value(post.create_user_id,unit_field.id).get_value_by_locale(I18n.locale) rescue nil
|
||||
%>
|
||||
<td><%= unit %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
</table>
|
||||
|
||||
<%= paginate( @bulletins, :param_name => :page_main, :params => {:inner => 'false'} ) rescue nil if params[:show_page].blank? %>
|
||||
|
||||
|
|
@ -40,6 +40,8 @@ Rails.application.routes.draw do
|
|||
match "reload_web_links" => "bulletins#reload_web_links"
|
||||
match "bulletins_side_bar" => "bulletins#bulletins_side_bar"
|
||||
match "bulletins_search_block" => "bulletins#bulletins_search_block"
|
||||
match "sync_data" => "bulletins#sync_data",:as => :sync_data,:via => :get
|
||||
match "show_sync_data/:id" => "bulletins#show_sync_data",:as => :show_sync_data,:via => :get
|
||||
end
|
||||
namespace :api do
|
||||
get "categories_tags.json" => "bulletins#get_categories_tags"
|
||||
|
|
Loading…
Reference in New Issue