remove trailing space

This commit is contained in:
EricTYL 2019-10-29 15:51:02 +08:00
parent 810c283dc6
commit d1957d6b88
1 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ class AnnouncementsController < ApplicationController
sorted = announcements.sort{ |k,v| v["postdate"] <=> k["postdate"] } sorted = announcements.sort{ |k,v| v["postdate"] <=> k["postdate"] }
sorted = top_anns + sorted sorted = top_anns + sorted
if params["keywords"].present? if params["keywords"].present?
sorted = sorted.find_all{|anns| sorted = sorted.find_all{|anns|
if anns["source-site"].present? if anns["source-site"].present?
/#{params[:keywords].to_s}/i.match anns["title"] /#{params[:keywords].to_s}/i.match anns["title"]
else else
@ -40,7 +40,7 @@ class AnnouncementsController < ApplicationController
} }
end end
if params["postdate"].present? if params["postdate"].present?
sorted = sorted.find_all{|anns| sorted = sorted.find_all{|anns|
if anns["source-site"].present? if anns["source-site"].present?
/#{params[:postdate].to_s}/i.match anns["postdate"].strftime("%Y-%m") if !anns["postdate"].nil? /#{params[:postdate].to_s}/i.match anns["postdate"].strftime("%Y-%m") if !anns["postdate"].nil?
else else
@ -55,9 +55,9 @@ class AnnouncementsController < ApplicationController
announcements = announcements.find_all{|anns| /#{params[:keywords].to_s}/i.match anns.title} announcements = announcements.find_all{|anns| /#{params[:keywords].to_s}/i.match anns.title}
end end
if params["postdate"].present? if params["postdate"].present?
announcements = announcements.find_all{|anns| announcements = announcements.find_all{|anns|
if !anns.postdate.nil? if !anns.postdate.nil?
/#{params[:postdate].to_s}/i.match anns.postdate.strftime("%Y-%m") /#{params[:postdate].to_s}/i.match anns.postdate.strftime("%Y-%m")
end end
} }
end end
@ -229,7 +229,7 @@ class AnnouncementsController < ApplicationController
sorted = announcements.sort{ |k,v| v["postdate"] <=> k["postdate"] } sorted = announcements.sort{ |k,v| v["postdate"] <=> k["postdate"] }
sorted = top_anns + sorted sorted = top_anns + sorted
sorted = Kaminari.paginate_array(sorted).page(1).per(OrbitHelper.widget_data_count) rescue [] sorted = Kaminari.paginate_array(sorted).page(1).per(OrbitHelper.widget_data_count) rescue []
else else
announcements = top_anns + announcements announcements = top_anns + announcements
sorted = Kaminari.paginate_array(announcements).page(1).per(OrbitHelper.widget_data_count) rescue [] sorted = Kaminari.paginate_array(announcements).page(1).per(OrbitHelper.widget_data_count) rescue []
end end
@ -362,7 +362,7 @@ class AnnouncementsController < ApplicationController
return {} if announcement.blank? return {} if announcement.blank?
tags = [] tags = []
announcement["tags"].each{|tag| announcement["tags"].each{|tag|
t = Tag.where(:name => tag["name_translations"][locale]).first rescue nil t = Tag.where(:name => tag["name_translations"][locale]).first rescue nil
if t.nil? if t.nil?
I18n.locale = (locale == "en" ? :zh_tw : :en) I18n.locale = (locale == "en" ? :zh_tw : :en)