Add event_start_date and event_end_date seperated template.(index 20 and widget 19)

Add category custom translations.
This commit is contained in:
邱博亞 2024-01-28 15:04:23 +08:00
parent dfdefa3032
commit a55848b554
10 changed files with 158 additions and 5 deletions

View File

@ -42,6 +42,8 @@ class EventNewsModsController < ApplicationController
"statuses" => statuses, "statuses" => statuses,
"category" => (a.category.title rescue ""), "category" => (a.category.title rescue ""),
"postdate" => event_time, "postdate" => event_time,
"event_start_date" => a.event_date_frontend,
"event_end_date" => a.event_end_date_frontend,
"event-time-formated" => event_time_formated, "event-time-formated" => event_time_formated,
"event-time-css" => (event_time_formated.blank? ? "display: none;" : ""), "event-time-css" => (event_time_formated.blank? ? "display: none;" : ""),
"author" => author, "author" => author,
@ -69,6 +71,7 @@ class EventNewsModsController < ApplicationController
"event_news" => event_news, "event_news" => event_news,
"extras" => { "extras" => {
"widget-title" =>t('event_news.event_news'), "widget-title" =>t('event_news.event_news'),
"category-head" => EventNewsCustomTitle.get_trans('category'),
"title-head" => EventNewsCustomTitle.get_trans('title'), "title-head" => EventNewsCustomTitle.get_trans('title'),
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'), "speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
"place-head" => EventNewsCustomTitle.get_trans('place'), "place-head" => EventNewsCustomTitle.get_trans('place'),
@ -76,10 +79,11 @@ class EventNewsModsController < ApplicationController
"notes-head" => EventNewsCustomTitle.get_trans('notes'), "notes-head" => EventNewsCustomTitle.get_trans('notes'),
"event_date-head" => EventNewsCustomTitle.get_trans('event_date'), "event_date-head" => EventNewsCustomTitle.get_trans('event_date'),
"date-head" => EventNewsCustomTitle.get_trans('event_date'), "date-head" => EventNewsCustomTitle.get_trans('event_date'),
"event_start_date-head" => EventNewsCustomTitle.get_trans('start_date'),
"event_end_date-head" => EventNewsCustomTitle.get_trans('end_date'),
"status-head" => t('event_news.table.status'), "status-head" => t('event_news.table.status'),
"author-head" => t('event_news.table.author'), "author-head" => t('event_news.table.author'),
"subtitle-head" => t('event_news.table.sub_title'), "subtitle-head" => t('event_news.table.sub_title'),
"category-head" => t('event_news.table.category'),
"link-head" => t('event_news.table.link'), "link-head" => t('event_news.table.link'),
"file-head" => t('event_news.table.file'), "file-head" => t('event_news.table.file'),
"view-count-head" => t('event_news.table.view_count'), "view-count-head" => t('event_news.table.view_count'),
@ -376,6 +380,7 @@ class EventNewsModsController < ApplicationController
"more_url"=>OrbitHelper.widget_more_url, "more_url"=>OrbitHelper.widget_more_url,
"main_picture" => mp, "main_picture" => mp,
"main_picture_description" => mpd, "main_picture_description" => mpd,
"category-head" => EventNewsCustomTitle.get_trans('category'),
"title-head" => EventNewsCustomTitle.get_trans('title'), "title-head" => EventNewsCustomTitle.get_trans('title'),
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'), "speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
"place-head" => EventNewsCustomTitle.get_trans('place'), "place-head" => EventNewsCustomTitle.get_trans('place'),
@ -383,10 +388,11 @@ class EventNewsModsController < ApplicationController
"notes-head" => EventNewsCustomTitle.get_trans('notes'), "notes-head" => EventNewsCustomTitle.get_trans('notes'),
"event_date-head" => EventNewsCustomTitle.get_trans('event_date'), "event_date-head" => EventNewsCustomTitle.get_trans('event_date'),
"date-head" => EventNewsCustomTitle.get_trans('event_date'), "date-head" => EventNewsCustomTitle.get_trans('event_date'),
"event_start_date-head" => EventNewsCustomTitle.get_trans('start_date'),
"event_end_date-head" => EventNewsCustomTitle.get_trans('end_date'),
"author-head" => t('event_news.table.author'), "author-head" => t('event_news.table.author'),
"status-head" => t('event_news.table.status'), "status-head" => t('event_news.table.status'),
"subtitle-head" => t('event_news.table.sub_title'), "subtitle-head" => t('event_news.table.sub_title'),
"category-head" => t('event_news.table.category'),
"link-head" => t('event_news.table.link'), "link-head" => t('event_news.table.link'),
"file-head" => t('event_news.table.file'), "file-head" => t('event_news.table.file'),
"read_more" => read_more_url, "read_more" => read_more_url,
@ -836,6 +842,8 @@ class EventNewsModsController < ApplicationController
"statuses" => statuses, "statuses" => statuses,
"category" => (a.category.title rescue ""), "category" => (a.category.title rescue ""),
"postdate" => event_time, "postdate" => event_time,
"event_start_date" => a.event_date_frontend,
"event_end_date" => a.event_end_date_frontend,
"author" => author, "author" => author,
"is_top" => (a.is_top? ? 1 : 0), "is_top" => (a.is_top? ? 1 : 0),
"link_to_show" => link_to_show+"\" title=\"#{title}\"", "link_to_show" => link_to_show+"\" title=\"#{title}\"",
@ -861,6 +869,7 @@ class EventNewsModsController < ApplicationController
"event_news" => event_news, "event_news" => event_news,
"extras" => { "extras" => {
"widget-title" =>t('event_news.event_news'), "widget-title" =>t('event_news.event_news'),
"category-head" => EventNewsCustomTitle.get_trans('category'),
"title-head" => EventNewsCustomTitle.get_trans('title'), "title-head" => EventNewsCustomTitle.get_trans('title'),
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'), "speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
"place-head" => EventNewsCustomTitle.get_trans('place'), "place-head" => EventNewsCustomTitle.get_trans('place'),
@ -868,10 +877,11 @@ class EventNewsModsController < ApplicationController
"notes-head" => EventNewsCustomTitle.get_trans('notes'), "notes-head" => EventNewsCustomTitle.get_trans('notes'),
"event_date-head" => EventNewsCustomTitle.get_trans('event_date'), "event_date-head" => EventNewsCustomTitle.get_trans('event_date'),
"date-head" => EventNewsCustomTitle.get_trans('event_date'), "date-head" => EventNewsCustomTitle.get_trans('event_date'),
"event_start_date-head" => EventNewsCustomTitle.get_trans('start_date'),
"event_end_date-head" => EventNewsCustomTitle.get_trans('end_date'),
"status-head" => t('event_news.table.status'), "status-head" => t('event_news.table.status'),
"author-head" => t('event_news.table.author'), "author-head" => t('event_news.table.author'),
"subtitle-head" => t('event_news.table.sub_title'), "subtitle-head" => t('event_news.table.sub_title'),
"category-head" => t('event_news.table.category'),
"link-head" => t('event_news.table.link'), "link-head" => t('event_news.table.link'),
"file-head" => t('event_news.table.file'), "file-head" => t('event_news.table.file'),
"view-count-head" => t('event_news.table.view_count'), "view-count-head" => t('event_news.table.view_count'),

View File

@ -65,6 +65,8 @@ module EventNewsHelper
"category" => (a.category.title rescue ""), "category" => (a.category.title rescue ""),
"tag_ids" => (set_tag_ids.nil? ? (a.tag_ids.map{|id| id.to_s}.to_s.gsub('"',"'") rescue '[]') : set_tag_ids), "tag_ids" => (set_tag_ids.nil? ? (a.tag_ids.map{|id| id.to_s}.to_s.gsub('"',"'") rescue '[]') : set_tag_ids),
"postdate" => event_time_formated, "postdate" => event_time_formated,
"event_start_date" => a.event_date_frontend,
"event_end_date" => a.event_end_date_frontend,
"event_date" => event_time_formated, "event_date" => event_time_formated,
"author" => author, "author" => author,
"link_to_show" => link_to_show, "link_to_show" => link_to_show,

View File

@ -161,6 +161,24 @@ class EventNews
"#{st} ~ #{ed}" "#{st} ~ #{ed}"
end end
end end
def event_date_frontend
s = self.event_date.in_time_zone(Time.zone.utc_offset / 3600) rescue nil
if s.blank?
""
else
parse_format = self.date_parse_format
custom_strftime(s, self.date_parse_format)
end
end
def event_end_date_frontend
e = self.event_end_date.in_time_zone(Time.zone.utc_offset / 3600) rescue nil
if e.blank?
""
else
parse_format = self.date_parse_format
custom_strftime(e, self.date_parse_format)
end
end
def event_time_formated def event_time_formated
s = self.event_date.in_time_zone(Time.zone.utc_offset / 3600) rescue nil s = self.event_date.in_time_zone(Time.zone.utc_offset / 3600) rescue nil
e = self.event_end_date.in_time_zone(Time.zone.utc_offset / 3600) rescue nil e = self.event_end_date.in_time_zone(Time.zone.utc_offset / 3600) rescue nil

View File

@ -3,7 +3,7 @@ class EventNewsCustomTitle
include Mongoid::Timestamps include Mongoid::Timestamps
field :key field :key
field :title, type: String, localize: true field :title, type: String, localize: true
KEYS = ['title','speaker','host','event_date','place','notes'] KEYS = ['category', 'title','speaker','host','event_date','place','notes']
def self.get_map def self.get_map
KEYS.map do |k| KEYS.map do |k|
s = self.where(key: k).first || self.create(key: k,title_translations: I18n.available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("event_news.#{k}")}]}.to_h) s = self.where(key: k).first || self.create(key: k,title_translations: I18n.available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("event_news.#{k}")}]}.to_h)

