Add feed carousel images.
This commit is contained in:
parent
9f885a05eb
commit
88eec58422
|
@ -122,6 +122,7 @@ class AnnouncementFeedsController < ApplicationController
|
||||||
a["subtitle_ann"] = anns.subtitle if anns.display_subtitle?
|
a["subtitle_ann"] = anns.subtitle if anns.display_subtitle?
|
||||||
a["bulletin_links"] = []
|
a["bulletin_links"] = []
|
||||||
a["bulletin_files"] = []
|
a["bulletin_files"] = []
|
||||||
|
a["bulletin_carousel_images"] = anns.bulletin_carousel_images.map{|image| {"src"=>"#{request.base_url}" + image.file.url,"description"=>image.description.to_s,"description_text"=>image.description_text }}
|
||||||
anns.tags.each do |tag|
|
anns.tags.each do |tag|
|
||||||
if !tag_ids.include?(tag.id.to_s)
|
if !tag_ids.include?(tag.id.to_s)
|
||||||
tag_ids << tag.id.to_s
|
tag_ids << tag.id.to_s
|
||||||
|
|
|
@ -673,11 +673,17 @@ class AnnouncementsController < ApplicationController
|
||||||
|
|
||||||
datetime = DateTime.parse(announcement["postdate"])
|
datetime = DateTime.parse(announcement["postdate"])
|
||||||
|
|
||||||
|
bulletin_carousel_images = Array(announcement["bulletin_carousel_images"])
|
||||||
|
resume_btn_title = (I18n.locale.to_s =="zh_tw") ? "繼續播放" : "resume"
|
||||||
|
pause_btn_title = (I18n.locale.to_s =="zh_tw") ? "暫停播放" : "pause"
|
||||||
|
prev_btn_title = (I18n.locale.to_s =="zh_tw") ? "上一張" : "prev"
|
||||||
|
next_btn_title = (I18n.locale.to_s =="zh_tw") ? "下一張" : "next"
|
||||||
|
|
||||||
{
|
{
|
||||||
"tags" => tags,
|
"tags" => tags,
|
||||||
"bulletin_files" => files,
|
"bulletin_files" => files,
|
||||||
"bulletin_links" => links,
|
"bulletin_links" => links,
|
||||||
"bulletin_carousel_images" => [],
|
"bulletin_carousel_images" => bulletin_carousel_images,
|
||||||
"data" => {
|
"data" => {
|
||||||
"title" => announcement["title_translations"][locale],
|
"title" => announcement["title_translations"][locale],
|
||||||
"subtitle_ann" => subtitle_ann,
|
"subtitle_ann" => subtitle_ann,
|
||||||
|
@ -689,7 +695,12 @@ class AnnouncementsController < ApplicationController
|
||||||
"img_description" => img_description,
|
"img_description" => img_description,
|
||||||
"hide_class" => announcement["display_img"] ? '' : ' hide',
|
"hide_class" => announcement["display_img"] ? '' : ' hide',
|
||||||
"alt_title" => desc,
|
"alt_title" => desc,
|
||||||
"carousel_display_style" => 'display: none'
|
"resume_btn_title" => resume_btn_title,
|
||||||
|
"pause_btn_title" => pause_btn_title,
|
||||||
|
"prev_btn_title" => prev_btn_title,
|
||||||
|
"next_btn_title" => next_btn_title,
|
||||||
|
"carousel_display_style" => (bulletin_carousel_images.count == 0 ? 'display: none' : 'width: 50%;margin: auto;'),
|
||||||
|
"carousel_count" => bulletin_carousel_images.count
|
||||||
},
|
},
|
||||||
"comments" => [],
|
"comments" => [],
|
||||||
"show_comment_flag" => false,
|
"show_comment_flag" => false,
|
||||||
|
|
|
@ -129,6 +129,7 @@ module AnnouncementsHelper
|
||||||
x = {
|
x = {
|
||||||
"bulletin_links" => links,
|
"bulletin_links" => links,
|
||||||
"bulletin_files" => files,
|
"bulletin_files" => files,
|
||||||
|
"bulletin_carousel_images" => fa["bulletin_carousel_images"].to_a,
|
||||||
"title" => fa["title_translations"][locale],
|
"title" => fa["title_translations"][locale],
|
||||||
"subtitle" => fa["subtitle_translations"][locale],
|
"subtitle" => fa["subtitle_translations"][locale],
|
||||||
"statuses" => [status],
|
"statuses" => [status],
|
||||||
|
|
Loading…
Reference in New Issue