Fix default img issue.
This commit is contained in:
parent
52f8b5bf2c
commit
656ac84c05
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -1,5 +1,6 @@
|
||||||
class AnnouncementsController < ApplicationController
|
class AnnouncementsController < ApplicationController
|
||||||
include AnnouncementsHelper
|
include AnnouncementsHelper
|
||||||
|
DefaultImgSrc = "/assets/announcement-default.jpg\" onerror=\"this.src="/assets/announcement-default-2.jpg";this.onerror='';"
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@app_title = 'announcement'
|
@app_title = 'announcement'
|
||||||
|
@ -126,7 +127,7 @@ class AnnouncementsController < ApplicationController
|
||||||
"is_top" => (a.is_top? ? 1 : 0),
|
"is_top" => (a.is_top? ? 1 : 0),
|
||||||
"link_to_show" => link_to_show+"\" #{(link_to_show[0] == '/' rescue true) ? '' : 'target="_blank"'} title=\"#{title}",
|
"link_to_show" => link_to_show+"\" #{(link_to_show[0] == '/' rescue true) ? '' : 'target="_blank"'} title=\"#{title}",
|
||||||
"target" => target,
|
"target" => target,
|
||||||
"img_src" => image_url || "/assets/announcement-default.jpg",
|
"img_src" => image_url || DefaultImgSrc,
|
||||||
"img_description" => desc,
|
"img_description" => desc,
|
||||||
"more" => t("announcement.more"),
|
"more" => t("announcement.more"),
|
||||||
"view_count" => a.view_count
|
"view_count" => a.view_count
|
||||||
|
@ -743,7 +744,7 @@ class AnnouncementsController < ApplicationController
|
||||||
img_src = nil
|
img_src = nil
|
||||||
img_description = nil
|
img_description = nil
|
||||||
subtitle_ann = announcement.subtitle if announcement.display_subtitle?
|
subtitle_ann = announcement.subtitle if announcement.display_subtitle?
|
||||||
img_src = (announcement.image.url || "/assets/announcement-default.jpg") if announcement.display_img?
|
img_src = (announcement.image.url || DefaultImgSrc) if announcement.display_img?
|
||||||
img_description = announcement.image_description if (announcement.image_description.present?) && (announcement.display_img?)
|
img_description = announcement.image_description if (announcement.image_description.present?) && (announcement.display_img?)
|
||||||
show_comment_flag = announcement.open_comment_for_user(OrbitHelper.current_user)
|
show_comment_flag = announcement.open_comment_for_user(OrbitHelper.current_user)
|
||||||
bulletin_carousel_images = announcement.bulletin_carousel_images.map{|image| {"src"=>image.file.url,"description"=>image.description.to_s,"description_text"=>image.description_text }}
|
bulletin_carousel_images = announcement.bulletin_carousel_images.map{|image| {"src"=>image.file.url,"description"=>image.description.to_s,"description_text"=>image.description_text }}
|
||||||
|
@ -851,7 +852,7 @@ class AnnouncementsController < ApplicationController
|
||||||
img_description = nil
|
img_description = nil
|
||||||
img_description = announcement["image_description_translations"][I18n.locale] if announcement['display_img']
|
img_description = announcement["image_description_translations"][I18n.locale] if announcement['display_img']
|
||||||
img_src = nil
|
img_src = nil
|
||||||
img_src = (announcement['image']['original'] || "/assets/announcement-default.jpg") if announcement['display_img']
|
img_src = (announcement['image']['original'] || DefaultImgSrc) if announcement['display_img']
|
||||||
subtitle_ann = announcement['subtitle_ann']
|
subtitle_ann = announcement['subtitle_ann']
|
||||||
request = OrbitHelper.request
|
request = OrbitHelper.request
|
||||||
if announcement["subtitle_translations"].present?
|
if announcement["subtitle_translations"].present?
|
||||||
|
@ -979,7 +980,7 @@ class AnnouncementsController < ApplicationController
|
||||||
"is_top" => (a.is_top? ? 1 : 0),
|
"is_top" => (a.is_top? ? 1 : 0),
|
||||||
"link_to_show" => link_to_show+"\" #{(link_to_show[0] == '/' rescue true) ? '' : 'target="_blank"'} title=\"#{title}",
|
"link_to_show" => link_to_show+"\" #{(link_to_show[0] == '/' rescue true) ? '' : 'target="_blank"'} title=\"#{title}",
|
||||||
"target" => target,
|
"target" => target,
|
||||||
"img_src" => a.image.thumb.url || "/assets/announcement-default.jpg",
|
"img_src" => a.image.thumb.url || DefaultImgSrc,
|
||||||
"img_description" => desc,
|
"img_description" => desc,
|
||||||
"more" => t("announcement.more"),
|
"more" => t("announcement.more"),
|
||||||
"view_count" => a.view_count
|
"view_count" => a.view_count
|
||||||
|
|
|
@ -63,7 +63,7 @@ module AnnouncementsHelper
|
||||||
"author" => author,
|
"author" => author,
|
||||||
"link_to_show" => link_to_show+"\" #{(link_to_show[0] == '/' rescue true) ? '' : 'target="_blank"'} title=\"#{title}",
|
"link_to_show" => link_to_show+"\" #{(link_to_show[0] == '/' rescue true) ? '' : 'target="_blank"'} title=\"#{title}",
|
||||||
"target" => target,
|
"target" => target,
|
||||||
"img_src" => image_url || "/assets/announcement-default.jpg",
|
"img_src" => image_url || AnnouncementsController::DefaultImgSrc,
|
||||||
"img_description" => desc
|
"img_description" => desc
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -114,7 +114,7 @@ module AnnouncementsHelper
|
||||||
"source-site-link" => fa["source-site"],
|
"source-site-link" => fa["source-site"],
|
||||||
"link_to_show" => OrbitHelper.url_to_show(fa["params"]),
|
"link_to_show" => OrbitHelper.url_to_show(fa["params"]),
|
||||||
"target" => "_self",
|
"target" => "_self",
|
||||||
"img_src" => fa["image"]["thumb"] || "/assets/announcement-default.jpg",
|
"img_src" => fa["image"]["thumb"] || AnnouncementsController::DefaultImgSrc,
|
||||||
"img_description" => fa["image_description_translations"][locale],
|
"img_description" => fa["image_description_translations"][locale],
|
||||||
"more" => t("announcement.more"),
|
"more" => t("announcement.more"),
|
||||||
"view_count" => ""
|
"view_count" => ""
|
||||||
|
|
Loading…
Reference in New Issue