View File

@ -4,6 +4,7 @@ en:
event_news_mod: event_news_mod:
event_news_mod: Event News event_news_mod: Event News
event_news: event_news:
category: Category
event_date_setting: "Event date setting" event_date_setting: "Event date setting"
event_date_use_default_setting: "Event date use default setting" event_date_use_default_setting: "Event date use default setting"
including_day_of_the_week: "Including day of the week" including_day_of_the_week: "Including day of the week"
@ -37,6 +38,8 @@ en:
notes: Notes notes: Notes
speaker: Speaker speaker: Speaker
host: Host host: Host
unit: Unit
employer: Employer
event_date: Event Date event_date: Event Date
event_end_date: Event End Date event_end_date: Event End Date
start_date: Start date start_date: Start date

View File

@ -4,6 +4,7 @@ zh_tw:
event_news_mod: event_news_mod:
event_news_mod: 活動公告 event_news_mod: 活動公告
event_news: event_news:
category: 類別
event_date_setting: "事件日期設定" event_date_setting: "事件日期設定"
event_date_use_default_setting: "使用預設的事件日期設定" event_date_use_default_setting: "使用預設的事件日期設定"
including_day_of_the_week: "包含星期幾" including_day_of_the_week: "包含星期幾"
@ -37,10 +38,12 @@ zh_tw:
notes: 備註 notes: 備註
speaker: 演講者 speaker: 演講者
host: 主持人 host: 主持人
unit: 公告單位
employer: 徵求單位
event_date: 事件日期 event_date: 事件日期
event_end_date: 事件結束日期 event_end_date: 事件結束日期
start_date: 公告日期 start_date: 公告日期
end_date: 下架日期 end_date: 截止日期
add_to_calendar: 加入行事曆 add_to_calendar: 加入行事曆
blank_to_set: (留白則使用公告設定) blank_to_set: (留白則使用公告設定)
stime: 開始時間 stime: 開始時間

