Compare commits

..

3 Commits
master ... dev

Author SHA1 Message Date
rulingcom b255a407ae css fixes 2025-08-14 19:07:38 +08:00
rulingcom 4dcf74d9ac update for frontend 2025-07-30 22:37:11 +08:00
rulingcom 490a371a69 new hashtags 2025-07-30 12:44:10 +08:00
19 changed files with 421 additions and 745 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

View File

@ -123,15 +123,14 @@ class Admin::EventNewsController < OrbitAdminController
if update_flag
Thread.new do
begin
@module_app = ModuleApp.where(:key => 'event_news_mod').first
@event_news = EventNews.where(:category_id.ne=>nil).desc(:created_at)
last_updated = EventNews.max(:updated_at).to_i
filename = "public/event_news_export_#{last_updated}.xlsx"
if File.exist?(filename)
@thread.update(:status=>{:status=>'finish','finish_percent'=>100,'info'=>I18n.t('event_news.read_from_cache')})
else
excel_contents = render_to_string( handlers: [:axlsx], formats: [:xlsx] , partial: 'export_excel.xlsx' )
File.open(filename, 'wb') do |f|
excel_contents = render_to_string( handlers: [:axlsx], formats: [:xlsx] , layout: false, template: 'admin/event_news/export_excel.xlsx', locals: {:@event_news=>@event_news,:@thread=>@thread} )
File.open(filename, 'w') do |f|
f.write excel_contents
end
end

View File

@ -104,8 +104,7 @@ class EventNewsModsController < ApplicationController
"img_description" => desc,
"more" => t("event_news.more"),
"view_count" => a.view_count,
"orbithashtags" => a.hashtags_for_frontend,
"tag" => a.tags_for_frontend
"orbithashtags" => a.hashtags_for_frontend
}
else
a
@ -124,7 +123,6 @@ class EventNewsModsController < ApplicationController
"extras" => {
"widget-title" =>t('event_news.event_news'),
"category-head" => EventNewsCustomTitle.get_trans('category'),
"tag-head" => EventNewsCustomTitle.get_trans('tag'),
"title-head" => EventNewsCustomTitle.get_trans('title'),
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
"place-head" => EventNewsCustomTitle.get_trans('place'),
@ -678,20 +676,6 @@ class EventNewsModsController < ApplicationController
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"
carousel_data = {
"event_carousel_images" => event_carousel_images,
"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" => (event_carousel_images.count == 0 ? 'display: none' : "width: #{event_news.carousel_image_width};margin: auto;"),
"carousel_count" => event_carousel_images.count}
carousel_html = ""
if carousel_data["carousel_count"] != 0
carousel_image_type = event_news.carousel_image_type
ac = ActionController::Base.new()
carousel_html = ac.render_to_string(:partial=>'event_news_mods/carousels',:locals=>{:data=>carousel_data,:carousel_image_type=>carousel_image_type})
end
begin
event_time = event_news.event_time_formated_for_frontend
rescue => e
@ -707,13 +691,12 @@ class EventNewsModsController < ApplicationController
"autobiography" => member.autobiography
}
end
{
"tags" => tags,
"event_news_files" => files,
"profiles" => profiles,
"event_news_links" => links,
"other_member_profiles" => event_news.get_other_member_profiles_names_for_frontend,
"event_carousel_images" => event_carousel_images,
"data" => {
"title-head" => EventNewsCustomTitle.get_trans('title'),
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
@ -746,8 +729,7 @@ class EventNewsModsController < ApplicationController
"carousel_count" => event_carousel_images.count,
"place_text" => (event_news.place.blank? ? "" : "#{EventNewsCustomTitle.get_trans("place")}: #{event_news.place}"),
"place-css" => (event_news.place.blank? ? "display: none;" : ""),
"carousel_html" => carousel_html,
"orbithashtags" => event_news.hashtags_for_frontend,
"orbithashtags" => event_news.hashtags_for_frontend
},
"impressionist" => (event_news.is_preview ? nil : event_news),
"url_to_edit"=>url_to_edit
@ -819,26 +801,13 @@ class EventNewsModsController < ApplicationController
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"
carousel_data = {
"event_carousel_images" => event_carousel_images,
"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" => (event_carousel_images.count == 0 ? 'display: none' : "width: #{EventNewsSetting.last.carousel_image_width};margin: auto;"),
"carousel_count" => event_carousel_images.count}
carousel_html = ""
if carousel_data["carousel_count"] != 0
carousel_image_type = event_news["carousel_image_type"].to_i
ac = ActionController::Base.new()
carousel_html = ac.render_to_string(:partial=>'event_news_mods/carousels',:locals=>{:data=>carousel_data,:carousel_image_type=>carousel_image_type})
end
speaker = event_news["speaker_translations"][locale]
host = event_news["host_translations"][locale]
{
"tags" => tags,
"event_news_files" => files,
"event_news_links" => links,
"event_carousel_images" => event_carousel_images,
"data" => {
"title" => event_news["title_translations"][locale],
"subtitle_ann" => subtitle_ann,
@ -870,8 +839,7 @@ class EventNewsModsController < ApplicationController
"carousel_display_style" => (event_carousel_images.count == 0 ? 'display: none' : "width: #{EventNewsSetting.last.carousel_image_width};margin: auto;"),
"carousel_count" => event_carousel_images.count,
"place_text" => (event_news["place"].blank? ? "" : "#{I18n.t("event_news.place")}: #{event_news["place"]}"),
"place-css" => (event_news["place"].blank? ? "display: none;" : ""),
"carousel_html" => carousel_html
"place-css" => (event_news["place"].blank? ? "display: none;" : "")
},
"impressionist" => nil,
"url_to_edit" => url_to_edit

View File

@ -53,7 +53,6 @@ class EventNews
field :hour_clock_24, type: Boolean, default: true
field :is_edit, type: Boolean, default: false #use to check whether the preview record changed
field :copy_id
field :custom_carousel_image_type, :type => Integer, :default => 0 # 0: default, 1: carousel, 2: album
field :custom_carousel_image_width, type: String, default: ""
field :image_display_class, type: String, default: "full-size-img" #3 choices: full-size-img , pull-left , pull-right
field :add_to_calendar,type: Boolean,default: false
@ -109,8 +108,6 @@ class EventNews
accepts_nested_attributes_for :event_carousel_images, :allow_destroy => true
before_destroy :destroy_email
before_save :calculate_is_event_expired
scope :open_in_future, ->{where(:is_hidden.ne=>true,:is_preview.ne => true,:postdate.gt=>Time.now).order(postdate: :asc)}
scope :can_display_and_sorted, ->{
is_approved_and_show
@ -339,10 +336,6 @@ class EventNews
MemberProfile.find(self.email_member_ids) rescue []
end
def get_other_member_profiles_names_for_frontend
MemberProfile.find(self.other_member_profiles).map{|m,n| {"name" => m.name}} rescue []
end
def email_addresses
addresses = self.email_members.collect{|member| member.email} rescue []
addresses = addresses +[self.other_mailaddress] if !self.other_mailaddress.blank?
@ -357,21 +350,6 @@ class EventNews
(self.deadline < Time.now) rescue false
end
def calculate_is_event_expired
setting = EventNewsSetting.first
if setting && setting.expired_event_to_bottom
if self.new_record?
self.is_top = true
self.top_end_date = event_end_date if event_end_date.present?
elsif event_end_date_changed? && event_end_date.present?
self.is_top = true
self.top_end_date = event_end_date
elsif event_end_date.blank? && self.top_end_date.present?
self.top_end_date = nil
end
end
end
def destroy_email
mail = Email.find(self.email_id) rescue nil
mail.destroy if !mail.nil?
@ -422,11 +400,8 @@ class EventNews
def hidden_text
I18n.t("announcement.status.hidden")
end
def carousel_image_type
(self.custom_carousel_image_type == 0 ? EventNewsSetting.last.carousel_image_type : self.custom_carousel_image_type - 1) rescue 0
end
def carousel_image_width
(self.custom_carousel_image_width.blank? ? EventNewsSetting.last.carousel_image_width : self.custom_carousel_image_width)
(self.custom_carousel_image_width.blank? ? AnnouncementSetting.last.carousel_image_width : self.custom_carousel_image_width)
end
def self.agenda_events(agenda_start, agenda_end,read_more_url)

View File

@ -1,24 +1,24 @@
class EventNewsCustomTitle
include Mongoid::Document
include Mongoid::Timestamps
field :key
field :title, type: String, localize: true
KEYS = ['category','tag','title','speaker','host','event_date','event_end_date','place','notes']
def self.get_map
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)
if s.title_translations.select{|k,v| v.include?("translation missing")}.length>0
s.update_attributes(title_translations: I18n.available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("event_news.#{k}")}]}.to_h)
end
s
end
end
def default_title
I18n.t("event_news.#{self.key}")
end
def self.get_trans(key)
tmp = TitleMap[key][I18n.locale] rescue I18n.t("event_news.#{key}")
tmp.blank? ? I18n.t("event_news.#{key}") : tmp
end
TitleMap = self.get_map.map{|v| [v.key,v.title_translations]}.to_h
end
class EventNewsCustomTitle
include Mongoid::Document
include Mongoid::Timestamps
field :key
field :title, type: String, localize: true
KEYS = ['category', 'title','speaker','host','event_date','place','notes']
def self.get_map
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)
if s.title_translations.select{|k,v| v.include?("translation missing")}.length>0
s.update_attributes(title_translations: I18n.available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("event_news.#{k}")}]}.to_h)
end
s
end
end
def default_title
I18n.t("event_news.#{self.key}")
end
def self.get_trans(key)
tmp = TitleMap[key][I18n.locale] rescue I18n.t("event_news.#{key}")
tmp.blank? ? I18n.t("event_news.#{key}") : tmp
end
TitleMap = self.get_map.map{|v| [v.key,v.title_translations]}.to_h
end

