This commit is contained in:
BoHung Chiu 2021-12-11 19:13:08 +08:00
parent 89d328c640
commit ddbe773d25
2 changed files with 2 additions and 1 deletions

View File

@ -167,7 +167,7 @@ class AnnouncementsController < ApplicationController
else
cats = ["all"] + cats
end
anns = anns.sort_by { |a| tmp=a["postdate"].blank?;[tmp ? 0 : 1, tmp ? nil : a["postdate"].to_time] }.reverse
anns = anns.sort_by { |a| [ (a["is_top"] ? 1 : 0) , a["postdate"].blank? ? nil : a["postdate"].to_time] }.reverse
end
cats = cats.uniq
tags = tags.uniq

View File

@ -45,6 +45,7 @@ module AnnouncementsHelper
doc = Nokogiri::HTML(a.title)
title = doc.text.empty? ? 'no content' : doc.text
{
"is_top" => a.is_top,
"bulletin_links" => links,
"bulletin_files" => files,
"title" => a.title,