View File

@ -0,0 +1,33 @@
<div class="i-annc index-announcement-12s w-annc widget-announcement-19">
<h3 class="w-annc__widget-title">
<span>{{widget-title}}</span>
</h3>
<table class="i-annc__table table table-striped">
<thead>
<tr>
<th class="i-annc__th i-annc__th--category">{{category-head}}</th>
<th class="i-annc__th i-annc__th--speaker">{{speaker-head}}</th>
<th class="i-annc__th i-annc__th--event_start_date">{{event_start_date-head}}</th>
<th class="i-annc__th i-annc__th--title">{{title-head}}</th>
<th class="i-annc__th i-annc__th--event_end_date">{{event_end_date-head}}</th>
<th class="i-annc__th i-annc__th--view-count">{{view-count-head}}</th>
</tr>
</thead>
<tbody data-level="0" data-list="event_news">
<tr>
<td class="i-annc__category">{{category}}</td>
<td class="i-annc__speaker">{{speaker}}</td>
<td class="i-annc__event_start_date"><span class="i-annc__event_start_date-content" date-format="%Y-%m-%d">{{event_start_date}}</span></td>
<td class="i-annc__content">
<span class="i-annc__status-wrap" data-list="statuses" data-level="1">
<span class="i-annc__status label status {{status-class}}">{{status}}</span>
</span>
<a class="i-annc__title" href="{{link_to_show}}">{{title}}</a>
</td>
<td class="i-annc__event_end_date"><span class="i-annc__event_end_date-content" date-format="%Y-%m-%d">{{event_end_date}}</span></td>
<td class="i-annc__view-count">{{view_count}}</td>
</tr>
</tbody>
</table>
</div>
{{pagination_goes_here}}

View File

