Add feed carousel images.

This commit is contained in:
BoHung Chiu 2021-04-11 11:29:54 +08:00
parent 9f885a05eb
commit 88eec58422
3 changed files with 15 additions and 2 deletions

View File

@ -122,6 +122,7 @@ class AnnouncementFeedsController < ApplicationController
a["subtitle_ann"] = anns.subtitle if anns.display_subtitle?
a["bulletin_links"] = []
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|
if !tag_ids.include?(tag.id.to_s)
tag_ids << tag.id.to_s

View File

@ -673,11 +673,17 @@ class AnnouncementsController < ApplicationController
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,
"bulletin_files" => files,
"bulletin_links" => links,
"bulletin_carousel_images" => [],
"bulletin_carousel_images" => bulletin_carousel_images,
"data" => {
"title" => announcement["title_translations"][locale],
"subtitle_ann" => subtitle_ann,
@ -689,7 +695,12 @@ class AnnouncementsController < ApplicationController
"img_description" => img_description,
"hide_class" => announcement["display_img"] ? '' : ' hide',
"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" => [],
"show_comment_flag" => false,

View File

@ -129,6 +129,7 @@ module AnnouncementsHelper
x = {
"bulletin_links" => links,
"bulletin_files" => files,
"bulletin_carousel_images" => fa["bulletin_carousel_images"].to_a,
"title" => fa["title_translations"][locale],
"subtitle" => fa["subtitle_translations"][locale],
"statuses" => [status],