7 Commits
Author SHA1 Message Date
spen 41fc11e56a update default_widget field i18n 2014-05-12 11:19:08 +08:00
spen 528912ae3e fix widget reload_web_links 2014-05-08 14:13:21 +08:00
spen 543ec3a420 add backend form append note and fix show image 2014-05-08 10:45:12 +08:00
rulingcom 8f7df1cc35 fix search result page 2014-04-10 11:02:00 +08:00
spen 24ef9c848c Fix approval 2014-03-21 14:42:06 +08:00
spen d9dd08e678 add announcement widget field 2014-03-10 18:20:51 +08:00
Manson Wang bcb6a46a74 ntue 2014-02-19 11:14:25 +08:00
17 changed files with 330 additions and 196 deletions

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

@@ -1,83 +0,0 @@
# API for Announcement Module
#
# Simple access control
# params[:access_token] = Site ID
# ex: /panel/announcement/api/bulletins.json?access_token=5301d8be45d5f42f4f000001
#
# Set Language
# Language can be "zh_tw" or "en"
# ex: /panel/announcement/api/bulletins.json?lang=en&access_token=5301d8be45d5f42f4f000001
#
# Get Categories and Tags
# ex: /panel/announcement/api/categories_tags.json&access_token=5301d8be45d5f42f4f000001
#
# Query Bulletins
# Set page number use params[:page_num]
# Set number of results per page use params[:per_page]
# ex: /panel/announcement/api/bulletins.json?page_num=3&per_page=15&access_token=5301d8be45d5f42f4f000001
#
# Filter bulletins with categories use params[:categories]
# ex: /panel/announcement/api/bulletins.json?categories[]=53046e4045d5f462a2000006&access_token=5301d8be45d5f42f4f000001
#
# Filter bulletins with tags use params[:tags]
# ex: /panel/announcement/api/bulletins.json?tags[]=5318e58d45d5f41127000007&access_token=5301d8be45d5f42f4f000001
#
# Filter bulletins with "is_hot" use params[:is_hot]
# ex: /panel/announcement/api/bulletins.json?is_hot=1&access_token=5301d8be45d5f42f4f000001
#
# Search bulletin title, subtitle, text with params[:keyword]
# ex: /panel/announcement/api/bulletins.json?keyword=大學&access_token=5301d8be45d5f42f4f000001
class Panel::Announcement::Api::BulletinsController < OrbitWidgetController
before_filter :set_I18n, :check_site_id
def get_categories_tags
module_id = ModuleApp.where(:key=>"announcement").first.id
categories = Category.where(:module_app_id => module_id).collect{|c| {"id"=>c.id, "title"=>c.title_translations}}
module_tags = ModuleTag.where(:module_app_id => module_id).collect{|t| t.id}
tags = Tag.any_of({:tag_lease_id.in => module_tags}).collect{|t| {"id"=>t.id, "title"=>t.name_translations}}
render :json => {
"categories" => categories,
"tags" => tags
}
end
def get_bulletins
page_num = params[:page_num].blank? ? 0 : params[:page_num].to_i
per_page = params[:per_page].blank? ? 10 : params[:per_page].to_i
per_page = per_page > 0 ? per_page : 10
if !params[:keyword].blank?
keyword = Regexp.new(".*"+params[:keyword]+".*")
bulletins = Bulletin.any_of({:title=>keyword},{:subtitle=>keyword},{:text=>keyword}).available_for_lang(I18n.locale)
else
bulletins = Bulletin.available_for_lang(I18n.locale)
end
bulletins = bulletins.where(:is_hot => params[:is_hot]) if !params[:is_hot].blank?
bulletins = bulletins.where(:category_id.in => params[:categories]) if !params[:categories].blank?
bulletins = bulletins.where(:tagged_ids.in => params[:tags]) if !params[:tags].blank?
bulletins = bulletins.desc( :is_top, :postdate).page(page_num).per(per_page)
total_pages = (bulletins.count / per_page) + 1
render :json => {
"bulletins" => bulletins,
"bulletins_count" => bulletins.count,
"page_num" => page_num,
"total_pages" => total_pages,
"lang"=>I18n.locale
}
end
protected
def set_I18n
I18n.locale = params[:lang] if params[:lang].present?
end
def check_site_id
raise ActionController::RoutingError.new('Not Found') if Site.first.id.to_s != params['access_token']
end
end
@@ -1,3 +1,4 @@
# encoding: utf-8
class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController
before_filter :authenticate_user!
before_filter :is_admin?
@@ -6,6 +7,7 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
def preview_and_approve
email_group_data
@bulletin = Bulletin.find params[:bulletin_id]
end
@@ -15,6 +17,14 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
@bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason])
@bulletin.de_pending
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')
else
notice = t('announcement.approve_bulletin_fail')
@@ -61,5 +71,68 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
object_auth.privilege_users = privilege_users
object_auth
end
def send_email_data(bulletin)
@site = Site.first
@user = User.find(bulletin.create_user_id)
@host = request.host_with_port
email_group_data
@group_mail = Array.new
bulletin.email_group.each do |egroup|
if @email_group_data.include?(egroup) and (egroup == 'e_0' or egroup == 'e_1' or egroup == 'e_2' or egroup == 'e_3')
@group_mail << @email_group_data[egroup]["email"]
elsif @email_group_data.include?(egroup) and egroup == 'e_4'
@group_mail << bulletin.other_mailaddress
end
end
if !@group_mail.join.blank?
@mail_content = {
"host" => @host,
"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,
:mail_sentdate => DateTime.now,
:create_user_id => bulletin.create_user_id,
:update_user_id => bulletin.create_user_id
}
@mail_cron = MailCron.new(@mail_cron)
@mail_cron.save
MailCron.send_mail_now(@mail_cron.id)
end
end
def email_group_data
@email_group_data = Bulletin.email_group_data
end
end
@@ -1,4 +1,5 @@
# encoding: utf-8
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# include OrbitControllerLib::DivisionForDisable
@@ -20,6 +21,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def index
email_group_data
@tags = get_tags
@categories = get_categories_for_index
@statuses = get_statuses
@@ -48,8 +51,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# GET /bulletins/new
# GET /bulletins/new.xml
def new
email_group_data
if(session[:in_validate_object].blank?)
@bulletin = Bulletin.new(:postdate => DateTime.now, :email_sentdate => DateTime.now)
@bulletin = Bulletin.new(:postdate => DateTime.now)
else
@bulletin = session[:in_validate_object]
session[:in_validate_object] = {}
@@ -65,12 +71,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# GET /bulletins/1/edit
def edit
email_group_data
@bulletin = Bulletin.find(params[:id])
@email_users = @bulletin.get_email_users
@tags = get_tags
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))
if !(is_manager? || is_admin? || (is_authorized_sub_manager.include?(current_user.id) and @bulletin.create_user_id == current_user.id))
redirect_to :action => :index
else
# @summary_variable = @bulletin.summary_variable
@@ -84,33 +92,31 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# POST /bulletins
# POST /bulletins.xml
def create
email_group_data
@tags = get_tags
params[:bulletin][:email_user_ids] = params[:bulletin][:email_user_ids].uniq
params[:bulletin][:email_user_ids].delete('')
@bulletin = Bulletin.new(params[:bulletin])
@bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil)
@bulletin.create_user_id = current_user.id
@bulletin.update_user_id = current_user.id
# if(is_manager? || is_admin?)
# @bulletin.is_checked = true
# @bulletin.is_rejected = false
# @bulletin.de_pending
# end
if(is_manager? || is_admin?)
@bulletin.is_checked = true
@bulletin.is_rejected = false
@bulletin.de_pending
end
respond_to do |format|
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)
@bulletin.email_sent = false
@bulletin.save
end
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.js
@@ -135,24 +141,20 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# PUT /bulletins/1.xml
def update
@bulletin = Bulletin.find(params[:id])
params[:bulletin][:tag_ids] = (params[:bulletin][:tag_ids] ? params[:bulletin][:tag_ids] : [])
email_group_data
@bulletin = Bulletin.find(params[:id])
params[:bulletin][:email_user_ids] = params[:bulletin][:email_user_ids].uniq
params[:bulletin][:email_user_ids].delete('')
delete_out_invalid_date_from_params
respond_to do |format|
if @bulletin.update_attributes(params[:bulletin])
if @bulletin.email_sent == true && (is_manager? || is_admin?)
send_email_data(@bulletin)
@bulletin.email_sent = false
@bulletin.save
end
params[:bulletin][:update_user_id] = current_user.id
delete_out_invalid_date_from_params
respond_to do |format|
if @bulletin.update_attributes(params[:bulletin])
if(is_manager? || is_admin?)
@bulletin.is_checked = true
@bulletin.is_rejected = false
@bulletin.de_pending!
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 }
@@ -161,10 +163,27 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
format.html { render :action => "edit" }
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
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
# DELETE /bulletins/1
# DELETE /bulletins/1.xml
def destroy
@@ -196,13 +215,28 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@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 )
email_group_data
@group_mail = Array.new
bulletin.email_group.each do |egroup|
if @email_group_data.include?(egroup) and (egroup == 'e_0' or egroup == 'e_1' or egroup == 'e_2' or egroup == 'e_3')
@group_mail << @email_group_data[egroup]["email"]
elsif @email_group_data.include?(egroup) and egroup == 'e_4'
@group_mail << bulletin.other_mailaddress
end
end
if !@group_mail.join.blank?
@mail_content = {
"host" => @host,
"lang" => I18n.locale,
"site_title" => @site.title,
"title" => bulletin.title,
"template" => 'announcement_mailer/cron_mail',
@@ -211,12 +245,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@mail_cron = {
:mail_from_app => 'announcement',
# :mail_from => @user.email,
# :mail_reply_to => @user.email,
:mail_from => @user.email,
:mail_reply_to => @user.email,
:mail_subject => "#{t("announcement.mail_subject")}:",
: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,
# :mail_sentdate => bulletin.email_sentdate,
:mail_sentdate => DateTime.now,
:create_user_id => bulletin.create_user_id,
:update_user_id => bulletin.create_user_id
}
@@ -225,9 +261,17 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@mail_cron.save
MailCron.send_mail_now(@mail_cron.id)
end
end
end
def email_group_data
@email_group_data = Bulletin.email_group_data
end
def delete_out_invalid_date_from_params
if((params[:bulletin]["deadline(1i)"] && params[:bulletin]["deadline(1i)"].blank?) or (params[:bulletin]["deadline(2i)"] && params[:bulletin]["deadline(2i)"].blank?) or (params[:bulletin]["deadline(3i)"] && params[:bulletin]["deadline(3i)"].blank?))
@@ -55,7 +55,6 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
def show
@item = Page.find(params[:page_id]) rescue nil
@fb_share = eval(params[:facebook_share]) rescue false
if params[:preview] == "true"
preview_content
else
@@ -146,7 +146,15 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
@selected_tag = Tag.find(params[:tag_id]).first
@ModuleApp = ModuleApp.first(:conditions => {:key=>'web_resource'})
@link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :module_tag_id => @ModuleApp.id})
@link_module_tag = ModuleTag.first(:conditions => {:name => @selected_tag.name, :module_app_id => @ModuleApp.id})
# @link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :tag_lease_id => @ModuleApp.id})
if !@link_module_tag.blank?
@link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :tag_lease_id => @link_module_tag.id})
else
@link_selected_tag = @link_module_tag
end
@web_links = WebLink.where(:tagged_ids => @link_selected_tag.id.to_s, :is_hidden => false).desc(:is_top,:created_at).available_for_lang(I18n.locale).page(params[:page]).per(@page_num) rescue nil
end
+85 -3
View File
@@ -25,14 +25,25 @@ class Bulletin
field :create_user_id
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 :not_checked_reason
field :public, :type => Boolean, :default => true
field :email_sent, :type => Boolean, :default => false
field :email_sentdate , :type => DateTime
field :email_user_ids
field :email_group, :type => Array
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
@@ -66,6 +77,11 @@ class Bulletin
def bulletin_category_with_title
self.category.title
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
self.category
@@ -114,6 +130,37 @@ class Bulletin
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
self.bulletin_links.each do |t|
@@ -154,12 +201,47 @@ class Bulletin
preview_object
end
def get_email_users
User.find(self.email_user_ids) rescue []
def get_email_group_data(email_group_data)
group_mail = Array.new
self.email_group.each do |egroup|
if email_group_data.include?(egroup) and (egroup == 'e_0' or egroup == 'e_1' or egroup == 'e_2' or egroup == 'e_3')
group_mail << "#{email_group_data[egroup]["email"]}(#{email_group_data[egroup]["name"]})"
elsif email_group_data.include?(egroup) and egroup == 'e_4'
self.other_mailaddress.split(",").each do |otmail|
group_mail << "#{otmail}(#{email_group_data[egroup]["name"]})"
end
end
end
group_mail.join("<br />").html_safe
end
protected
def self.email_group_data
@email_group_data = {
'e_0'=> {"name"=>I18n.t('announcement.email_group_data_0'), "email"=>"alluser@tea.ntue.edu.tw"},
'e_1'=> {"name"=>I18n.t('announcement.email_group_data_1'), "email"=>"allstu@tea.ntue.edu.tw"},
'e_2'=> {"name"=>I18n.t('announcement.email_group_data_2'), "email"=>"allgrad@tea.ntue.edu.tw"},
'e_3'=> {"name"=>I18n.t('announcement.email_group_data_3'), "email"=>"allad@tea.ntue.edu.tw"},
'e_4'=> {"name"=>I18n.t('announcement.email_group_data_4')}
}
end
# def clean_values
# self.bulletin_links.each do |link|
# link.delete if link.url.blank? && link.title.blank?
@@ -1,7 +1,4 @@
<% # encoding: utf-8 %>
<% I18n.locale = @data.mail_content["lang"] %>
<!DOCTYPE html>
<html>
<head>
@@ -5,8 +5,18 @@
<a class="close" data-dismiss="modal">×</a>
<h3><%= t(:preview) %></h3>
</div>
<div class="modal-body">
<div class="modal-body clearfix">
<div class="modal-left">
<% if !@bulletin.email_group.blank? %>
<%= label_tag 'group_mail' %>
<%= @bulletin.get_email_group_data(@email_group_data) %>
<% end %>
</div>
<div class="modal-right">
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id ,:preview=>true) %>></iframe>
</div>
</div>
<div class="modal-footer">
@@ -9,8 +9,7 @@
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/modal-preview" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<%= javascript_include_tag "member-selection" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<%= f.error_messages %>
@@ -33,11 +32,11 @@
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
</li>
<li>
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
<a href="#imageupload" data-toggle="tab"><%= t("announcement.image") %></a>
</li>
<li>
<a href="#mail-group" data-toggle="tab"><%= t('announcement.email_reminder')%></a>
</li>
</li>
</ul>
<!-- Module -->
@@ -104,6 +103,7 @@
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @bulletin.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'bulletin[tag_ids][]', '' %>
</label>
<% end %>
</div>
@@ -116,14 +116,14 @@
<!-- Images Upload -->
<div class="control-group">
<label class="control-label muted"><%= t(:image) %></label>
<label class="control-label muted"><%= t("announcement.image") %></label>
<div class="controls">
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @bulletin.image.file %>" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left">
<% if @bulletin.image.file %>
<%= image_tag @bulletin.image %>
<% else %>
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
<img src="http://www.placehold.it/290x230/EFEFEF/AAAAAA" />
<% end %>
</div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
@@ -138,6 +138,14 @@
<%= f.check_box :remove_image %><%= t(:remove) %>
</label>
</div>
<br />
<span>
<%= t("ad.widget_info_for_ad_image_size", :best_size=> "290px(w) x 230px(h)") %>
<br />
<%= t("announcement.image_upload_size_note", :image_upload_size =>'900kb') %>
<br />
<%= t("announcement.image_note")%>
</span>
</div>
</div>
</div>
@@ -149,17 +157,24 @@
<!-- Mail Group -->
<div class="control-group">
<label class="control-label muted"><%= t("announcement.email_to") %></label>
<label class="control-label muted"><%= t("announcement.email_group") %></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag('bulletin[email_sent]', '1', (!@bulletin.email_sent.blank? ? true : false), :id=>'remind-check') %><%= t('announcement.activate_email_reminder')%>
<%= check_box_tag('bulletin[email_sent]', '1', (!@bulletin.email_sent.blank? ? true : false), :id=>'remind-check') %><%= t('announcement.activate_email_eminder')%>
</label>
<div class="content-box">
<p>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'bulletin[email_user_ids][]', users: @email_users} %>
</p>
<% @email_group_data.collect do |k,v| %>
<label class="checkbox inline">
<%= check_box_tag 'bulletin[email_group][]', k, (@bulletin.email_group.nil? ? false : @bulletin.email_group.include?(k)), :id => "field-#{k}" %> <%= v["name"] %>
<%= hidden_field_tag 'bulletin[email_group][]', '' %>
</label>
<% end if !@email_group_data.blank? %>
</div>
</div>
</div>
@@ -171,15 +186,6 @@
<%= f.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
</div>
</div>
</div>
<div class="content-box">
<div class="control-group">
<label class="control-label muted"><%= t("announcement.email_sentdate") %></label>
<div class="controls">
<%= f.datetime_picker :email_sentdate, :no_label => true %>
</div>
</div>
</div>
</div>
@@ -241,6 +247,10 @@
<% end %>
<div class="control-group">
<div class="controls add-input"><%= t('announcement.append_note')%></div>
</div>
<!-- Link -->
<div class="control-group">
<label class="control-label muted"><%= t(:link) %></label>
@@ -350,7 +360,6 @@
$('#remind-check').on('change', function() {
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
})
});
</script>
<% end %>
@@ -6,9 +6,9 @@
quick_edit_link type: 'delete',
link: 'panel_announcement_back_end_bulletin_path'
# can have: title, warning, cancel and submit values
# quick_edit_link type: 'approval',
# link: 'panel_announcement_back_end_bulletin_approval_preview_path'
# quick_edit_link type: 'reject_reason'
quick_edit_link type: 'approval',
link: 'panel_announcement_back_end_bulletin_approval_preview_path'
quick_edit_link type: 'reject_reason'
field type: 'status',
db_field: @statuses,
translation: 'status',
@@ -37,11 +37,6 @@
field type: 'tags',
hide: 'all',
sort: 'tags'
field db_field: 'email_user_ids',
hide: 'all',
translation: 'announcement.email_to',
display_option: '"<br />#{MailCron.get_send_group_mail(object.email_user_ids , object.other_mailaddress).join(", ").html_safe}"',
sort: 'email_user_ids'
field type: 'id',
db_field: 'update_user_id',
model: User,
@@ -32,3 +32,4 @@
</table>
<%= paginate( @bulletins, :param_name => :page_main, :params => {:inner => 'false'} ) rescue nil%>
@@ -4,14 +4,13 @@
<div class="info1">
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
<% unit = @bulletin.cache_dept[I18n.locale.to_s] rescue nil %>
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></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>
</div>
</div>
<div class="news_image">
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
<%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %>
</div>
<div class="news_paragraph">
<%= @bulletin.text.html_safe rescue '' %>
</div>
@@ -38,20 +37,4 @@
<% end %>
</div>
<%#= share_links(@bulletin, 'announcement') %>
<% if @fb_share %>
<a href="" target="_blank" class="fb-share-button">
<%= image_tag("announcement/fbn.png",:width=>30, :height=>30) %>
</a>
<script type="text/javascript">
(function(){
$(".fb-share-button").click(function(){
var img = window.location.protocol + "//" + window.location.host + "<%= @bulletin.image.url rescue '' %>",
url = "https://www.facebook.com/sharer/sharer.php?s=100&p[title]=<%= @bulletin.title %>&p[images][0]=" + img + "&p[url]="+window.location.href;
newwindow = window.open(url,'name','height=500,width=1024');
if (window.focus) {newwindow.focus()}
return false;
})
})();
</script>
<% end %>
<%= share_links(@bulletin, 'announcement') %>
+14 -4
View File
@@ -4,6 +4,7 @@ en:
add_new: Add New
all_articles: All Articles
announcement: Announcement
append_note: Suggest to input underside Link and File's annotation to show correct info in frontend
approval_setting: Approval Setting
approve_bulletin_fail: Approval Fail
approve_bulletin_success: Approve Successfully
@@ -13,10 +14,11 @@ en:
create_bulletin_category_success: Create Category Successfully
date: Announcement Date
default_widget:
bulletin_category_with_title: Bulletin Category with Title
bulletin_category_with_title: Category
postdate: Post Date
subtitle: Subtitle
title: Title
bulletin_create_dept: Unit
editing_announcement: Edit Announcement
editing_announcement_category: Edit Category
file: Attachment
@@ -25,6 +27,8 @@ en:
frontend:
bulletins: Announcement front-end
search_result: Search result
image: Cover image
image_note: The image will not show in content
link_name: Link Name
new_bulletin_category: New Bulletin Category
picture: Cover Picture
@@ -37,10 +41,16 @@ en:
index: Index
search: Search
email_reminder: Email Reminder
activate_email_reminder: Activate Email Reminder
activate_email_eminder: Activate Email Reminder
email_sentdate: Email Time
email_to: Email To
mail_subject: this is an announcement reminder from【%{site_title}】
email_group: Email Group
email_group_data_0: All Faculty
email_group_data_1: Undergraduates
email_group_data_2: Postgraduates
email_group_data_3: Continuing Ed. Postgraduates
email_group_data_4: Other
# mail_subject: this is an announcement reminder from【%{site_title}】
mail_subject: 【北教大公告提醒】
other_mailaddress: Other Email
other_mailaddress_note: Divide different email accounts with ","
mail_hi: Hi
+14 -4
View File
@@ -4,6 +4,7 @@ zh_tw:
add_new: 新建
all_articles: 文章列表
announcement: 公告
append_note: 以下之附加連結與檔案,為使前台顯示名稱,建議您輸入註解。
approval_setting: 審核設定
approve_bulletin_fail: 審核失敗
approve_bulletin_success: 審核成功
@@ -13,10 +14,11 @@ zh_tw:
create_bulletin_category_success: 建立類別成功
date: 起迄日期
default_widget:
bulletin_category_with_title: 公告類別及標題
bulletin_category_with_title: 類別
postdate: 張貼日期
subtitle: 副標題
title: 標題
bulletin_create_dept: 單位
editing_announcement: 編輯類別
editing_announcement_category: 編輯類別
error:
@@ -27,6 +29,8 @@ zh_tw:
frontend:
bulletins: 公告前台
search_result: 搜尋結果頁
image: 封面圖片
image_note: 此處上傳的圖片不會在公告內文出現
link_name: 連結名稱
new_bulletin_category: 新增公告類別
picture: 刊頭圖片
@@ -40,12 +44,18 @@ zh_tw:
search: 搜尋
more: 更多+
email_reminder: 寄送提醒
activate_email_reminder: 開啟寄送提醒
activate_email_eminder: 開啟寄送提醒
email_sentdate: 寄送時間
email_to: 寄送對象
email_group: 寄送群組
other_mailaddress: 其他Mail
other_mailaddress_note: 輸入多組mail時,請用","逗號隔開
mail_subject: 來自【%{site_title}】的公告事件提醒
email_group_data_0: 全校教職員
email_group_data_1: 大學部學生
email_group_data_2: 日間部研究生
email_group_data_3: 進修部研究生
email_group_data_4: 其他
# mail_subject: 來自【%{site_title}】的公告事件提醒
mail_subject: 【北教大公告提醒】
mail_hi: 您好
mail_url_view: 此封信件為公告事件提醒,請點選以下連結詳細觀看
mail_source: 來源
-4
View File
@@ -41,10 +41,6 @@ Rails.application.routes.draw do
match "bulletins_side_bar" => "bulletins#bulletins_side_bar"
match "bulletins_search_block" => "bulletins#bulletins_search_block"
end
namespace :api do
get "categories_tags.json" => "bulletins#get_categories_tags"
get "bulletins.json" => "bulletins#get_bulletins"
end
end
end
end
+4 -4
View File
@@ -28,20 +28,20 @@ module Announcement
data_count 1..10
authorizable
# approvable
approvable
categorizable
taggable
widgets 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"]
image :image
field :postdate
facebook_enabled false
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]}}
field :subtitle
link_field :subtitle,{:method => 'panel_announcement_front_end_bulletin_path',:args=>:self,:preview=>true}
field :bulletin_create_dept
link_to_more 'panel_announcement_front_end_bulletins_path',:title_i18n=> 'more_plus'
end