Compare commits

...

9 Commits
temp ... master

Author SHA1 Message Date
Ruling-Mac 6e9b1613bf fix MORE bug 2015-07-28 17:37:23 +08:00
Ruling-Mac 499f389da5 modify news url about category 2015-07-28 17:13:44 +08:00
Harry Bomrah 4276840113 page share for fb 2015-07-03 20:55:23 +08:00
Harry Bomrah 7a3e3b7ef3 added models for cache 2015-03-30 15:29:41 +08:00
JiangRu e06ccd78c4 add models_to_cache 2015-03-30 15:08:28 +08:00
nccu 155b9ebb07 approve btn fix 2015-03-26 20:50:56 +08:00
Harry Bomrah 95e06354bb fix 2015-03-26 20:39:03 +08:00
Harry Bomrah 0427ae7f0c small fix for approve 2015-03-26 20:33:25 +08:00
Harry Bomrah db6b4266a8 approve mechanism imporved for news 2015-03-26 18:10:59 +08:00
7 changed files with 36 additions and 4 deletions

View File

@ -74,8 +74,10 @@ class Admin::NewsController < OrbitAdminController
if params["approved"] == "true"
news_bulletin.approved = true
news_bulletin.rejected = false
news_bulletin.reapproval = false
else
news_bulletin.rejected = true
news_bulletin.reapproval = false
news_bulletin.rejection_reason = params["reason"]
end
news_bulletin.save
@ -110,6 +112,7 @@ class Admin::NewsController < OrbitAdminController
end
news_bulletin.update_attributes(news_bulletin_params)
news_bulletin.reapproval = true if news_bulletin.rejected
news_bulletin.save
build_email(news_bulletin)
redirect_to params['referer_url']

View File

@ -112,6 +112,19 @@ class NewsController < ApplicationController
page = Page.where(:module => "news").first rescue nil
ma = ModuleApp.find_by_key("news") rescue nil
current_categories = OrbitHelper.widget_categories
categories_for_url = ma.categories.enabled.collect do |cat|
if current_categories.include?(cat.id.to_s)
{
"name" => cat.title,
"category-link" => "/#{I18n.locale.to_s + page.url}/?category=#{cat.to_param}"
}
end
end
categories_for_url.delete(nil)
categories_for_url = {"name" => "ALL", "category-link" => "/#{I18n.locale.to_s + page.url}/"} if categories_for_url.count != 1
categories = ma.categories.enabled.collect do |cat|
{
"name" => cat.title,
@ -140,8 +153,6 @@ class NewsController < ApplicationController
elsif I18n.locale.to_s == 'en'
subtitle = a.subtitle.truncate(200)
end
{
"title" => HTMLEntities.new.encode(a.title),
@ -157,6 +168,7 @@ class NewsController < ApplicationController
{
"news" => anns,
"categories" => categories,
"categories_for_url" => categories_for_url,
"extras" => {
"more_url"=>OrbitHelper.widget_more_url,
"title-head" => t('news.table.title'),
@ -195,6 +207,10 @@ class NewsController < ApplicationController
links = news.news_bulletin_links.collect{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
update_user = news.update_user.member_profile.name rescue ""
department = news.department rescue ""
request = OrbitHelper.request
meta_desc = news.subtitle.nil? || news.subtitle == "" ? news.text[0..200] : news.subtitle
OrbitHelper.render_meta_tags([{"property" => "og:title", "content" => news.title},{"property" => "og:site_name", "content" => Site.first.title},{"property" => "og:url", "content" => request.original_url},{"property" => "og:description", "content" => meta_desc},{"property" => "og:image", "content" => "#{request.base_url}#{news.image.url}"},{"property" => "og:type", "content" => "Article"}])
{
"tags" => tags,
"news_bulletin_files" => files,

View File

@ -22,6 +22,7 @@ class NewsBulletin
field :rss2_sn
field :approved, :type => Boolean, :default => false
field :rejected, :type => Boolean, :default => false
field :reapproval, :type => Boolean, :default => false
field :rejection_reason
field :is_preview, :type => Boolean, :default => false
field :image_description, localize: true

View File

@ -34,6 +34,14 @@
<%= b.title_translations["en"] %> <span class='label'><%= t(:expired) %></span>
<% end %>
<% end %>
<% elsif b.rejected && b.reapproval %>
<% url = page_for_bulletin(b) %>
<% if !b.title_translations["zh_tw"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["zh_tw"] %></a> <span class='label'><%= t("news.reapproval") %> : <%= t(:pending) %></span><br />
<% end %>
<% if !b.title_translations["en"].blank? %>
<a href="<%= url %>" target="_blank"><%= b.title_translations["en"] %></a> <span class='label'><%= t("news.reapproval") %> : <%= t(:pending) %></span>
<% end %>
<% elsif b.rejected %>
<% url = page_for_bulletin(b) %>
<% if !b.title_translations["zh_tw"].blank? %>
@ -67,7 +75,7 @@
<li><a href="/admin/news/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/news/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
<% elsif is_user_sub_manager? %>
<% if !b.rejected && !b.approved %>
<% if b.rejected && !b.approved %>
<li><a href="/admin/news/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<% end %>
<li><a href="#" class="delete text-error" rel="/admin/news/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
@ -79,7 +87,7 @@
<% end %>
<% if !b.rejected && !b.approved && user_can_approve? && !b.expired? %>
<% if (!b.rejected && !b.approved && user_can_approve? && !b.expired?) || (b.rejected && !b.approved && user_can_approve? && !b.expired? && b.reapproval) %>
<li><a href="#" class="appoval_button" data-approve-link="<%= "/#{I18n.locale.to_s}/news/#{b.to_param}" %>" data-id="<%= b.id.to_s %>"><%= t("news.approve") %></a></li>
<% end %>
<% end %>

View File

@ -15,6 +15,7 @@ en:
category: Category
add_new: Add New
approve: Approve
reapproval: Re-approval
all_articles: All Articles
news: News
approval_setting: Approval Setting

View File

@ -32,6 +32,7 @@ zh_tw:
all: 全部類別
news: 新聞
approve: 審核
reapproval: 重新審核
admins: 單位設定
append_note: 以下之附加連結與檔案,為使前台顯示名稱,建議您輸入註解。
approval_setting: 審核設定

View File

@ -6,7 +6,9 @@ module News
base_url File.expand_path File.dirname(__FILE__)
widget_methods ["widget"]
widget_settings [{"data_count"=>12}]
models_to_cache [:news_bulletin]
# taggable "NewsBulletin"
models_to_cache [:news_bulletin]
categorizable
authorizable
frontend_enabled