sorting changed and also entries removed without title

This commit is contained in:
Harry Bomrah 2014-11-07 16:12:45 +08:00
parent c0d12158c4
commit 622dce7924
1 changed files with 7 additions and 3 deletions

View File

@ -30,14 +30,16 @@ namespace :announcement_link_widget do
end
if common_tags_frontend.size > 0
Bulletin.all.can_display.is_approved.order_by(:created_at=>'desc').each do |ann|
Bulletin.all.can_display.is_approved.order_by(:postdate=>'desc').each do |ann|
intersection = ann.tags & an_tags
if intersection.size > 0
intersection.each do |t|
name = t.name.downcase.gsub(" ", "_")
index = common_tags_frontend.index{|t| t["tag-id"] == name}
ctf = common_tags_frontend[index]
ctf["announcements"] << {"title" => ann.title_translations[locale.to_s],"link"=>OrbitHelper.widget_item_url(ann.to_param)}
if ann.title_translations[locale.to_s] != ""
ctf["announcements"] << {"title" => ann.title_translations[locale.to_s],"link"=>OrbitHelper.widget_item_url(ann.to_param)}
end
end
end
end
@ -50,7 +52,9 @@ namespace :announcement_link_widget do
name = t.name.downcase.gsub(" ", "_")
index = common_tags_frontend.index{|t| t["tag-id"] == name}
ctf = common_tags_frontend[index]
ctf["links"] << {"title" => wl.title_translations[locale.to_s],"url" => wl.url_translations[locale.to_s]}
if wl.title_translations[locale.to_s] != ""
ctf["links"] << {"title" => wl.title_translations[locale.to_s],"url" => wl.url_translations[locale.to_s]}
end
end
end
end