approve mechanism imporved for news

This commit is contained in:
Harry Bomrah 2015-03-26 18:10:59 +08:00
parent ca0ee268ab
commit db6b4266a8
5 changed files with 16 additions and 2 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

@ -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? %>
<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: 審核設定