Compare commits
9 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
6e9b1613bf | |
|
|
499f389da5 | |
|
|
4276840113 | |
|
|
7a3e3b7ef3 | |
|
|
e06ccd78c4 | |
|
|
155b9ebb07 | |
|
|
95e06354bb | |
|
|
0427ae7f0c | |
|
|
db6b4266a8 |
|
|
@ -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']
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ zh_tw:
|
|||
all: 全部類別
|
||||
news: 新聞
|
||||
approve: 審核
|
||||
reapproval: 重新審核
|
||||
admins: 單位設定
|
||||
append_note: 以下之附加連結與檔案,為使前台顯示名稱,建議您輸入註解。
|
||||
approval_setting: 審核設定
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue