diff --git a/app/controllers/admin/announcements_controller.rb b/app/controllers/admin/announcements_controller.rb
index 652c82c..a28265f 100644
--- a/app/controllers/admin/announcements_controller.rb
+++ b/app/controllers/admin/announcements_controller.rb
@@ -69,7 +69,13 @@ class Admin::AnnouncementsController < OrbitAdminController
def approve_bulletin
id = params[:id]
bulletin = Bulletin.find(id)
- bulletin.approved = true
+ if params["approved"] == "true"
+ bulletin.approved = true
+ bulletin.rejected = false
+ else
+ bulletin.rejected = true
+ bulletin.rejection_reason = params["reason"]
+ end
bulletin.save
redirect_to admin_announcements_path
end
diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb
index 2b5d84a..241e3b0 100644
--- a/app/models/bulletin.rb
+++ b/app/models/bulletin.rb
@@ -19,6 +19,8 @@ class Bulletin
field :deadline , :type => DateTime
field :rss2_sn
field :approved, :type => Boolean, :default => false
+ field :rejected, :type => Boolean, :default => false
+ field :rejection_reason
field :is_preview, :type => Boolean, :default => false
field :email_id
diff --git a/app/views/admin/announcements/_approval_modal.html.erb b/app/views/admin/announcements/_approval_modal.html.erb
new file mode 100644
index 0000000..2e49a8b
--- /dev/null
+++ b/app/views/admin/announcements/_approval_modal.html.erb
@@ -0,0 +1,122 @@
+
+
\ No newline at end of file
diff --git a/app/views/admin/announcements/_index.html.erb b/app/views/admin/announcements/_index.html.erb
index a066593..0eaca59 100644
--- a/app/views/admin/announcements/_index.html.erb
+++ b/app/views/admin/announcements/_index.html.erb
@@ -20,6 +20,8 @@
<% if b.expired? %>
<%= b.title %> <%= t(:expired) %>
+ <% elsif b.rejected %>
+ <%= b.title %> <%= t(:rejected) %> : <%= b.rejection_reason rescue "" %>
<% elsif !b.approved? %>
<%= b.title %> <%= t(:pending) %>
<% else %>
@@ -32,7 +34,7 @@
<%= t(:edit) %>
<%= t(:delete_) %>
<% if !b.approved && user_can_approve? %>
- <%= t("announcement.approve") %>
+ " data-id="<%= b.id.to_s %>"><%= t("announcement.approve") %>
<% end %>
<% end %>
diff --git a/app/views/admin/announcements/index.html.erb b/app/views/admin/announcements/index.html.erb
index 1ad9a26..7723682 100644
--- a/app/views/admin/announcements/index.html.erb
+++ b/app/views/admin/announcements/index.html.erb
@@ -3,4 +3,17 @@
<%= render 'index'%>
-<%= render 'layouts/delete_modal', delete_options: @delete_options %>
\ No newline at end of file
+<%= render 'layouts/delete_modal', delete_options: @delete_options %>
+
+<%= render :partial=> "approval_modal" %>
+
+
\ No newline at end of file
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index fff75f1..0ed9b3f 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -8,7 +8,7 @@ zh_tw:
sub_title: 副標題
category: 類別
add_new: 新建
- approve: 通過
+ approve: 審核
tag_cloud: 標籤雲
all_articles: 文章列表
announcement: 公告
diff --git a/config/routes.rb b/config/routes.rb
index 319d041..eedd22b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,7 +6,7 @@ Rails.application.routes.draw do
namespace :admin do
post 'announcement/preview', to: 'announcements#preview'
get 'announcement/destroy_preview/:slug_title-:uid', to: 'announcements#destroy_preview'
- get 'announcement/approve_bulletin', to: 'announcements#approve_bulletin'
+ post 'announcement/approve_bulletin', to: 'announcements#approve_bulletin'
resources :announcements
end
|