Fix bug.
This commit is contained in:
parent
6123ed43bd
commit
218dd21255
|
@ -219,6 +219,11 @@ class AnnouncementsController < ApplicationController
|
|||
get_tabs_option
|
||||
anns = []
|
||||
use_tag = false
|
||||
@annc_depts = []
|
||||
@tmp_enable_annc_dept = (enable_annc_dept rescue false)
|
||||
if @tmp_enable_annc_dept
|
||||
@annc_depts = annc_depts_translations[locale] rescue []
|
||||
end
|
||||
if @tab_option == 0
|
||||
anns = get_anncs_for_pack_data(cats,tags,nil,is_random)
|
||||
else
|
||||
|
@ -537,6 +542,13 @@ class AnnouncementsController < ApplicationController
|
|||
end
|
||||
end
|
||||
def get_anncs_for_pack_data(cats,tags,set_tags=nil,is_random = false)
|
||||
if @annc_depts.nil?
|
||||
@annc_depts = []
|
||||
@tmp_enable_annc_dept = (enable_annc_dept rescue false)
|
||||
if @tmp_enable_annc_dept
|
||||
@annc_depts = annc_depts_translations[locale] rescue []
|
||||
end
|
||||
end
|
||||
if tags.blank?
|
||||
tags = ["all"]
|
||||
end
|
||||
|
|
|
@ -20,7 +20,9 @@ module AnnouncementsHelper
|
|||
end
|
||||
'#'+comp.join
|
||||
end
|
||||
def data_to_human_type(a,set_tag_ids=nil)
|
||||
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
|
||||
annc_depts = @annc_depts if @annc_depts
|
||||
statuses = a.statuses_with_classname.collect do |status|
|
||||
{
|
||||
"status" => status["name"],
|
||||
|
@ -30,7 +32,7 @@ module AnnouncementsHelper
|
|||
files = a.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title rescue '') } if file.enabled_for?(locale) } rescue []
|
||||
files.delete(nil)
|
||||
links = a.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
|
||||
author = User.find(a.create_user_id).member_profile.name rescue ""
|
||||
author = tmp_enable_annc_dept ? annc_depts[a.annc_dept] : User.find(a.create_user_id).member_profile.name rescue ""
|
||||
desc = a.image_description
|
||||
desc = (desc.nil? || desc == "" ? "announcement image" : desc)
|
||||
link_to_show = (a.is_external_link? ? a.external_link : OrbitHelper.widget_item_url(a.to_param)) rescue ""
|
||||
|
|
Loading…
Reference in New Issue