View File

@ -10,8 +10,6 @@ class EventNewsFile
field :title, localize: true
field :choose_lang, :type => Array, :default => ["en","zh_tw"]
field :privacy_type, type: String, default: 'public'
field :position, type: Integer, default: 0
default_scope ->{ order_by(position: :asc) }
belongs_to :event_news
def self.to_fronted(locale=I18n.locale)
self.all.map{|file| file.to_fronted(locale)}.compact rescue []

View File

@ -1,7 +1,6 @@
class EventNewsSetting
include Mongoid::Document
include Mongoid::Timestamps
field :carousel_image_type, :type => Integer, :default => 0 # 0: carousel, 1: album
field :carousel_image_width, type: String, :default => "75%"
field :top_limit, type: Integer, :default => 0
field :pro_enabled, type: Boolean, :default => false
@ -14,7 +13,6 @@ class EventNewsSetting
field :hour_clock_24, type: Boolean, default: true
field :enable_manually_sort, type: Boolean, default: false
field :is_postdate_sort_first, type: Boolean, default: false
field :expired_event_to_bottom, type: Boolean, default: false
field :migrate_flag, type: Array, default: []
@ -129,4 +127,4 @@ class EventNewsSetting
end
end
end
end
end

View File

@ -3,24 +3,6 @@
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<style type="text/css">
.sort-order-icon {
font-size: 25px;
}
.ui-state-highlight {
height: 40px;
background-color: #fcf8e3;
border: 1px dashed #fbeed5;
margin-bottom: 10px;
list-style: none;
}
.exist .file-link {
cursor: grab;
}
.icons-list-2 {
cursor: all-scroll;
}
</style>
<style type="text/css">
[aria-describedby] ul.dropdown-menu {
display: block;
@ -105,7 +87,7 @@
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= EventNewsCustomTitle.get_trans('event_end_date') %></label>
<label class="control-label muted"><%= t("event_news.event_end_date") %></label>
<div class="controls">
<%= f.datetime_picker :event_end_date, :no_label => true, :new_record => @event_news.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
</div>
@ -314,7 +296,7 @@
<% if @event_news.image.file %>
<%= image_tag @event_news.image %>
<% else %>
<img src="/assets/event_news/AAAAAA" />
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
<% end %>
</div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
@ -347,13 +329,6 @@
<!-- Images Module -->
<div class="tab-pane fade" id="carousel_image_upload">
<div class="control-group">
<%= f.label :custom_carousel_image_type, t("event_news.default_carousel_image_type"), :class => "control-label muted" %>
<div class="controls">
<% carousel_image_types = ["default","carousel","album"] %>
<%= f.select :custom_carousel_image_type, options_for_select(carousel_image_types.map.with_index{|type,i| [t("event_news.carousel_image_types.#{type}"),i]}.to_h,:selected => f.object.custom_carousel_image_type) %>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="carousel_image_width"><%= t("event_news.carousel_image_width") %></label>
<div class="controls">
@ -378,6 +353,7 @@
<a id="add_carousel_image" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
<!-- Mail Group Module -->
<div class="tab-pane fade" id="mail-group">
@ -427,6 +403,7 @@
<% end %>
</div>
</div>
<!-- Language Tabs -->
@ -451,7 +428,7 @@
<label class="control-label muted"><%= t(:title) %></label>
<div class="controls">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_area locale, class: "ckeditor_reduce input-block-level", value: (@event_news.title_translations[locale] rescue nil) %>
<%= f.text_area locale, class: "ckeditor_reduce input-block-level", placeholder: t(:title), value: (@event_news.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
@ -460,7 +437,7 @@
<label class="control-label muted"><%= EventNewsCustomTitle.get_trans('speaker') %></label>
<div class="controls">
<%= f.fields_for :speaker_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", value: (@event_news.speaker_translations[locale] rescue nil) %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("event_news.speaker"), value: (@event_news.speaker_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
@ -469,7 +446,7 @@
<label class="control-label muted"><%= EventNewsCustomTitle.get_trans('place') %></label>
<div class="controls">
<%= f.fields_for :place_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", value: (@event_news.place_translations[locale] rescue nil) %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("event_news.place"), value: (@event_news.place_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
@ -478,7 +455,7 @@
<label class="control-label muted"><%= EventNewsCustomTitle.get_trans('host') %></label>
<div class="controls">
<%= f.fields_for :host_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", value: (@event_news.host_translations[locale] rescue nil) %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("event_news.host"), value: (@event_news.host_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
@ -558,12 +535,9 @@
<% if @event_news && !@event_news.event_news_files.blank? %>
<div class="exist">
<% @event_news.event_news_files.each_with_index do |event_news_file, i| %>
<div class="file-sort-item">
<%= f.fields_for :event_news_files, event_news_file do |f| %>
<%= f.hidden_field :position, class: "file-position" %>
<%= render :partial => 'form_file', :object => event_news_file, :locals => {:f => f, :i => i} %>
<% end %>
</div>
<%= f.fields_for :event_news_files, event_news_file do |f| %>
<%= render :partial => 'form_file', :object => event_news_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
@ -750,28 +724,5 @@
}
})
function init_file_sortable() {
var $container = $(".exist");
if ($container.data("ui-sortable")) {
$container.sortable("destroy");
}
$container.sortable({
items: ".file-sort-item",
handle: ".sort-order-icon, .file-link",
axis: "y",
placeholder: "ui-state-highlight",
forcePlaceholderSize: true,
update: function(event, ui) {
$(".file-sort-item").each(function(index) {
$(this).find("input.file-position").val(index);
});
}
});
}
init_file_sortable();
});
</script>

