Compare commits
No commits in common. "master" and "0.0.2" have entirely different histories.
|
|
@ -1,5 +1,3 @@
|
||||||
= Announcement
|
= Announcement
|
||||||
|
|
||||||
This project rocks and uses MIT-LICENSE.
|
This project rocks and uses MIT-LICENSE.
|
||||||
* Tagging
|
|
||||||
* Categories
|
|
||||||
|
|
@ -141,8 +141,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
delete_out_invalid_date_from_params
|
delete_out_invalid_date_from_params
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,8 @@ 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
|
||||||
key_string = params[:search_query]
|
@search = Bulletin.tire.search "#{params[:search_query]}"
|
||||||
keywords = key_string.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
search_result = @search.collect{|result| result.id}
|
||||||
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
|
||||||
|
|
@ -60,6 +55,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@item = Page.find(params[:page_id]) rescue nil
|
@item = Page.find(params[:page_id]) rescue nil
|
||||||
|
@fb_share = eval(params[:facebook_share]) rescue false
|
||||||
if params[:preview] == "true"
|
if params[:preview] == "true"
|
||||||
preview_content
|
preview_content
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -146,15 +146,7 @@ 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_module_tag = ModuleTag.first(:conditions => {:name => @selected_tag.name, :module_app_id => @ModuleApp.id})
|
@link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :module_tag_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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ 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
|
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||||
|
|
||||||
field :title, localize: true
|
field :title, localize: true
|
||||||
field :subtitle, localize: true
|
field :subtitle, localize: true
|
||||||
|
|
@ -44,9 +44,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
|
||||||
|
|
||||||
|
|
@ -158,10 +158,6 @@ class Bulletin
|
||||||
User.find(self.email_user_ids) rescue []
|
User.find(self.email_user_ids) rescue []
|
||||||
end
|
end
|
||||||
|
|
||||||
def view_count
|
|
||||||
Impression.where(:impressionable_id=>self.id).count
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# def clean_values
|
# def clean_values
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
<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("announcement.image") %></a>
|
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#mail-group" data-toggle="tab"><%= t('announcement.email_reminder')%></a>
|
<a href="#mail-group" data-toggle="tab"><%= t('announcement.email_reminder')%></a>
|
||||||
|
|
@ -116,7 +116,7 @@
|
||||||
|
|
||||||
<!-- Images Upload -->
|
<!-- Images Upload -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("announcement.image") %></label>
|
<label class="control-label muted"><%= t(: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">
|
||||||
|
|
@ -139,7 +139,6 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="image_note"><%= t("announcement.image_note")%></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -242,10 +241,6 @@
|
||||||
|
|
||||||
<% 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>
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,3 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<%= paginate( @bulletins, :param_name => :page_main, :params => {:inner => 'false'} ) rescue nil%>
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@
|
||||||
<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>
|
||||||
|
|
@ -34,4 +38,20 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= share_links(@bulletin, 'announcement') %>
|
<%#= 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 %>
|
||||||
|
|
@ -4,7 +4,6 @@ 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
|
||||||
|
|
@ -14,7 +13,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: Category
|
bulletin_category_with_title: Bulletin Category with Title
|
||||||
postdate: Post Date
|
postdate: Post Date
|
||||||
subtitle: Subtitle
|
subtitle: Subtitle
|
||||||
title: Title
|
title: Title
|
||||||
|
|
@ -26,8 +25,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ 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: 審核成功
|
||||||
|
|
@ -14,7 +13,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: 標題
|
||||||
|
|
@ -28,8 +27,6 @@ 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,6 +38,7 @@ module Announcement
|
||||||
enable ["typeA", "typeB_style3", "typeC"]
|
enable ["typeA", "typeB_style3", "typeC"]
|
||||||
image :image
|
image :image
|
||||||
field :postdate
|
field :postdate
|
||||||
|
facebook_enabled false
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue