fix error for sort announcements because of get nil by call enable_manually_sort

This commit is contained in:
chiu 2024-10-17 02:52:13 +00:00
parent 4043dfed5c
commit b3dbabef5b
1 changed files with 28 additions and 26 deletions

View File

@ -1,4 +1,6 @@
module AnnouncementsHelper module AnnouncementsHelper
extend self
def data_to_human_type(a,set_tag_ids=nil,tmp_enable_annc_dept=false,annc_depts=[]) def data_to_human_type(a,set_tag_ids=nil,tmp_enable_annc_dept=false,annc_depts=[])
tmp_enable_annc_dept = @tmp_enable_annc_dept if @tmp_enable_annc_dept tmp_enable_annc_dept = @tmp_enable_annc_dept if @tmp_enable_annc_dept
annc_depts = @annc_depts if @annc_depts annc_depts = @annc_depts if @annc_depts
@ -464,7 +466,6 @@ module AnnouncementsHelper
</div>").html_safe </div>").html_safe
end end
class << self
def complementaryColor(my_hex) def complementaryColor(my_hex)
if my_hex[0] == '#' if my_hex[0] == '#'
my_hex = my_hex[1..-1] my_hex = my_hex[1..-1]
@ -473,6 +474,7 @@ module AnnouncementsHelper
comp = rgb.map{|a| (255 - a.to_i(16)).to_s(16).rjust(2,'0')} comp = rgb.map{|a| (255 - a.to_i(16)).to_s(16).rjust(2,'0')}
'#'+comp.join '#'+comp.join
end end
def lighten_color(my_hex,percent) def lighten_color(my_hex,percent)
if my_hex[0] == '#' if my_hex[0] == '#'
my_hex = my_hex[1..-1] my_hex = my_hex[1..-1]
@ -486,6 +488,7 @@ module AnnouncementsHelper
end end
'#'+comp.join '#'+comp.join
end end
def enable_manually_sort def enable_manually_sort
if defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash if defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash
OrbitHelper::SharedHash['announcement'][:enable_manually_sort] OrbitHelper::SharedHash['announcement'][:enable_manually_sort]
@ -493,5 +496,4 @@ module AnnouncementsHelper
AnnouncementSetting.first.enable_manually_sort rescue false AnnouncementSetting.first.enable_manually_sort rescue false
end end
end end
end
end end