This commit is contained in:
BoHung Chiu 2021-09-01 17:51:22 +08:00
parent de7b095c67
commit faedbd4a11
3 changed files with 7 additions and 6 deletions

View File

@ -44,7 +44,7 @@ class AnnouncementsController < ApplicationController
"source-site-link" => "", "source-site-link" => "",
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
"statuses" => statuses, "statuses" => statuses,
"category" => a.category.title, "category" => (a.category.title rescue ""),
"postdate" => a.postdate, "postdate" => a.postdate,
"author" => author, "author" => author,
"is_top" => (a.is_top? ? 1 : 0), "is_top" => (a.is_top? ? 1 : 0),
@ -575,7 +575,7 @@ class AnnouncementsController < ApplicationController
end end
end end
return {} if announcement.category.disable return {} if (announcement.category.disable rescue false)
tags = announcement.tags.map{|tag| { tags = announcement.tags.map{|tag| {
"tag" => tag.name , "tag" => tag.name ,
@ -788,7 +788,7 @@ class AnnouncementsController < ApplicationController
"source-site-link" => "", "source-site-link" => "",
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
"statuses" => statuses, "statuses" => statuses,
"category" => a.category.title, "category" => (a.category.title rescue ""),
"postdate" => a.postdate, "postdate" => a.postdate,
"author" => author, "author" => author,
"is_top" => (a.is_top? ? 1 : 0), "is_top" => (a.is_top? ? 1 : 0),

View File

@ -65,7 +65,8 @@ class Bulletin
field :open_comment, :type => Boolean, :default => false field :open_comment, :type => Boolean, :default => false
field :comment_end_time, :type => DateTime field :comment_end_time, :type => DateTime
field :comment_role, :type => Array, :default => [] field :comment_role, :type => Array, :default => []
field :enable_sub_annc, :type => Boolean, :default => false
field :sub_annc_list, :type => Array, :default => []
mount_uploader :image, ImageUploader mount_uploader :image, ImageUploader
has_many :bulletin_links, :autosave => true, :dependent => :destroy has_many :bulletin_links, :autosave => true, :dependent => :destroy

View File

@ -169,7 +169,7 @@
<div class="annc-comments-nickname">by <%= comment.account %></div> <div class="annc-comments-nickname">by <%= comment.account %></div>
<br> <br>
</div> </div>
<% end %> <% end rescue nil %>
<% if action_data['show_comment_flag'] %> <% if action_data['show_comment_flag'] %>
<div class="annc-comment-div"> <div class="annc-comment-div">
<div data-ph="<%= t('announcement.comment') %>" contenteditable="true" class="announcement-comment"></div> <div data-ph="<%= t('announcement.comment') %>" contenteditable="true" class="announcement-comment"></div>
@ -177,4 +177,4 @@
<%= t('announcement.send_comment') %> <%= t('announcement.send_comment') %>
</button> </button>
</div> </div>
<% end %> <% end rescue nil %>