Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b88e53b62 | ||
|
|
b8464ae461 | ||
|
|
a357ce6669 | ||
|
|
be8d8ff1e6 | ||
|
|
f31481af18 | ||
|
|
829fc54a1d | ||
|
|
6ae35f3b94 |
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
|
# encoding: utf-8
|
||||||
class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController
|
class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :is_admin?
|
before_filter :is_admin?
|
||||||
@@ -15,6 +16,14 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
|||||||
@bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason])
|
@bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason])
|
||||||
@bulletin.de_pending
|
@bulletin.de_pending
|
||||||
if @bulletin.save
|
if @bulletin.save
|
||||||
|
|
||||||
|
if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
|
||||||
|
send_email_data(@bulletin)
|
||||||
|
|
||||||
|
@bulletin.email_sent = false
|
||||||
|
@bulletin.save
|
||||||
|
end
|
||||||
|
|
||||||
notice = t('announcement.approve_bulletin_success')
|
notice = t('announcement.approve_bulletin_success')
|
||||||
else
|
else
|
||||||
notice = t('announcement.approve_bulletin_fail')
|
notice = t('announcement.approve_bulletin_fail')
|
||||||
@@ -61,5 +70,44 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
|||||||
object_auth.privilege_users = privilege_users
|
object_auth.privilege_users = privilege_users
|
||||||
object_auth
|
object_auth
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_email_data(bulletin)
|
||||||
|
|
||||||
|
@site = Site.first
|
||||||
|
@user = User.find(bulletin.create_user_id)
|
||||||
|
@host = request.host_with_port
|
||||||
|
|
||||||
|
@group_mail = MailCron.get_send_group_mail( bulletin.email_user_ids , bulletin.other_mailaddress )
|
||||||
|
|
||||||
|
if !@group_mail.join.blank?
|
||||||
|
|
||||||
|
@mail_content = {
|
||||||
|
"host" => @host,
|
||||||
|
"lang" => I18n.locale,
|
||||||
|
"site_title" => @site.title,
|
||||||
|
"title" => bulletin.title,
|
||||||
|
"template" => 'announcement_mailer/cron_mail',
|
||||||
|
"url" => "http://#{@host}#{panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id)}"
|
||||||
|
}
|
||||||
|
|
||||||
|
@mail_cron = {
|
||||||
|
:mail_from_app => 'announcement',
|
||||||
|
# :mail_from => @user.email,
|
||||||
|
# :mail_reply_to => @user.email,
|
||||||
|
:mail_subject => "#{t("announcement.mail_subject",:site_title => @site.title)}:#{bulletin.title}",
|
||||||
|
:mail_to => @group_mail.join(','),
|
||||||
|
:mail_content => @mail_content ,
|
||||||
|
:mail_sentdate => bulletin.email_sentdate,
|
||||||
|
:create_user_id => bulletin.create_user_id,
|
||||||
|
:update_user_id => bulletin.create_user_id
|
||||||
|
}
|
||||||
|
|
||||||
|
@mail_cron = MailCron.new(@mail_cron)
|
||||||
|
|
||||||
|
@mail_cron.save
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -25,12 +25,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
@statuses = get_statuses
|
@statuses = get_statuses
|
||||||
category_ids = @categories.collect{|t| t.id}
|
category_ids = @categories.collect{|t| t.id}
|
||||||
|
|
||||||
if is_manager? or is_admin?
|
@bulletins = get_sorted_and_filtered("bulletin", :category_id.in => category_ids)
|
||||||
@bulletins = get_sorted_and_filtered("bulletin", :category_id.in => category_ids)
|
|
||||||
else
|
|
||||||
@bulletins = get_sorted_and_filtered("bulletin", {:category_id.in => category_ids, :create_user_id => current_user.id})
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.js { }
|
format.js { }
|
||||||
@@ -75,8 +70,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
@tags = get_tags
|
@tags = get_tags
|
||||||
is_authorized_sub_manager = @bulletin.category.auth_sub_manager.authorized_user_ids rescue nil
|
is_authorized_sub_manager = @bulletin.category.auth_sub_manager.authorized_user_ids rescue nil
|
||||||
|
|
||||||
if !(is_manager? || is_admin? || (is_authorized_sub_manager.include?(current_user.id) and @bulletin.create_user_id == current_user.id))
|
if !(is_manager? || is_admin? || is_authorized_sub_manager.include?(current_user.id))
|
||||||
|
|
||||||
redirect_to :action => :index
|
redirect_to :action => :index
|
||||||
else
|
else
|
||||||
# @summary_variable = @bulletin.summary_variable
|
# @summary_variable = @bulletin.summary_variable
|
||||||
@@ -100,23 +94,23 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
|
|
||||||
@bulletin.create_user_id = current_user.id
|
@bulletin.create_user_id = current_user.id
|
||||||
@bulletin.update_user_id = current_user.id
|
@bulletin.update_user_id = current_user.id
|
||||||
# if(is_manager? || is_admin?)
|
|
||||||
# @bulletin.is_checked = true
|
if(is_manager? || is_admin?)
|
||||||
# @bulletin.is_rejected = false
|
@bulletin.is_checked = true
|
||||||
# @bulletin.de_pending
|
@bulletin.is_rejected = false
|
||||||
# end
|
@bulletin.de_pending
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin.save
|
if @bulletin.save
|
||||||
|
|
||||||
if @bulletin.email_sent == true && (is_manager? || is_admin?)
|
if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
|
||||||
send_email_data(@bulletin)
|
send_email_data(@bulletin)
|
||||||
|
|
||||||
@bulletin.email_sent = false
|
@bulletin.email_sent = false
|
||||||
@bulletin.save
|
@bulletin.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) }
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) }
|
||||||
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
||||||
# format.js
|
# format.js
|
||||||
@@ -141,38 +135,44 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
# PUT /bulletins/1.xml
|
# PUT /bulletins/1.xml
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.find(params[:id])
|
||||||
|
|
||||||
params[:bulletin][:tag_ids] = (params[:bulletin][:tag_ids] ? params[:bulletin][:tag_ids] : [])
|
params[:bulletin][:tag_ids] = (params[:bulletin][:tag_ids] ? params[:bulletin][:tag_ids] : [])
|
||||||
|
|
||||||
params[:bulletin][:email_user_ids] = params[:bulletin][:email_user_ids].uniq
|
params[:bulletin][:email_user_ids] = params[:bulletin][:email_user_ids].uniq
|
||||||
params[:bulletin][:email_user_ids].delete('')
|
params[:bulletin][:email_user_ids].delete('')
|
||||||
|
|
||||||
params[:bulletin][:update_user_id] = current_user.id
|
params[:bulletin][:update_user_id] = current_user.id
|
||||||
|
|
||||||
delete_out_invalid_date_from_params
|
delete_out_invalid_date_from_params
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin.update_attributes(params[:bulletin])
|
if @bulletin.update_attributes(params[:bulletin])
|
||||||
|
|
||||||
if @bulletin.email_sent == true && (is_manager? || is_admin?)
|
if(is_manager? || is_admin?)
|
||||||
send_email_data(@bulletin)
|
@bulletin.is_checked = true
|
||||||
|
@bulletin.is_rejected = false
|
||||||
@bulletin.email_sent = false
|
@bulletin.de_pending!
|
||||||
@bulletin.save
|
|
||||||
end
|
|
||||||
|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
|
||||||
format.js { render 'toggle_enable' }
|
|
||||||
format.xml { head :ok }
|
|
||||||
else
|
|
||||||
@tags = get_tags
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
|
||||||
|
send_email_data(@bulletin)
|
||||||
|
|
||||||
|
@bulletin.email_sent = false
|
||||||
|
@bulletin.save
|
||||||
|
end
|
||||||
|
|
||||||
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
||||||
|
format.js { render 'toggle_enable' }
|
||||||
|
format.xml { head :ok }
|
||||||
|
else
|
||||||
|
@tags = get_tags
|
||||||
|
format.html { render :action => "edit" }
|
||||||
|
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# DELETE /bulletins/1
|
# DELETE /bulletins/1
|
||||||
# DELETE /bulletins/1.xml
|
# DELETE /bulletins/1.xml
|
||||||
def destroy
|
def destroy
|
||||||
|
|||||||
@@ -166,25 +166,5 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
|||||||
def bulletins_search_block
|
def bulletins_search_block
|
||||||
@part = PagePart.find params[:part_id]
|
@part = PagePart.find params[:part_id]
|
||||||
end
|
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
|
end
|
||||||
+41
-5
@@ -25,14 +25,25 @@ class Bulletin
|
|||||||
field :create_user_id
|
field :create_user_id
|
||||||
field :update_user_id, :class_name => "User"
|
field :update_user_id, :class_name => "User"
|
||||||
|
|
||||||
|
field :is_top, :type => Boolean, :default => false
|
||||||
|
field :is_hot, :type => Boolean, :default => false
|
||||||
|
field :is_hidden, :type => Boolean, :default => false
|
||||||
|
field :is_checked, :type => Boolean, :default => false
|
||||||
|
field :is_pending, :type => Boolean, :default => true
|
||||||
|
field :is_rejected, :type => Boolean, :default => false
|
||||||
field :view_count, :type => Integer, :default => 0
|
field :view_count, :type => Integer, :default => 0
|
||||||
|
|
||||||
|
field :not_checked_reason
|
||||||
|
|
||||||
field :public, :type => Boolean, :default => true
|
field :public, :type => Boolean, :default => true
|
||||||
|
|
||||||
field :email_sent, :type => Boolean, :default => false
|
field :email_sent, :type => Boolean, :default => false
|
||||||
field :email_sentdate , :type => DateTime
|
field :email_sentdate , :type => DateTime
|
||||||
field :email_user_ids
|
field :email_user_ids
|
||||||
field :other_mailaddress
|
field :other_mailaddress
|
||||||
|
|
||||||
|
scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false)
|
||||||
|
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||||
|
|
||||||
mount_uploader :image, ImageUploader
|
mount_uploader :image, ImageUploader
|
||||||
|
|
||||||
@@ -66,11 +77,6 @@ class Bulletin
|
|||||||
def bulletin_category_with_title
|
def bulletin_category_with_title
|
||||||
self.category.title
|
self.category.title
|
||||||
end
|
end
|
||||||
|
|
||||||
def bulletin_create_dept
|
|
||||||
unit_field = User.get_member_list_attribute_field("staff","unit")
|
|
||||||
User.get_member_list_attribute_value(self.create_user_id,unit_field.id).get_value_by_locale(I18n.locale) rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_bulletin_category
|
def get_bulletin_category
|
||||||
self.category
|
self.category
|
||||||
@@ -119,6 +125,36 @@ class Bulletin
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def proc_check(check,not_pass_info = "")
|
||||||
|
self.is_checked = true
|
||||||
|
if check =="true"
|
||||||
|
self.is_rejected = false
|
||||||
|
elsif check == "false"
|
||||||
|
self.is_rejected = true
|
||||||
|
self.not_checked_reason = not_pass_info
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def de_pending
|
||||||
|
self.is_pending = false
|
||||||
|
end
|
||||||
|
|
||||||
|
def de_pending!
|
||||||
|
de_pending
|
||||||
|
self.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_checked?
|
||||||
|
!self.is_pending && self.is_checked && (self.is_rejected == false)
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_pending?
|
||||||
|
self.is_pending
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_rejected?
|
||||||
|
!self.is_pending && self.is_rejected && (self.is_rejected == true)
|
||||||
|
end
|
||||||
|
|
||||||
def save_bulletin_links
|
def save_bulletin_links
|
||||||
self.bulletin_links.each do |t|
|
self.bulletin_links.each do |t|
|
||||||
|
|||||||
@@ -5,8 +5,18 @@
|
|||||||
<a class="close" data-dismiss="modal">×</a>
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
<h3><%= t(:preview) %></h3>
|
<h3><%= t(:preview) %></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body clearfix">
|
||||||
|
<div class="modal-left">
|
||||||
|
<%= label_tag t('announcement.email_to') %>
|
||||||
|
<% if @bulletin.email_sent == true and ( !@bulletin.email_user_ids.blank? || !@bulletin.other_mailaddress.blank? ) %>
|
||||||
|
|
||||||
|
<%= MailCron.get_send_group_mail(@bulletin.email_user_ids , @bulletin.other_mailaddress).join("<br />").html_safe %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-right">
|
||||||
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id ,:preview=>true) %>></iframe>
|
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id ,:preview=>true) %>></iframe>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
<%
|
<% set_default_index do
|
||||||
|
|
||||||
@unit_field = User.get_member_list_attribute_field("staff","unit")
|
|
||||||
|
|
||||||
set_default_index do
|
|
||||||
objects @bulletins
|
objects @bulletins
|
||||||
quick_edit_link type: 'edit',
|
quick_edit_link type: 'edit',
|
||||||
link: 'edit_panel_announcement_back_end_bulletin_path'
|
link: 'edit_panel_announcement_back_end_bulletin_path'
|
||||||
@@ -10,9 +6,9 @@
|
|||||||
quick_edit_link type: 'delete',
|
quick_edit_link type: 'delete',
|
||||||
link: 'panel_announcement_back_end_bulletin_path'
|
link: 'panel_announcement_back_end_bulletin_path'
|
||||||
# can have: title, warning, cancel and submit values
|
# can have: title, warning, cancel and submit values
|
||||||
# quick_edit_link type: 'approval',
|
quick_edit_link type: 'approval',
|
||||||
# link: 'panel_announcement_back_end_bulletin_approval_preview_path'
|
link: 'panel_announcement_back_end_bulletin_approval_preview_path'
|
||||||
# quick_edit_link type: 'reject_reason'
|
quick_edit_link type: 'reject_reason'
|
||||||
field type: 'status',
|
field type: 'status',
|
||||||
db_field: @statuses,
|
db_field: @statuses,
|
||||||
translation: 'status',
|
translation: 'status',
|
||||||
@@ -53,11 +49,6 @@
|
|||||||
translation: 'last_modified',
|
translation: 'last_modified',
|
||||||
hide: 'phone',
|
hide: 'phone',
|
||||||
sort: 'last_modified'
|
sort: 'last_modified'
|
||||||
field db_field: 'update_user_id',
|
|
||||||
translation: 'announcement.default_widget.bulletin_create_dept',
|
|
||||||
display_option: 'User.get_member_list_attribute_value(object.create_user_id,@unit_field.id).get_value_by_locale(I18n.locale) rescue nil',
|
|
||||||
sort: 'last_modified'
|
|
||||||
|
|
||||||
filter_field type: 'array',
|
filter_field type: 'array',
|
||||||
values: @statuses,
|
values: @statuses,
|
||||||
translation: 'status'
|
translation: 'status'
|
||||||
|
|||||||
@@ -4,11 +4,8 @@
|
|||||||
<div class="info1">
|
<div class="info1">
|
||||||
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
||||||
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
||||||
<%
|
<% unit = @bulletin.cache_dept[I18n.locale.to_s] rescue nil %>
|
||||||
unit_field = User.get_member_list_attribute_field("staff","unit")
|
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
|
||||||
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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="news_paragraph">
|
<div class="news_paragraph">
|
||||||
|
|||||||
@@ -1,110 +0,0 @@
|
|||||||
<% # 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') %>
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
<% # 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] == 'true' %>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +18,6 @@ en:
|
|||||||
postdate: Post Date
|
postdate: Post Date
|
||||||
subtitle: Subtitle
|
subtitle: Subtitle
|
||||||
title: Title
|
title: Title
|
||||||
bulletin_create_dept: Unit
|
|
||||||
editing_announcement: Edit Announcement
|
editing_announcement: Edit Announcement
|
||||||
editing_announcement_category: Edit Category
|
editing_announcement_category: Edit Category
|
||||||
file: Attachment
|
file: Attachment
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ zh_tw:
|
|||||||
postdate: 張貼日期
|
postdate: 張貼日期
|
||||||
subtitle: 副標題
|
subtitle: 副標題
|
||||||
title: 標題
|
title: 標題
|
||||||
bulletin_create_dept: 單位
|
|
||||||
editing_announcement: 編輯類別
|
editing_announcement: 編輯類別
|
||||||
editing_announcement_category: 編輯類別
|
editing_announcement_category: 編輯類別
|
||||||
error:
|
error:
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ Rails.application.routes.draw do
|
|||||||
match "reload_web_links" => "bulletins#reload_web_links"
|
match "reload_web_links" => "bulletins#reload_web_links"
|
||||||
match "bulletins_side_bar" => "bulletins#bulletins_side_bar"
|
match "bulletins_side_bar" => "bulletins#bulletins_side_bar"
|
||||||
match "bulletins_search_block" => "bulletins#bulletins_search_block"
|
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
|
end
|
||||||
namespace :api do
|
namespace :api do
|
||||||
get "categories_tags.json" => "bulletins#get_categories_tags"
|
get "categories_tags.json" => "bulletins#get_categories_tags"
|
||||||
|
|||||||
+2
-3
@@ -28,20 +28,19 @@ module Announcement
|
|||||||
data_count 1..10
|
data_count 1..10
|
||||||
|
|
||||||
authorizable
|
authorizable
|
||||||
# approvable
|
approvable
|
||||||
categorizable
|
categorizable
|
||||||
taggable
|
taggable
|
||||||
|
|
||||||
widgets do
|
widgets do
|
||||||
default_widget do
|
default_widget do
|
||||||
query 'Bulletin'
|
query 'Bulletin.can_display.available_for_lang(I18n.locale).any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
|
||||||
enable ["typeA", "typeB_style3", "typeC"]
|
enable ["typeA", "typeB_style3", "typeC"]
|
||||||
image :image
|
image :image
|
||||||
field :postdate
|
field :postdate
|
||||||
link_field :title,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self}
|
link_field :title,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self}
|
||||||
link_field :bulletin_category_with_title,{:method => 'panel_announcement_front_end_bulletins_path',:args=>{:category_id => [:category,:id]}}
|
link_field :bulletin_category_with_title,{:method => 'panel_announcement_front_end_bulletins_path',:args=>{:category_id => [:category,:id]}}
|
||||||
field :subtitle
|
field :subtitle
|
||||||
field :bulletin_create_dept
|
|
||||||
link_to_more 'panel_announcement_front_end_bulletins_path',:title_i18n=> 'more_plus'
|
link_to_more 'panel_announcement_front_end_bulletins_path',:title_i18n=> 'more_plus'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user