@ -0,0 +1,29 @@
<div class="i-annc index-announcement-12s index-announcement-19 {{display}}">
<h1 class="i-annc__page-title">{{page-title}}</h1>
<table class="i-annc__table table table-striped">
<thead>
<tr>
<th class="i-annc__th i-annc__th--category">{{category-head}}</th>
<th class="i-annc__th i-annc__th--event_date">{{event_date-head}}</th>
<th class="i-annc__th i-annc__th--speaker">{{speaker-head}}</th>
<th class="i-annc__th i-annc__th--title">{{title-head}}</th>
<th class="i-annc__th i-annc__th--view-count">{{view-count-head}}</th>
</tr>
</thead>
<tbody data-level="0" data-list="event_news">
<tr>
<td class="i-annc__category">{{category}}</td>
<td class="i-annc__postdate"><span class="i-annc__postdate-content" date-format="%Y-%m-%d">{{postdate}}</span></td>
<td class="i-annc__speaker">{{speaker}}</td>
<td class="i-annc__content">
<span class="i-annc__status-wrap" data-list="statuses" data-level="1">
<span class="i-annc__status label status {{status-class}}">{{status}}</span>
</span>
<a class="i-annc__title" href="{{link_to_show}}">{{title}}</a>
</td>
<td class="i-annc__view-count">{{view_count}}</td>
</tr>
</tbody>
</table>
</div>
{{pagination_goes_here}}

View File

@ -0,0 +1,31 @@
<div class="i-annc index-announcement-12s index-announcement-20 {{display}}">
<h1 class="i-annc__page-title">{{page-title}}</h1>
<table class="i-annc__table table table-striped">
<thead>
<tr>
<th class="i-annc__th i-annc__th--category">{{category-head}}</th>
<th class="i-annc__th i-annc__th--speaker">{{speaker-head}}</th>
<th class="i-annc__th i-annc__th--event_start_date">{{event_start_date-head}}</th>
<th class="i-annc__th i-annc__th--title">{{title-head}}</th>
<th class="i-annc__th i-annc__th--event_end_date">{{event_end_date-head}}</th>
<th class="i-annc__th i-annc__th--view-count">{{view-count-head}}</th>
</tr>
</thead>
<tbody data-level="0" data-list="event_news">
<tr>
<td class="i-annc__category">{{category}}</td>
<td class="i-annc__speaker">{{speaker}}</td>
<td class="i-annc__event_start_date"><span class="i-annc__event_start_date-content" date-format="%Y-%m-%d">{{event_start_date}}</span></td>
<td class="i-annc__content">
<span class="i-annc__status-wrap" data-list="statuses" data-level="1">
<span class="i-annc__status label status {{status-class}}">{{status}}</span>
</span>
<a class="i-annc__title" href="{{link_to_show}}">{{title}}</a>
</td>
<td class="i-annc__event_end_date"><span class="i-annc__event_end_date-content" date-format="%Y-%m-%d">{{event_end_date}}</span></td>
<td class="i-annc__view-count">{{view_count}}</td>
</tr>
</tbody>
</table>
</div>
{{pagination_goes_here}}

View File

@ -143,6 +143,22 @@
"en" : "18. Standard Title List-2 ( EventDate, speaker, status, title, host, notes)" "en" : "18. Standard Title List-2 ( EventDate, speaker, status, title, host, notes)"
}, },
"thumbnail" : "event_news_index1_thumbs.png" "thumbnail" : "event_news_index1_thumbs.png"
},
{
"filename" : "event_news_index19",
"name" : {
"zh_tw" : "19. 標準標題列表-3 ( 類別, 日期, 演講者, 狀態, 標題, 瀏覽人次 )",
"en" : "19. Standard Title List-3 ( category, EventDate, speaker, status, title, view-count)"
},
"thumbnail" : "event_news_index1_thumbs.png"
},
{
"filename" : "event_news_index20",
"name" : {
"zh_tw" : "20. 標準標題列表-4 ( 類別, 演講者, 事件日期, 狀態, 標題, 截止日期, 瀏覽人次 )",
"en" : "20. Standard Title List-4 ( category, EventDate, speaker, EventDate, status, title, EndDate, view-count)"
},
"thumbnail" : "event_news_index1_thumbs.png"
} }
], ],
"widgets" : [ "widgets" : [
@ -292,6 +308,14 @@
}, },
"force_cover" : "true", "force_cover" : "true",
"thumbnail" : "event_news_widget13_thumbs.png" "thumbnail" : "event_news_widget13_thumbs.png"
},
{
"filename" : "event_news_widget19",
"name" : {
"zh_tw" : "19. 標準標題列表-3 ( 類別, 演講者, 事件日期, 狀態, 標題, 截止日期, 瀏覽人次 )",
"en" : "19. Standard Title List-3 ( category, EventDate, speaker, EventDate, status, title, EndDate, view-count)"
},
"thumbnail" : "event_news_widget7_thumbs.png"
} }
] ]
} }