View File

@ -2,7 +2,6 @@
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exists start-line" data-provides="fileupload">
<i class="icons-list-2 sort-order-icon ui-sortable-handle"></i>
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>

View File

@ -8,7 +8,7 @@
<% if form_image.file.file %>
<%= image_tag form_image.file %>
<% else %>
<img src="/assets/event_news/AAAAAA" />
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
<% end %>
</div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>

View File

@ -1,256 +1,256 @@
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: "EventNewsModule") do |sheet|
heading = sheet.styles.add_style(:b => true, :locked => true)
example = sheet.styles.add_style(:i => true)
row = []
row1 = []
row2 = []
row << t("category")
row1 << "select"
t = ""
categories = @module_app.categories.asc(:created_at)
categories.each_with_index do |cat,i|
t = t + "#{i}" + " -> " + cat.title + ", "
end
if categories.count > 0
t = t + " Example : 0"
else
t = "Leave this field blank"
end
row2 << t
row << t("tags")
row1 << "select"
t = ""
tags = @module_app.tags.asc(:created_at)
tags.each_with_index do |tag,i|
t = t + "#{i}" + " -> " + tag.name + ", "
end
if tags.count > 0
t = t + " Example : 0,1,2"
else
t = "Leave this field blank"
end
row2 << t
row << t("event_news.event_date")
row1 << "datetime"
row2 << "Format: YYYY/MM/DD HH:mm, Example: 2015/12/10 15:20"
row << t("event_news.start_date")
row1 << "datetime"
row2 << "Format: YYYY/MM/DD HH:mm, Example: 2015/12/10 15:30"
row << t("event_news.end_date")
row1 << "datetime"
row2 << "Format: YYYY/MM/DD HH:mm, Example: 2015/12/12 17:30"
row << t("top")
row1 << "boolean"
row2 << "0 for false, 1 for true"
row << t("hot")
row1 << "boolean"
row2 << "0 for false, 1 for true"
row << t("hide")
row1 << "boolean"
row2 << "0 for false, 1 for true "
row << t("image")
row1 << "url"
row2 << "http://www.example.com/images/example.png"
row << t("image") + " " + t("description") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("image") + " " + t("description") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("title") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("title") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("event_news.speaker") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("event_news.speaker") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("event_news.host") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("event_news.host") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("subtitle") + " - " + t("en")
row1 << "textarea"
row2 << ""
row << t("subtitle") + " - " + t("zh_tw")
row1 << "textarea"
row2 << ""
row << t("content") + " - " + t("en")
row1 << "editor"
row2 << ""
row << t("content") + " - " + t("zh_tw")
row1 << "editor"
row2 << ""
row << t("event_news.notes") + " - " + t("en")
row1 << "editor"
row2 << ""
row << t("event_news.notes") + " - " + t("zh_tw")
row1 << "editor"
row2 << ""
row << t("link")
row1 << "textfield"
row2 << "Seperate with ';'. Example: http://rulingcom.com; http://google.com"
row << t("link") + " " + t("url_alt") + " - " + t("en")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Rulingcom official site; Google search engine"
row << t("link") + " " + t("url_alt") + " - " + t("zh_tw")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Rulingcom official site; Google search engine"
row << t("file_")
row1 << "textfield"
row2 << "Seperate with ';'. Example: http://www.example.com/images/example.png; http://www.example.com/images/example2.png"
row << t("file_") + " " + t("description") + " - " + t("en")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
row << t("file_") + " " + t("description") + " - " + t("zh_tw")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
row << t("file_") + " " + t("alternative") + " - " + t("en")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : example1; example2"
row << t("file_") + " " + t("alternative") + " - " + t("zh_tw")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : example1; example2"
row << t("event_news.place") + "-" + t("en")
row1 << "textfield"
row2 << ""
row << t("event_news.place") + "-" + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("event_news.event_end_date")
row1 << "datetime"
row2 << "Format: YYYY/MM/DD HH:mm, Example: 2015/12/10 15:20"
row << t("event_news.carousel_image") + "-" + t("image")
row1 << "url"
row2 << "Seperate with ';'. Example: http://www.example.com/images/example.png; http://www.example.com/images/example2.png"
row << t("event_news.carousel_image") + "-" + t("description") + " - " + t("en")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
row << t("event_news.carousel_image") + "-" + t("description") + " - " + t("zh_tw")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
sheet.add_row row, :style => heading
sheet.add_row row1
sheet.add_row row2, :style => example
if @thread
all_count = @event_news.count
puts_every_count = [all_count * 3 / 100, 1].max
current_count = 0
finish_percent = 0
@thread.update(:status=>{:status=>'Processing','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent})
end
@event_news.each do |anns|
row = []
row << categories.to_a.index(anns.category)
t = []
anns.tags.each do |tag|
t << tags.to_a.index(tag)
end
row << t.join(",")
row << (anns.event_date.strftime("%Y/%m/%d %H:%M") rescue "")
row << (anns.postdate.strftime("%Y/%m/%d %H:%M") rescue "")
row << (anns.deadline.strftime("%Y/%m/%d %H:%M") rescue "")
row << (anns.is_top? ? 1 : 0)
row << (anns.is_hot? ? 1 : 0)
row << (anns.is_hidden? ? 1 : 0)
row << ("http://" + request.host_with_port + anns.image.url rescue "")
row << anns.image_description_translations["en"]
row << anns.image_description_translations["zh_tw"]
row << anns.title_translations["en"]
row << anns.title_translations["zh_tw"]
row << anns.speaker_translations["en"]
row << anns.speaker_translations["zh_tw"]
row << anns.host_translations["en"]
row << anns.host_translations["zh_tw"]
row << anns.subtitle_translations["en"]
row << anns.subtitle_translations["zh_tw"]
row << anns.text_translations["en"]
row << anns.text_translations["zh_tw"]
row << anns.notes_translations["en"]
row << anns.notes_translations["zh_tw"]
links = anns.event_news_links.asc(:created_at)
t = links.collect{|l|l.url}
row << t.join(";")
t = links.collect{|l|l.title_translations["en"]}
row << t.join(";")
t = links.collect{|l|l.title_translations["zh_tw"]}
row << t.join(";")
files = anns.event_news_files.asc(:created_at)
t = files.collect{|f|("http://" + request.host_with_port + f.file.url rescue nil)}
t.delete(nil)
row << t.join(";")
t = files.collect{|l|l.description_translations["en"]}
row << t.join(";")
t = files.collect{|l|l.description_translations["zh_tw"]}
row << t.join(";")
t = files.collect{|l|l.title_translations["en"]}
row << t.join(";")
t = files.collect{|l|l.title_translations["zh_tw"]}
row << t.join(";")
row << anns.place_translations["en"]
row << anns.place_translations["zh_tw"]
row << (anns.event_end_date.strftime("%Y/%m/%d %H:%M") rescue "")
carousel_images = anns.event_carousel_images.asc(:created_at)
t = carousel_images.collect{|f|("http://" + request.host_with_port + f.file.url rescue nil)}
t.delete(nil)
row << t.join(";")
t = carousel_images.collect{|l|l.description_translations["en"]}
row << t.join(";")
t = carousel_images.collect{|l|l.description_translations["zh_tw"]}
row << t.join(";")
sheet.add_row row
if @thread
current_count += 1
if current_count % puts_every_count == 0
finish_percent = (current_count * 100.0 / all_count).round(1)
@thread.update(:status=>{:status=>'Processing','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent})
end
end
end
if @thread
finish_percent = 100
@thread.update(:status=>{:status=>'finish','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent})
end
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: "EventNewsModule") do |sheet|
heading = sheet.styles.add_style(:b => true, :locked => true)
example = sheet.styles.add_style(:i => true)
row = []
row1 = []
row2 = []
row << t("category")
row1 << "select"
t = ""
categories = @module_app.categories.asc(:created_at)
categories.each_with_index do |cat,i|
t = t + "#{i}" + " -> " + cat.title + ", "
end
if categories.count > 0
t = t + " Example : 0"
else
t = "Leave this field blank"
end
row2 << t
row << t("tags")
row1 << "select"
t = ""
tags = @module_app.tags.asc(:created_at)
tags.each_with_index do |tag,i|
t = t + "#{i}" + " -> " + tag.name + ", "
end
if tags.count > 0
t = t + " Example : 0,1,2"
else
t = "Leave this field blank"
end
row2 << t
row << t("event_news.event_date")
row1 << "datetime"
row2 << "Format: YYYY/MM/DD HH:mm, Example: 2015/12/10 15:20"
row << t("event_news.start_date")
row1 << "datetime"
row2 << "Format: YYYY/MM/DD HH:mm, Example: 2015/12/10 15:30"
row << t("event_news.end_date")
row1 << "datetime"
row2 << "Format: YYYY/MM/DD HH:mm, Example: 2015/12/12 17:30"
row << t("top")
row1 << "boolean"
row2 << "0 for false, 1 for true"
row << t("hot")
row1 << "boolean"
row2 << "0 for false, 1 for true"
row << t("hide")
row1 << "boolean"
row2 << "0 for false, 1 for true "
row << t("image")
row1 << "url"
row2 << "http://www.example.com/images/example.png"
row << t("image") + " " + t("description") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("image") + " " + t("description") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("title") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("title") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("event_news.speaker") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("event_news.speaker") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("event_news.host") + " - " + t("en")
row1 << "textfield"
row2 << ""
row << t("event_news.host") + " - " + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("subtitle") + " - " + t("en")
row1 << "textarea"
row2 << ""
row << t("subtitle") + " - " + t("zh_tw")
row1 << "textarea"
row2 << ""
row << t("content") + " - " + t("en")
row1 << "editor"
row2 << ""
row << t("content") + " - " + t("zh_tw")
row1 << "editor"
row2 << ""
row << t("event_news.notes") + " - " + t("en")
row1 << "editor"
row2 << ""
row << t("event_news.notes") + " - " + t("zh_tw")
row1 << "editor"
row2 << ""
row << t("link")
row1 << "textfield"
row2 << "Seperate with ';'. Example: http://rulingcom.com; http://google.com"
row << t("link") + " " + t("url_alt") + " - " + t("en")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Rulingcom official site; Google search engine"
row << t("link") + " " + t("url_alt") + " - " + t("zh_tw")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Rulingcom official site; Google search engine"
row << t("file_")
row1 << "textfield"
row2 << "Seperate with ';'. Example: http://www.example.com/images/example.png; http://www.example.com/images/example2.png"
row << t("file_") + " " + t("description") + " - " + t("en")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
row << t("file_") + " " + t("description") + " - " + t("zh_tw")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
row << t("file_") + " " + t("alternative") + " - " + t("en")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : example1; example2"
row << t("file_") + " " + t("alternative") + " - " + t("zh_tw")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : example1; example2"
row << t("event_news.place") + "-" + t("en")
row1 << "textfield"
row2 << ""
row << t("event_news.place") + "-" + t("zh_tw")
row1 << "textfield"
row2 << ""
row << t("event_news.event_end_date")
row1 << "datetime"
row2 << "Format: YYYY/MM/DD HH:mm, Example: 2015/12/10 15:20"
row << t("event_news.carousel_image") + "-" + t("image")
row1 << "url"
row2 << "Seperate with ';'. Example: http://www.example.com/images/example.png; http://www.example.com/images/example2.png"
row << t("event_news.carousel_image") + "-" + t("description") + " - " + t("en")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
row << t("event_news.carousel_image") + "-" + t("description") + " - " + t("zh_tw")
row1 << "textfield"
row2 << "Seperate with ';' with respective to the links in the link columns. Example : Great view; Nice potrait"
sheet.add_row row, :style => heading
sheet.add_row row1
sheet.add_row row2, :style => example
if @thread
all_count = @event_news.count
puts_every_count = [all_count * 3 / 100, 1].max
current_count = 0
finish_percent = 0
@thread.update(:status=>{:status=>'Processing','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent})
end
@event_news.each do |anns|
row = []
row << categories.to_a.index(anns.category)
t = []
anns.tags.each do |tag|
t << tags.to_a.index(tag)
end
row << t.join(",")
row << (anns.event_date.strftime("%Y/%m/%d %H:%M") rescue "")
row << (anns.postdate.strftime("%Y/%m/%d %H:%M") rescue "")
row << (anns.deadline.strftime("%Y/%m/%d %H:%M") rescue "")
row << (anns.is_top? ? 1 : 0)
row << (anns.is_hot? ? 1 : 0)
row << (anns.is_hidden? ? 1 : 0)
row << ("http://" + request.host_with_port + anns.image.url rescue "")
row << anns.image_description_translations["en"]
row << anns.image_description_translations["zh_tw"]
row << anns.title_translations["en"]
row << anns.title_translations["zh_tw"]
row << anns.speaker_translations["en"]
row << anns.speaker_translations["zh_tw"]
row << anns.host_translations["en"]
row << anns.host_translations["zh_tw"]
row << anns.subtitle_translations["en"]
row << anns.subtitle_translations["zh_tw"]
row << anns.text_translations["en"]
row << anns.text_translations["zh_tw"]
row << anns.notes_translations["en"]
row << anns.notes_translations["zh_tw"]
links = anns.event_news_links.asc(:created_at)
t = links.collect{|l|l.url}
row << t.join(";")
t = links.collect{|l|l.title_translations["en"]}
row << t.join(";")
t = links.collect{|l|l.title_translations["zh_tw"]}
row << t.join(";")
files = anns.event_news_files.asc(:created_at)
t = files.collect{|f|("http://" + request.host_with_port + f.file.url rescue nil)}
t.delete(nil)
row << t.join(";")
t = files.collect{|l|l.description_translations["en"]}
row << t.join(";")
t = files.collect{|l|l.description_translations["zh_tw"]}
row << t.join(";")
t = files.collect{|l|l.title_translations["en"]}
row << t.join(";")
t = files.collect{|l|l.title_translations["zh_tw"]}
row << t.join(";")
row << anns.place_translations["en"]
row << anns.place_translations["zh_tw"]
row << (anns.event_end_date.strftime("%Y/%m/%d %H:%M") rescue "")
carousel_images = anns.event_carousel_images.asc(:created_at)
t = carousel_images.collect{|f|("http://" + request.host_with_port + f.file.url rescue nil)}
t.delete(nil)
row << t.join(";")
t = carousel_images.collect{|l|l.description_translations["en"]}
row << t.join(";")
t = carousel_images.collect{|l|l.description_translations["zh_tw"]}
row << t.join(";")
sheet.add_row row
if @thread
current_count += 1
if current_count % puts_every_count == 0
finish_percent = (current_count * 100.0 / all_count).round(1)
@thread.update(:status=>{:status=>'Processing','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent})
end
end
end
if @thread
finish_percent = 100
@thread.update(:status=>{:status=>'finish','all_count'=>all_count,'current_count'=>current_count,'finish_percent'=>finish_percent})
end
end

View File

@ -130,13 +130,6 @@
<div id="notification"><%= t("event_news.click_on_submit") %></div>
<%= form_for @setting, url: (@setting.new_record? ? admin_event_news_createsettings_path : admin_event_news_updatesettings_path), html: {class: "form-horizontal main-forms"} do |f| %>
<div class="input-area">
<div class="control-group">
<%= f.label :carousel_image_type, t("event_news.default_carousel_image_type"), :class => "control-label muted" %>
<div class="controls">
<% carousel_image_types = ["carousel","album"] %>
<%= f.select :carousel_image_type, options_for_select(carousel_image_types.map.with_index{|type,i| [t("event_news.carousel_image_types.#{type}"),i]}.to_h,:selected => f.object.carousel_image_type) %>
</div>
</div>
<div class="control-group">
<%= f.label :carousel_image_width, t("event_news.default_carousel_image_width"), :class => "control-label muted" %>
<div class="controls">
@ -182,12 +175,6 @@
<%= f.check_box :is_postdate_sort_first %>
</div>
</div>
<div class="control-group">
<%= f.label :expired_event_to_bottom, t("event_news.expired_event_to_bottom"), :class => "control-label muted" %>
<div class="controls">
<%= f.check_box :expired_event_to_bottom %>
</div>
</div>
<div class="control-group">
<%= f.label :top_limit, t("event_news.top_limit"), :class => "control-label muted" %>
<div class="controls">
@ -434,4 +421,4 @@
});
});
})
</script>
</script>

View File

@ -1 +0,0 @@
<%= render(:partial=>"event_news_mods/carousels#{carousel_image_type}", :locals=>{:data=>data}) %>

View File

@ -1,283 +0,0 @@
<style type="text/css">
strong.carousel__description {
color: white;
}
.carousel_images{
<%=data["carousel_display_style"]%>
}
@media (max-width: 767px){
.carousel_images{
width: 100%;
}
}
</style>
<div class="carousel_images">
<div class="w-ba-banner ba-banner-widget-1">
<div class="w-ba-banner__wrap cycle-slideshow"
data-cycle-slides=".event_carousel_slide"
data-cycle-log="false"
data-cycle-auto-height="0"
data-cycle-speed="300"
data-cycle-timeout="5000"
data-cycle-fx="fade"
data-pager-active-class="active-slide"
data-cycle-swipe=true
data-cycle-swipe-fx="scrollHorz"
>
<%data["event_carousel_images"].each do |event_carousel_image|%>
<div class="w-ba-banner__slide event_carousel_slide"
data-cycle-title="<%=event_carousel_image["description_text"]%>"
>
<img class="w-ba-banner__image banner-responsive" src="<%=event_carousel_image["src"]%>" alt="<%=event_carousel_image["description_text"]%>">
<div class="ad-overlay w-ad-banner__overlay event_carousel__overlay">
<p><strong class="carousel__description"><%=event_carousel_image["description"]%></strong></p>
</div>
<div class="transitionfade"></div>
</div>
<% end %>
</div>
<ul class="controlplay"><a class="resume-slide" title = "<%=data["resume_btn_title"]%>"><i></i></a><a class="pause-slide" title = "<%=data["pause_btn_title"]%>"><i></i></a></ul>
<ul class="button-mid">
<i class="fa fa-angle-left prev-button" aria-hidden="true" title = "<%=data["prev_btn_title"]%>"></i>
<i class="fa fa-angle-right next-button" aria-hidden="true" title = "<%=data["next_btn_title"]%>"></i>
</ul>
</div>
<div style="position: relative;">
<h4><span class="active_slide">1</span>/<%=data["carousel_count"]%></h4>
<ul class="carousel_images_slide w-annc__list row list-unstyled">
<%data["event_carousel_images"].each do |event_carousel_image|%>
<li class="carousel_img_item col-sm-3">
<div class="carousel_img-wrap">
<img class="carousel_img" src="<%=event_carousel_image["src"]%>" alt="<%=event_carousel_image["description_text"]%>">
</div>
</li>
<%end%>
</ul>
<ul class="button-mid">
<i class="fa fa-angle-left prev-button prev_img" aria-hidden="true" title="<%=data["prev_btn_title"]%>"></i>
<i class="fa fa-angle-right next-button next_img" aria-hidden="true" title="<%=data["next_btn_title"]%>"></i>
</ul>
</div>
</div>
<style type="text/css">
.carousel_img_item{
display: none;
float: left;
}
.controlplay {
position: absolute;
right: 1em;
top: 3%;
z-index: 200;
}
.controlplay a {
display: inline-block;
margin-right: 0.25em;
cursor: pointer;
padding: 5px 10px;
border: 1px solid rgba(255,255,255,0.5);
background: rgba(0,0,0,0.2);
}
.controlplay a i {
font-family: FontAwesome;
position: relative;
font-size: 1rem;
line-height: 1;
color: #FFF;
vertical-align: middle;
font-style: unset;
}
.controlplay .resume-slide i::before {
content: "\f04b";
}
.controlplay .pause-slide i::before {
content: "\f04c";
}
ul.button-mid .prev-button {
transition: 0.4s;
position: relative;
float: left;
left: 0.5rem;
width: 2.5rem;
height: 2.5rem;
font-size: 2.2rem;
color: #ffffff;
background: rgba(0,0,0,0.2);
text-align: center;
line-height: 2.5rem;
top: 50%;
position: absolute;
transform: translateY(-50%);
z-index: 999;
}
ul.button-mid .next-button {
float: right;
transition: 0.4s;
position: relative;
right: 0.5rem;
width: 2.5rem;
height: 2.5rem;
font-size: 2.2rem;
color: #fff;
background: rgba(0,0,0,0.2);
text-align: center;
line-height: 2.5rem;
top: 50%;
position: absolute;
transform: translateY(-50%);
z-index: 999;
}
.carousel_images_slide{
padding: 3em;
}
.carousel_img_item img{
cursor: pointer;
}
@media (max-width: 479px){
.carousel_img_item:nth-child(-n+1){
display: block;
width: 100%;
float: left;
}
.carousel_img_item{
width: 100%;
}
}
@media (min-width: 480px){
.carousel_img_item:nth-child(-n+2){
display: block;
width: 50%;
float: left;
}
.carousel_img_item{
width: 50%;
}
}
@media (min-width: 768px){
.carousel_img_item:nth-child(-n+3){
display: block;
width: 33%;
float: left;
}
.carousel_img_item{
width: 33%;
}
}
@media (min-width: 1280px){
.carousel_img_item:nth-child(-n+4){
display: block;
width: 25%;
float: left;
}
.carousel_img_item{
width: 25%;
}
}
</style>
<script>
(function($) {
$('.pause-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
});
$('.resume-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('resume');
});
$('.next-button').off('click').on('click',function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("next");
})
$('.prev-button').off('click').on('click',function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
})
window.active_slide = 0;
$('.prev_img').off('click').on('click',function(){
var carousel_images_slide = $('.carousel_images_slide');
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
if(carousel_images_slide_first_child.length > 0){
var content_size = Math.floor((carousel_images_slide.outerWidth() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.outerWidth(true));
content_size = Math.max(content_size,1);
if(carousel_images_slide.find(">li").length > content_size && active_slide > 0){
active_slide -= content_size;
carousel_images_slide.find(">li").css("display","none");
for(var i = active_slide; i < active_slide + content_size;i++){
carousel_images_slide.find(">li").eq(i).css("display","block");
}
}
}
})
$('.next_img').off('click').on('click',function(){
var carousel_images_slide = $('.carousel_images_slide');
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
if(carousel_images_slide_first_child.length > 0){
var content_size = Math.floor((carousel_images_slide.outerWidth() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.outerWidth(true));
content_size = Math.max(content_size,1);
var li_length = carousel_images_slide.find(">li").length;
if(li_length > content_size){
active_slide += content_size;
active_slide = Math.min(active_slide,li_length - 1);
carousel_images_slide.find(">li").css("display","none");
for(var i = active_slide; i < active_slide + content_size;i++){
carousel_images_slide.find(">li").eq(i).css("display","block");
}
}
}
})
$(".carousel_img_item img").off("click").on("click",function(){
$(".carousel_images .cycle-slideshow").cycle($(this).index(".carousel_img_item img"));
})
$(document).ready(function(){
$(".carousel_images .cycle-slideshow").cycle('pause');
var carousel_image_block_width = $('.carousel_images').width();
var heights = $(".event_carousel_slide").map(function(i,v){
return $(v).height() * carousel_image_block_width / $(v).width();
})
var max_height = Math.max.apply(null,heights);
$(".event_carousel_slide").each(function(i,v){
$(v).height(max_height);
})
$(".carousel_images .cycle-slideshow").cycle('resume');
$('.cycle-slideshow').on('cycle-after',function(){
$(".active_slide").text($('.event_carousel_slide.cycle-slide-active').index());
})
})
$(window).on("load",function(){
$(".carousel_images .cycle-slideshow").cycle('pause');
var carousel_image_block_width = $('.carousel_images').width();
var heights = $(".event_carousel_slide").map(function(i,v){
return $(v).height() * carousel_image_block_width / $(v).width();
})
var max_height = Math.max.apply(null,heights);
$(".event_carousel_slide").each(function(i,v){
$(v).height(max_height);
})
$(".carousel_images .cycle-slideshow").cycle('resume');
})
$(window).resize(function(){
var carousel_images_slide = $('.carousel_images_slide');
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
if(carousel_images_slide_first_child.length > 0){
var content_size = Math.floor((carousel_images_slide.outerWidth() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.outerWidth(true));
content_size = Math.max(content_size,1);
carousel_images_slide.find(">li").css("display","none");
var active_count = carousel_images_slide.find(">li").length - active_slide;
if(active_count < content_size){
active_slide -= (content_size - active_count);
}
active_slide = Math.max(active_slide,0);
console.log(content_size)
for(var i = active_slide; i < active_slide + content_size;i++){
carousel_images_slide.find(">li").eq(i).css("display","block");
}
}
var carousel_image_block_width = $('.carousel_images').width();
$(".event_carousel_slide").css("height",'');
var heights = $(".event_carousel_slide").map(function(i,v){
return $(v).height() * carousel_image_block_width / $(v).width();
})
var max_height = Math.max.apply(null,heights);
$(".event_carousel_slide").each(function(i,v){
$(v).height(max_height);
})
})
}(jQuery));
</script>

View File

@ -1,13 +0,0 @@
<style>
.carousel_image p{
text-align: center;
}
</style>
<div class="carousel_images">
<%data["event_carousel_images"].each do |event_carousel_image|%>
<div class="carousel_image col-sm-6">
<a href="<%=event_carousel_image["src"]%>" title="<%=event_carousel_image["description_text"]%>"><img src="<%=event_carousel_image["src"]%>" alt="<%=event_carousel_image["description_text"]%>"></a>
<p><strong class="carousel__description"><%=event_carousel_image["description"]%></strong></p>
</div>
<% end %>
</div>

View File

@ -2,7 +2,7 @@
require 'event_news_helper'
data = action_data
params = OrbitHelper.params
page = @page || Page.where(url:params['url']).first
page = Page.where(url:params['url']).first
@ad_banner_location = 2
@show_back_and_next_flag = 0
if Page.instance_methods.include?(:select_option_items) && ModuleApp.instance_methods.include?(:show_option_items)
@ -58,7 +58,13 @@
content = ''
end
end
ad_banner_content = render_ad_banner(data['event_carousel_images'],data['data'])
%>
<style type="text/css">
.carousel_images{
<%= data['data']['carousel_display_style'] %>
}
</style>
<%= stylesheet_link_tag 'event_news_front.css' %>
<% if @show_back_and_next_flag!=0 %>
<style type="text/css">
@ -88,13 +94,13 @@
<% end %>
<% if @ad_banner_location==1 %>
<%= data["data"]["carousel_html"] %>
<%= ad_banner_content %>
<% end %>
<%= render_view %>
<% if @ad_banner_location==2 %>
<%= data["data"]["carousel_html"] %>
<%= ad_banner_content %>
<% end %>
<% if @show_back_and_next_flag==2 %>
@ -120,5 +126,113 @@
// Links
hideEmptyEl($('.s-annc__link-title'), $('.s-annc__related-link'));
$("img[src='']").remove();
$('.pause-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
$(this).addClass('active');
$(this).parents('.carousel_images').find('.resume-slide').removeClass('active');
});
$('.resume-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('resume');
$(this).addClass('active');
$(this).parents('.carousel_images').find('.pause-slide').removeClass('active');
});
$('.next-button').off('click').on('click',function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("next");
})
$('.prev-button').off('click').on('click',function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
})
window.active_slide = 0;
$('.prev_img').off('click').on('click',function(){
var carousel_images_slide = $('.carousel_images_slide');
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
if(carousel_images_slide_first_child.length > 0){
var content_size = Math.floor((carousel_images_slide.outerWidth() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.outerWidth(true));
content_size = Math.max(content_size,1);
if(carousel_images_slide.find(">li").length > content_size && active_slide > 0){
active_slide -= content_size;
carousel_images_slide.find(">li").css("display","none");
for(var i = active_slide; i < active_slide + content_size;i++){
carousel_images_slide.find(">li").eq(i).css("display","block");
}
}
}
})
$('.next_img').off('click').on('click',function(){
var carousel_images_slide = $('.carousel_images_slide');
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
if(carousel_images_slide_first_child.length > 0){
var content_size = Math.floor((carousel_images_slide.outerWidth() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.outerWidth(true));
content_size = Math.max(content_size,1);
var li_length = carousel_images_slide.find(">li").length;
if(li_length > content_size){
active_slide += content_size;
active_slide = Math.min(active_slide,li_length - 1);
carousel_images_slide.find(">li").css("display","none");
for(var i = active_slide; i < active_slide + content_size;i++){
carousel_images_slide.find(">li").eq(i).css("display","block");
}
}
}
})
$(".carousel_img_item img").off("click").on("click",function(){
$(".carousel_images .cycle-slideshow").cycle($(this).index(".carousel_img_item img"));
})
$(document).ready(function(){
$(".carousel_images .cycle-slideshow").cycle('pause');
var carousel_image_block_width = $('.carousel_images').width();
var heights = $(".event_carousel_slide").map(function(i,v){
return $(v).height() * carousel_image_block_width / $(v).width();
})
var max_height = Math.max.apply(null,heights);
$(".event_carousel_slide").each(function(i,v){
$(v).height(max_height);
})
$(".carousel_images .cycle-slideshow").cycle('resume');
$('.carousel_images .resume-slide').addClass('active');
$('.cycle-slideshow').on('cycle-after',function(){
$(".active_slide").text($('.event_carousel_slide.cycle-slide-active').index());
})
})
$(window).on("load",function(){
$(".carousel_images .cycle-slideshow").cycle('pause');
var carousel_image_block_width = $('.carousel_images').width();
var heights = $(".event_carousel_slide").map(function(i,v){
return $(v).height() * carousel_image_block_width / $(v).width();
})
var max_height = Math.max.apply(null,heights);
$(".event_carousel_slide").each(function(i,v){
$(v).height(max_height);
})
$(".carousel_images .cycle-slideshow").cycle('resume');
})
$(window).resize(function(){
var carousel_images_slide = $('.carousel_images_slide');
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
if(carousel_images_slide_first_child.length > 0){
var content_size = Math.floor((carousel_images_slide.outerWidth() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.outerWidth(true));
content_size = Math.max(content_size,1);
carousel_images_slide.find(">li").css("display","none");
var active_count = carousel_images_slide.find(">li").length - active_slide;
if(active_count < content_size){
active_slide -= (content_size - active_count);
}
active_slide = Math.max(active_slide,0);
console.log(content_size)
for(var i = active_slide; i < active_slide + content_size;i++){
carousel_images_slide.find(">li").eq(i).css("display","block");
}
}
var carousel_image_block_width = $('.carousel_images').width();
$(".event_carousel_slide").css("height",'');
var heights = $(".event_carousel_slide").map(function(i,v){
return $(v).height() * carousel_image_block_width / $(v).width();
})
var max_height = Math.max.apply(null,heights);
$(".event_carousel_slide").each(function(i,v){
$(v).height(max_height);
})
})
}(jQuery));
</script>

View File

@ -4,18 +4,11 @@ en:
event_news_mod:
event_news_mod: Event News
event_news:
carousel_image_types:
default: Default
carousel: Carousel
album: Album
default_carousel_image_type: Default carousel image type
carousel_image_type: Carousel image type
read_from_cache: "Read from cache!"
manually_sort: Manually Sort
enable_manually_sort: Enable Manually Sort
manual_update_sort: Manually Update Sort
category: Category
tag: Tag
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"
@ -177,7 +170,6 @@ en:
display_img: Display Cover Image in Content Page
is_display_edit_only: Only display editable event news
is_postdate_sort_first: Sort by Post Date first (Sort by Event Date first as Default)
expired_event_to_bottom: Expired events appear at the bottom
only_manager_can_edit_status: Only manager can edit status of event news
layout_type: Layout type
event_news_setting_for_iframe: Event News settings for iframe

View File

@ -4,18 +4,11 @@ zh_tw:
event_news_mod:
event_news_mod: 活動公告
event_news:
carousel_image_types:
default: 預設
carousel: 輪播
album: 相本排版
default_carousel_image_type: 預設輪播樣式
carousel_image_type: 預設輪播樣式
read_from_cache: "從暫存中讀取!"
manually_sort: 手動排序
enable_manually_sort: 開啟手動排序
manual_update_sort: 手動更新排序
category: 類別
tag: 標籤
event_date_setting: "事件日期設定"
event_date_use_default_setting: "使用預設的事件日期設定"
including_day_of_the_week: "包含星期幾"
@ -53,8 +46,8 @@ zh_tw:
employer: 徵求單位
event_date: 事件日期
event_end_date: 事件結束日期
start_date: 上架日期
end_date: 下架日期
start_date: 公告日期
end_date: 截止日期
add_to_calendar: 加入行事曆
blank_to_set: (留白則使用公告設定)
stime: 開始時間
@ -180,7 +173,6 @@ zh_tw:
display_img: 內容頁顯示封面圖片
is_display_edit_only: 只顯示可更新的活動公告
is_postdate_sort_first: 優先使用公告日期排序(預設優先使用事件日期)
expired_event_to_bottom: 已達事件結束日期排最後
only_manager_can_edit_status: 只有管理者可更新活動公告狀態
layout_type: 頁面樣式
event_news_setting_for_iframe: 活動公告iframe設定

View File

@ -130,7 +130,7 @@ module EventNewsMod
authorizable
frontend_enabled
feeds_url "/xhr/event_news/feeds"
feeds_time_field (::EventNewsHelper.is_postdate_sort_first ? ['postdate', 'event_date'] : ['event_date', 'postdate'])
feeds_time_field (EventNewsHelper.is_postdate_sort_first ? ['postdate', 'event_date'] : ['event_date', 'postdate'])
data_count 1..30
begin
show_options data