fix get enable_manually_sort nil error
This commit is contained in:
parent
e328e1eb12
commit
6e2a4ac3e9
|
@ -1,4 +1,6 @@
|
||||||
module EventNewsHelper
|
module EventNewsHelper
|
||||||
|
extend self
|
||||||
|
|
||||||
def data_to_human_type(a,set_tag_ids=nil)
|
def data_to_human_type(a,set_tag_ids=nil)
|
||||||
statuses = a.statuses_with_classname.collect do |status|
|
statuses = a.statuses_with_classname.collect do |status|
|
||||||
{
|
{
|
||||||
|
@ -88,7 +90,7 @@ module EventNewsHelper
|
||||||
sort_maps = {event_date: :asc, is_top: :desc, postdate: :asc, id: :asc}
|
sort_maps = {event_date: :asc, is_top: :desc, postdate: :asc, id: :asc}
|
||||||
else
|
else
|
||||||
sort_maps = {is_top: :desc}
|
sort_maps = {is_top: :desc}
|
||||||
if EventNewsHelper.is_postdate_sort_first
|
if is_postdate_sort_first
|
||||||
sort_maps = sort_maps.merge({postdate: :desc, event_date: :desc, id: :desc})
|
sort_maps = sort_maps.merge({postdate: :desc, event_date: :desc, id: :desc})
|
||||||
else
|
else
|
||||||
sort_maps = sort_maps.merge({event_date: :desc, postdate: :desc, id: :desc})
|
sort_maps = sort_maps.merge({event_date: :desc, postdate: :desc, id: :desc})
|
||||||
|
@ -234,8 +236,7 @@ module EventNewsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def sort_event_news(event_news_list)
|
def sort_event_news(event_news_list)
|
||||||
enable_manually_sort = enable_manually_sort
|
if @show_today_data_first || !is_postdate_sort_first
|
||||||
if @show_today_data_first || !EventNewsHelper.is_postdate_sort_first
|
|
||||||
if enable_manually_sort
|
if enable_manually_sort
|
||||||
event_news_list = event_news_list.sort_by { |event_news|
|
event_news_list = event_news_list.sort_by { |event_news|
|
||||||
tmp1 = event_news["event_date"].blank?
|
tmp1 = event_news["event_date"].blank?
|
||||||
|
@ -551,7 +552,7 @@ module EventNewsHelper
|
||||||
</div>
|
</div>
|
||||||
</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]
|
||||||
|
@ -560,6 +561,7 @@ module EventNewsHelper
|
||||||
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]
|
||||||
|
@ -573,6 +575,7 @@ module EventNewsHelper
|
||||||
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['event_news_mod'][:enable_manually_sort]
|
OrbitHelper::SharedHash['event_news_mod'][:enable_manually_sort]
|
||||||
|
@ -580,6 +583,7 @@ module EventNewsHelper
|
||||||
EventNewsSetting.first.enable_manually_sort rescue false
|
EventNewsSetting.first.enable_manually_sort rescue false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_postdate_sort_first
|
def is_postdate_sort_first
|
||||||
if defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash
|
if defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash
|
||||||
OrbitHelper::SharedHash['event_news_mod'][:is_postdate_sort_first]
|
OrbitHelper::SharedHash['event_news_mod'][:is_postdate_sort_first]
|
||||||
|
@ -587,5 +591,4 @@ module EventNewsHelper
|
||||||
EventNewsSetting.first.is_postdate_sort_first rescue false
|
EventNewsSetting.first.is_postdate_sort_first rescue false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue