Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b2eb0e90c | ||
|
|
bbda5bcfac | ||
|
|
67640e0fc4 | ||
|
|
89a472ffb6 | ||
|
|
b14218e312 | ||
|
|
7193e2efb4 | ||
|
|
45d9bbc342 | ||
|
|
5bab384195 | ||
|
|
cfda9365ab | ||
|
|
f38985bb34 | ||
|
|
dc3a44d181 | ||
|
|
592692eefd | ||
|
|
c10800acd7 | ||
|
|
c96646844a | ||
|
|
5efebe2ab2 | ||
|
|
60dce13fd8 | ||
|
|
16aacf3d2a | ||
|
|
0e5909c1f5 | ||
|
|
758ceaf5e3 | ||
|
|
1dfa7e91ee | ||
|
|
caad66cfb8 | ||
|
|
781a49750e | ||
|
|
0af4fb0502 | ||
|
|
62fbcee0f0 | ||
|
|
8306511819 | ||
|
|
beac76f29a | ||
|
|
725bfcac5a | ||
|
|
c9dd3cb9eb | ||
|
|
c0473a3f13 | ||
|
|
0587c118d1 |
No files matched your search
+3
-1
@@ -1,3 +1,5 @@
|
|||||||
= Announcement
|
= Announcement
|
||||||
|
|
||||||
This project rocks and uses MIT-LICENSE.
|
This project rocks and uses MIT-LICENSE.
|
||||||
|
* Tagging
|
||||||
|
* Categories
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -0,0 +1,83 @@
|
|||||||
|
# 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::BulletinsController < OrbitBackendController
|
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
# include OrbitControllerLib::DivisionForDisable
|
# include OrbitControllerLib::DivisionForDisable
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
# GET /bulletins/new.xml
|
# GET /bulletins/new.xml
|
||||||
def new
|
def new
|
||||||
if(session[:in_validate_object].blank?)
|
if(session[:in_validate_object].blank?)
|
||||||
@bulletin = Bulletin.new(:postdate => DateTime.now)
|
@bulletin = Bulletin.new(:postdate => DateTime.now, :email_sentdate => DateTime.now)
|
||||||
else
|
else
|
||||||
@bulletin = session[:in_validate_object]
|
@bulletin = session[:in_validate_object]
|
||||||
session[:in_validate_object] = {}
|
session[:in_validate_object] = {}
|
||||||
@@ -65,6 +66,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
# GET /bulletins/1/edit
|
# GET /bulletins/1/edit
|
||||||
def edit
|
def edit
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.find(params[:id])
|
||||||
|
@email_users = @bulletin.get_email_users
|
||||||
@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
|
||||||
|
|
||||||
@@ -83,6 +85,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
# POST /bulletins.xml
|
# POST /bulletins.xml
|
||||||
def create
|
def create
|
||||||
@tags = get_tags
|
@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 = Bulletin.new(params[:bulletin])
|
||||||
@bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
@bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
||||||
|
|
||||||
@@ -97,6 +103,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin.save
|
if @bulletin.save
|
||||||
|
|
||||||
|
if @bulletin.email_sent == true && (is_manager? || is_admin?)
|
||||||
|
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.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
|
||||||
@@ -123,10 +137,24 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
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][:email_user_ids] = params[:bulletin][:email_user_ids].uniq
|
||||||
|
params[:bulletin][:email_user_ids].delete('')
|
||||||
|
|
||||||
|
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?)
|
||||||
|
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.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
||||||
format.js { render 'toggle_enable' }
|
format.js { render 'toggle_enable' }
|
||||||
format.xml { head :ok }
|
format.xml { head :ok }
|
||||||
@@ -164,6 +192,45 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
def delete_out_invalid_date_from_params
|
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?))
|
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?))
|
||||||
params[:bulletin].delete("deadline(1i)")
|
params[:bulletin].delete("deadline(1i)")
|
||||||
|
|||||||
@@ -12,8 +12,13 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
|||||||
if params[:search_query] == ""
|
if params[:search_query] == ""
|
||||||
@bulletins = get_bulletins_for_index
|
@bulletins = get_bulletins_for_index
|
||||||
else
|
else
|
||||||
@search = Bulletin.tire.search "#{params[:search_query]}"
|
key_string = params[:search_query]
|
||||||
search_result = @search.collect{|result| result.id}
|
keywords = key_string.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
||||||
|
regex = Regexp.union(keywords.map{|word| Regexp.new(".*"+word+".*", "i")})
|
||||||
|
|
||||||
|
query = ["title","subtitle","text"].map{|f| {f.to_sym => regex} }
|
||||||
|
res = Bulletin.any_of(query)
|
||||||
|
search_result = res.collect{|result| result.id}
|
||||||
|
|
||||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num)
|
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -146,7 +146,15 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
|||||||
|
|
||||||
@selected_tag = Tag.find(params[:tag_id]).first
|
@selected_tag = Tag.find(params[:tag_id]).first
|
||||||
@ModuleApp = ModuleApp.first(:conditions => {:key=>'web_resource'})
|
@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
|
@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
|
end
|
||||||
|
|
||||||
|
|||||||
+14
-5
@@ -13,8 +13,8 @@ class Bulletin
|
|||||||
include OrbitModel::TimeFrame
|
include OrbitModel::TimeFrame
|
||||||
include OrbitTag::Taggable
|
include OrbitTag::Taggable
|
||||||
|
|
||||||
include Tire::Model::Search
|
# include Tire::Model::Search
|
||||||
include Tire::Model::Callbacks
|
# include Tire::Model::Callbacks
|
||||||
|
|
||||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||||
|
|
||||||
@@ -28,6 +28,12 @@ class Bulletin
|
|||||||
field :view_count, :type => Integer, :default => 0
|
field :view_count, :type => Integer, :default => 0
|
||||||
|
|
||||||
field :public, :type => Boolean, :default => true
|
field :public, :type => Boolean, :default => true
|
||||||
|
field :rss_link
|
||||||
|
|
||||||
|
field :email_sent, :type => Boolean, :default => false
|
||||||
|
field :email_sentdate , :type => DateTime
|
||||||
|
field :email_user_ids
|
||||||
|
field :other_mailaddress
|
||||||
|
|
||||||
mount_uploader :image, ImageUploader
|
mount_uploader :image, ImageUploader
|
||||||
|
|
||||||
@@ -39,9 +45,9 @@ class Bulletin
|
|||||||
|
|
||||||
validates :title, :at_least_one => true
|
validates :title, :at_least_one => true
|
||||||
|
|
||||||
def to_indexed_json
|
# def to_indexed_json
|
||||||
self.to_json
|
# self.to_json
|
||||||
end
|
# end
|
||||||
|
|
||||||
# search_in :title, :subtitle, :text
|
# search_in :title, :subtitle, :text
|
||||||
|
|
||||||
@@ -149,6 +155,9 @@ class Bulletin
|
|||||||
preview_object
|
preview_object
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_email_users
|
||||||
|
User.find(self.email_user_ids) rescue []
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
|
<% I18n.locale = @data.mail_content["lang"] %>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||||
|
</head>
|
||||||
|
<body bgcolor="#FFFFFF">
|
||||||
|
<div style="text-ident:20px">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= t('announcement.mail_hi') %> <br /><br />
|
||||||
|
<%= t('announcement.mail_url_view') %> <br /><br />
|
||||||
|
<a href="<%= @data.mail_content["url"] %>" target="_blank"> <%= @data.mail_content["title"] %> </a> <br /><br />
|
||||||
|
</div>
|
||||||
|
<span style="color:#555">--<br />
|
||||||
|
<%= t('announcement.mail_source') %> :<a href="http://<%= @data.mail_content["host"] %>" target="_blank"> <%= @data.mail_content["site_title"] %> </a><br />
|
||||||
|
<%= t('announcement.mail_time') %> <%= DateTime.now %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -9,7 +9,8 @@
|
|||||||
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||||
<%= javascript_include_tag "lib/modal-preview" %>
|
<%= javascript_include_tag "lib/modal-preview" %>
|
||||||
<%= javascript_include_tag "lib/file-type" %>
|
<%= javascript_include_tag "lib/file-type" %>
|
||||||
<%= javascript_include_tag "lib/module-area" %>
|
<%= javascript_include_tag "lib/module-area" %>
|
||||||
|
<%= javascript_include_tag "member-selection" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
@@ -32,8 +33,11 @@
|
|||||||
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
|
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
<a href="#imageupload" data-toggle="tab"><%= t("announcement.image") %></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#mail-group" data-toggle="tab"><%= t('announcement.email_reminder')%></a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- Module -->
|
<!-- Module -->
|
||||||
@@ -100,7 +104,6 @@
|
|||||||
<% @tags.each do |tag| %>
|
<% @tags.each do |tag| %>
|
||||||
<label class="checkbox inline btn <%= 'active' if @bulletin.tag_ids.include?(tag.id) %>">
|
<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 %>
|
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id) %> <%= tag.name %>
|
||||||
<%= hidden_field_tag 'bulletin[tag_ids][]', '' %>
|
|
||||||
</label>
|
</label>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -113,7 +116,7 @@
|
|||||||
|
|
||||||
<!-- Images Upload -->
|
<!-- Images Upload -->
|
||||||
<div class="control-group">
|
<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="controls">
|
||||||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @bulletin.image.file %>" data-provides="fileupload">
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @bulletin.image.file %>" data-provides="fileupload">
|
||||||
<div class="fileupload-new thumbnail pull-left">
|
<div class="fileupload-new thumbnail pull-left">
|
||||||
@@ -136,11 +139,52 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="image_note"><%= t("announcement.image_note")%></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Mail Group Module -->
|
||||||
|
<div class="tab-pane fade" id="mail-group">
|
||||||
|
|
||||||
|
<!-- Mail Group -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("announcement.email_to") %></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')%>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="content-box">
|
||||||
|
<p>
|
||||||
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'bulletin[email_user_ids][]', users: @email_users} %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"></label>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="content-box">
|
||||||
|
<span class="help-block"><%= "#{t("announcement.other_mailaddress")}(#{t("announcement.other_mailaddress_note")})"%> </span>
|
||||||
|
<%= 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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Language Tabs -->
|
<!-- Language Tabs -->
|
||||||
@@ -198,6 +242,10 @@
|
|||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls add-input"><%= t('announcement.append_note')%></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Link -->
|
<!-- Link -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t(:link) %></label>
|
<label class="control-label muted"><%= t(:link) %></label>
|
||||||
@@ -302,6 +350,12 @@
|
|||||||
$(this).parents('.start-line').hide();
|
$(this).parents('.start-line').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
|
||||||
|
$('#remind-check').on('change', function() {
|
||||||
|
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -37,6 +37,11 @@
|
|||||||
field type: 'tags',
|
field type: 'tags',
|
||||||
hide: 'all',
|
hide: 'all',
|
||||||
sort: 'tags'
|
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',
|
field type: 'id',
|
||||||
db_field: 'update_user_id',
|
db_field: 'update_user_id',
|
||||||
model: User,
|
model: User,
|
||||||
|
|||||||
@@ -32,3 +32,4 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<%= paginate( @bulletins, :param_name => :page_main, :params => {:inner => 'false'} ) rescue nil%>
|
||||||
@@ -8,10 +8,6 @@
|
|||||||
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
|
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="news_paragraph">
|
||||||
<%= @bulletin.text.html_safe rescue '' %>
|
<%= @bulletin.text.html_safe rescue '' %>
|
||||||
</div>
|
</div>
|
||||||
@@ -36,6 +32,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% unless @bulletin.rss_link.blank? %>
|
||||||
|
<div>
|
||||||
|
<%= link_to t('ntu.rss_origin'), @bulletin.rss_link %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= share_links(@bulletin, 'announcement') %>
|
<%= share_links(@bulletin, 'announcement') %>
|
||||||
+16
-1
@@ -4,6 +4,7 @@ en:
|
|||||||
add_new: Add New
|
add_new: Add New
|
||||||
all_articles: All Articles
|
all_articles: All Articles
|
||||||
announcement: Announcement
|
announcement: Announcement
|
||||||
|
append_note: Suggest to input underside Link and File's annotation to show correct info in frontend
|
||||||
approval_setting: Approval Setting
|
approval_setting: Approval Setting
|
||||||
approve_bulletin_fail: Approval Fail
|
approve_bulletin_fail: Approval Fail
|
||||||
approve_bulletin_success: Approve Successfully
|
approve_bulletin_success: Approve Successfully
|
||||||
@@ -13,7 +14,7 @@ en:
|
|||||||
create_bulletin_category_success: Create Category Successfully
|
create_bulletin_category_success: Create Category Successfully
|
||||||
date: Announcement Date
|
date: Announcement Date
|
||||||
default_widget:
|
default_widget:
|
||||||
bulletin_category_with_title: Bulletin Category with Title
|
bulletin_category_with_title: Category
|
||||||
postdate: Post Date
|
postdate: Post Date
|
||||||
subtitle: Subtitle
|
subtitle: Subtitle
|
||||||
title: Title
|
title: Title
|
||||||
@@ -25,6 +26,8 @@ en:
|
|||||||
frontend:
|
frontend:
|
||||||
bulletins: Announcement front-end
|
bulletins: Announcement front-end
|
||||||
search_result: Search result
|
search_result: Search result
|
||||||
|
image: Cover image
|
||||||
|
image_note: The image will not show in content
|
||||||
link_name: Link Name
|
link_name: Link Name
|
||||||
new_bulletin_category: New Bulletin Category
|
new_bulletin_category: New Bulletin Category
|
||||||
picture: Cover Picture
|
picture: Cover Picture
|
||||||
@@ -36,3 +39,15 @@ en:
|
|||||||
bulletins_and_web_links: Differential Nav.
|
bulletins_and_web_links: Differential Nav.
|
||||||
index: Index
|
index: Index
|
||||||
search: Search
|
search: Search
|
||||||
|
email_reminder: Email Reminder
|
||||||
|
activate_email_reminder: Activate Email Reminder
|
||||||
|
email_sentdate: Email Time
|
||||||
|
email_to: Email To
|
||||||
|
mail_subject: this is an announcement reminder from【%{site_title}】
|
||||||
|
other_mailaddress: Other Email
|
||||||
|
other_mailaddress_note: Divide different email accounts with ","
|
||||||
|
mail_hi: Hi
|
||||||
|
mail_url_view: This email is the reminder of an announcement, please click the link for the details
|
||||||
|
mail_source: Source
|
||||||
|
mail_time: Time
|
||||||
|
image_upload_size_note: The following recommendations %{image_upload_size} upload size
|
||||||
@@ -4,6 +4,7 @@ zh_tw:
|
|||||||
add_new: 新建
|
add_new: 新建
|
||||||
all_articles: 文章列表
|
all_articles: 文章列表
|
||||||
announcement: 公告
|
announcement: 公告
|
||||||
|
append_note: 以下之附加連結與檔案,為使前台顯示名稱,建議您輸入註解。
|
||||||
approval_setting: 審核設定
|
approval_setting: 審核設定
|
||||||
approve_bulletin_fail: 審核失敗
|
approve_bulletin_fail: 審核失敗
|
||||||
approve_bulletin_success: 審核成功
|
approve_bulletin_success: 審核成功
|
||||||
@@ -13,7 +14,7 @@ zh_tw:
|
|||||||
create_bulletin_category_success: 建立類別成功
|
create_bulletin_category_success: 建立類別成功
|
||||||
date: 起迄日期
|
date: 起迄日期
|
||||||
default_widget:
|
default_widget:
|
||||||
bulletin_category_with_title: 公告類別及標題
|
bulletin_category_with_title: 類別
|
||||||
postdate: 張貼日期
|
postdate: 張貼日期
|
||||||
subtitle: 副標題
|
subtitle: 副標題
|
||||||
title: 標題
|
title: 標題
|
||||||
@@ -27,6 +28,8 @@ zh_tw:
|
|||||||
frontend:
|
frontend:
|
||||||
bulletins: 公告前台
|
bulletins: 公告前台
|
||||||
search_result: 搜尋結果頁
|
search_result: 搜尋結果頁
|
||||||
|
image: 封面圖片
|
||||||
|
image_note: 此處上傳的圖片不會在公告內文出現
|
||||||
link_name: 連結名稱
|
link_name: 連結名稱
|
||||||
new_bulletin_category: 新增公告類別
|
new_bulletin_category: 新增公告類別
|
||||||
picture: 刊頭圖片
|
picture: 刊頭圖片
|
||||||
@@ -38,4 +41,16 @@ zh_tw:
|
|||||||
bulletins_and_web_links: 分眾頁籤
|
bulletins_and_web_links: 分眾頁籤
|
||||||
index: 索引
|
index: 索引
|
||||||
search: 搜尋
|
search: 搜尋
|
||||||
more: 更多+
|
more: 更多+
|
||||||
|
email_reminder: 寄送提醒
|
||||||
|
activate_email_reminder: 開啟寄送提醒
|
||||||
|
email_sentdate: 寄送時間
|
||||||
|
email_to: 寄送對象
|
||||||
|
other_mailaddress: 其他Mail
|
||||||
|
other_mailaddress_note: 輸入多組mail時,請用","逗號隔開
|
||||||
|
mail_subject: 來自【%{site_title}】的公告事件提醒
|
||||||
|
mail_hi: 您好
|
||||||
|
mail_url_view: 此封信件為公告事件提醒,請點選以下連結詳細觀看
|
||||||
|
mail_source: 來源
|
||||||
|
mail_time: 時間
|
||||||
|
image_upload_size_note: 建議檔案小於%{image_upload_size}
|
||||||
@@ -41,6 +41,10 @@ Rails.application.routes.draw do
|
|||||||
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"
|
||||||
end
|
end
|
||||||
|
namespace :api do
|
||||||
|
get "categories_tags.json" => "bulletins#get_categories_tags"
|
||||||
|
get "bulletins.json" => "bulletins#get_bulletins"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user