Change event_news to event_news_mod.
|
@ -8,7 +8,7 @@ class Admin::EventNewsController < OrbitAdminController
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@app_title = "event_news"
|
@app_title = "event_news_mod"
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class EventNewsController < ApplicationController
|
class EventNewsModsController < ApplicationController
|
||||||
include EventNewsHelper
|
include EventNewsHelper
|
||||||
def index
|
def index
|
||||||
EventNews.remove_expired_status
|
EventNews.remove_expired_status
|
||||||
|
@ -99,7 +99,7 @@ class EventNewsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_cloud
|
def tag_cloud
|
||||||
ma = ModuleApp.where(:key => "event_news").first
|
ma = ModuleApp.where(:key => "event_news_mod").first
|
||||||
temp = []
|
temp = []
|
||||||
ma.tags.each do |tag|
|
ma.tags.each do |tag|
|
||||||
t1 = tag.taggings.collect{|t| t.taggable_id.to_s}
|
t1 = tag.taggings.collect{|t| t.taggable_id.to_s}
|
||||||
|
@ -186,10 +186,10 @@ class EventNewsController < ApplicationController
|
||||||
locale = I18n.locale.to_s
|
locale = I18n.locale.to_s
|
||||||
if home_page.respond_to?(:find_page)
|
if home_page.respond_to?(:find_page)
|
||||||
page = home_page.find_page(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil
|
page = home_page.find_page(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil
|
||||||
page = home_page.find_page(:module=>"event_news",:enabled_for=>locale).first rescue nil if page.nil?
|
page = home_page.find_page(:module=>"event_news_mod",:enabled_for=>locale).first rescue nil if page.nil?
|
||||||
else
|
else
|
||||||
page = Page.where(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil
|
page = Page.where(:page_id=> subpart.read_more_page_id,:enabled_for=>locale).first rescue nil
|
||||||
page = Page.where(:module=>"event_news",:enabled_for=>locale).first rescue nil if page.nil?
|
page = Page.where(:module=>"event_news_mod",:enabled_for=>locale).first rescue nil if page.nil?
|
||||||
end
|
end
|
||||||
all_cats = cats.dup
|
all_cats = cats.dup
|
||||||
all_cats.delete "all"
|
all_cats.delete "all"
|
||||||
|
@ -411,7 +411,7 @@ class EventNewsController < ApplicationController
|
||||||
@image_version = 'thumb'
|
@image_version = 'thumb'
|
||||||
@show_today_data_first = false
|
@show_today_data_first = false
|
||||||
if subpart.methods.include? 'select_options'.to_sym
|
if subpart.methods.include? 'select_options'.to_sym
|
||||||
ModuleApp.all.select{|tmp| tmp.key.to_s=='event_news'}.each do |modile_app|
|
ModuleApp.all.select{|tmp| tmp.key.to_s=='event_news_mod'}.each do |modile_app|
|
||||||
@show_options = modile_app.show_options rescue nil
|
@show_options = modile_app.show_options rescue nil
|
||||||
end
|
end
|
||||||
subpart.select_options.each do |select_option|
|
subpart.select_options.each do |select_option|
|
||||||
|
@ -789,7 +789,7 @@ class EventNewsController < ApplicationController
|
||||||
@categories = params[:categories]
|
@categories = params[:categories]
|
||||||
end
|
end
|
||||||
OrbitHelper.set_site_locale(I18n.locale)
|
OrbitHelper.set_site_locale(I18n.locale)
|
||||||
OrbitHelper.set_current_widget_module("event_news")
|
OrbitHelper.set_current_widget_module("event_news_mod")
|
||||||
OrbitHelper.set_params(params,current_user)
|
OrbitHelper.set_params(params,current_user)
|
||||||
EventNews.remove_expired_status
|
EventNews.remove_expired_status
|
||||||
OrbitHelper.set_page_number(params[:page_no].to_i)
|
OrbitHelper.set_page_number(params[:page_no].to_i)
|
||||||
|
@ -896,11 +896,11 @@ class EventNewsController < ApplicationController
|
||||||
all_tags = subpart.tags
|
all_tags = subpart.tags
|
||||||
all_tags = ['all'] if all_tags.length==0
|
all_tags = ['all'] if all_tags.length==0
|
||||||
page = Page.where(:page_id=> subpart.read_more_page_id).first rescue nil
|
page = Page.where(:page_id=> subpart.read_more_page_id).first rescue nil
|
||||||
page = Page.where(:module => "event_news").first rescue nil if page.nil?
|
page = Page.where(:module => "event_news_mod").first rescue nil if page.nil?
|
||||||
read_more_url_root = "/#{I18n.locale.to_s + page.url}" rescue ""
|
read_more_url_root = "/#{I18n.locale.to_s + page.url}" rescue ""
|
||||||
read_more_url = read_more_url_root + "?" + {"category"=>all_cats,"tags"=> all_tags}.to_param if read_more_url != ""
|
read_more_url = read_more_url_root + "?" + {"category"=>all_cats,"tags"=> all_tags}.to_param if read_more_url != ""
|
||||||
else
|
else
|
||||||
page = Page.where(:module => "event_news").first
|
page = Page.where(:module => "event_news_mod").first
|
||||||
read_more_url_root = "/#{I18n.locale.to_s + page.url}" rescue ""
|
read_more_url_root = "/#{I18n.locale.to_s + page.url}" rescue ""
|
||||||
end
|
end
|
||||||
if params[:unix_start].present? && params[:unix_end].present?
|
if params[:unix_start].present? && params[:unix_end].present?
|
|
@ -331,9 +331,9 @@ module EventNewsHelper
|
||||||
|
|
||||||
if @target_action == "index"
|
if @target_action == "index"
|
||||||
filename = overridehtml.nil? ? params[:layout_type] : overridehtml
|
filename = overridehtml.nil? ? params[:layout_type] : overridehtml
|
||||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news', "#{filename}.html.erb")
|
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news_mod', "#{filename}.html.erb")
|
||||||
if !File.exists?f
|
if !File.exists?f
|
||||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news', "index.html.erb")
|
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news_mod', "index.html.erb")
|
||||||
if !File.exists?f
|
if !File.exists?f
|
||||||
return "<div class='well'>Maybe the administrator has changed the theme, please select the index page design again from the page settings.</div>".html_safe
|
return "<div class='well'>Maybe the administrator has changed the theme, please select the index page design again from the page settings.</div>".html_safe
|
||||||
end
|
end
|
||||||
|
@ -345,7 +345,7 @@ module EventNewsHelper
|
||||||
begin
|
begin
|
||||||
data = @data# rescue nil
|
data = @data# rescue nil
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
write_debug_file(e,'event_news',@target_action) if Site::DEBUG
|
write_debug_file(e,'event_news_mod',@target_action) if Site::DEBUG
|
||||||
end
|
end
|
||||||
if !data.nil?
|
if !data.nil?
|
||||||
wrap_elements = doc.css("*[data-list][data-level='0']")
|
wrap_elements = doc.css("*[data-list][data-level='0']")
|
||||||
|
@ -373,7 +373,7 @@ module EventNewsHelper
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
filename = overridehtml.nil? ? @target_action : overridehtml
|
filename = overridehtml.nil? ? @target_action : overridehtml
|
||||||
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news', "#{filename}.html.erb")
|
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'event_news_mod', "#{filename}.html.erb")
|
||||||
if File.exists?f
|
if File.exists?f
|
||||||
file = File.open(f)
|
file = File.open(f)
|
||||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||||
|
@ -382,7 +382,7 @@ module EventNewsHelper
|
||||||
begin
|
begin
|
||||||
data = @data# rescue nil
|
data = @data# rescue nil
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
write_debug_file(e,'event_news',@target_action) if Site::DEBUG
|
write_debug_file(e,'event_news_mod',@target_action) if Site::DEBUG
|
||||||
end
|
end
|
||||||
if data.nil?
|
if data.nil?
|
||||||
return "<div class='well'> No content to show. </div>".html_safe
|
return "<div class='well'> No content to show. </div>".html_safe
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
en:
|
en:
|
||||||
module_name:
|
module_name:
|
||||||
event_news: Event News
|
event_news_mod: Event News
|
||||||
event_news:
|
event_news:
|
||||||
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"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
module_name:
|
module_name:
|
||||||
event_news: 活動公告
|
event_news_mod: 活動公告
|
||||||
event_news:
|
event_news:
|
||||||
event_date_setting: "事件日期設定"
|
event_date_setting: "事件日期設定"
|
||||||
event_date_use_default_setting: "使用預設的事件日期設定"
|
event_date_use_default_setting: "使用預設的事件日期設定"
|
||||||
|
|
|
@ -10,12 +10,13 @@ if bundle_update_flag
|
||||||
app_path = File.expand_path(__dir__)
|
app_path = File.expand_path(__dir__)
|
||||||
template_path = env_pwd + '/app/templates'
|
template_path = env_pwd + '/app/templates'
|
||||||
all_template = Dir.glob(template_path+'/*/')
|
all_template = Dir.glob(template_path+'/*/')
|
||||||
default_event_news_widget_info = JSON.parse(File.read("#{app_path}/modules/event_news/info.json"))["widgets"].sort_by{|h| h["filename"].to_i} rescue []
|
default_event_news_widget_info = JSON.parse(File.read("#{app_path}/modules/event_news_mod/info.json"))["widgets"].sort_by{|h| h["filename"].to_i} rescue []
|
||||||
all_template.each do |folder|
|
all_template.each do |folder|
|
||||||
if !folder.include?('mobile')
|
if !folder.include?('mobile')
|
||||||
info_json_file = "#{folder}modules/event_news/info.json"
|
info_json_file = "#{folder}modules/event_news_mod/info.json"
|
||||||
if File.exist?(info_json_file)
|
if File.exist?(info_json_file)
|
||||||
Bundler.with_clean_env{system ('cp -f '+ app_path + '/modules/event_news/show.html.erb ' + "#{folder}modules/event_news/.")}
|
Bundler.with_clean_env{system ('cp -f '+ app_path + '/modules/event_news_mod
|
||||||
|
/show.html.erb ' + "#{folder}modules/event_news_mod/.")}
|
||||||
update_event_news_template(folder)
|
update_event_news_template(folder)
|
||||||
begin
|
begin
|
||||||
file_text = File.read(info_json_file) rescue ""
|
file_text = File.read(info_json_file) rescue ""
|
||||||
|
@ -43,9 +44,9 @@ if bundle_update_flag
|
||||||
copy_h["name"][locale] = copy_h["name"][locale].sub(/\d+/){|ff| last_index.to_s}
|
copy_h["name"][locale] = copy_h["name"][locale].sub(/\d+/){|ff| last_index.to_s}
|
||||||
end
|
end
|
||||||
widget_info << copy_h
|
widget_info << copy_h
|
||||||
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news/_#{h["filename"]}.html.erb #{folder}modules/event_news/_#{copy_h["filename"]}.html.erb]}
|
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news_mod/_#{h["filename"]}.html.erb #{folder}modules/event_news_mod/_#{copy_h["filename"]}.html.erb]}
|
||||||
elsif h["force_cover"] == "true"
|
elsif h["force_cover"] == "true"
|
||||||
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news/_#{h["filename"]}.html.erb #{folder}modules/event_news/_#{widget_info[widget_info_index]["filename"]}.html.erb]}
|
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news_mod/_#{h["filename"]}.html.erb #{folder}modules/event_news_mod/_#{widget_info[widget_info_index]["filename"]}.html.erb]}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if update_flag
|
if update_flag
|
||||||
|
|
|
@ -94,7 +94,19 @@ module EventNewsMod
|
||||||
OrbitApp.registration "event_news_mod", :type => "ModuleApp" do
|
OrbitApp.registration "event_news_mod", :type => "ModuleApp" do
|
||||||
db = ::Mongoid::Sessions.default
|
db = ::Mongoid::Sessions.default
|
||||||
collection = db[:module_apps]
|
collection = db[:module_apps]
|
||||||
collection.update_many({key: 'event_news'},'$set'=>{key: 'event_news_mod', title: 'event_news_mod'})
|
update_results = collection.update_many({key: 'event_news'},'$set'=>{key: 'event_news_mod', title: 'event_news_mod'})
|
||||||
|
if update_results.n != 0
|
||||||
|
puts "Updating event_news to event_news_mod!"
|
||||||
|
collection = db[:pages]
|
||||||
|
collection.update_many({:module=> 'event_news'},'$set'=>{:module=> 'event_news_mod'})
|
||||||
|
collection = db[:sub_parts]
|
||||||
|
collection.update_many({:module=> 'event_news'},'$set'=>{:module=> 'event_news_mod'})
|
||||||
|
template_path = Rails.root.to_s + '/app/templates'
|
||||||
|
all_template = Dir.glob(template_path+'/*/')
|
||||||
|
all_template.each do |folder|
|
||||||
|
Bundler.with_clean_env{system ("mv #{folder}modules/event_news #{folder}modules/event_news_mod")}
|
||||||
|
end
|
||||||
|
end
|
||||||
module_label "event_news.event_news"
|
module_label "event_news.event_news"
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
widget_methods ["widget","random_event_news_widget", "tag_cloud"]
|
widget_methods ["widget","random_event_news_widget", "tag_cloud"]
|
||||||
|
@ -129,14 +141,14 @@ module EventNewsMod
|
||||||
:available_for => 'sub_managers'
|
:available_for => 'sub_managers'
|
||||||
context_link 'categories',
|
context_link 'categories',
|
||||||
:link_path=>"admin_module_app_categories_path" ,
|
:link_path=>"admin_module_app_categories_path" ,
|
||||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'event_news').id}",
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'event_news_mod').id}",
|
||||||
:priority=>3,
|
:priority=>3,
|
||||||
:active_for_action=>{'admin/event_news'=>'categories'},
|
:active_for_action=>{'admin/event_news'=>'categories'},
|
||||||
:active_for_category => 'EventNewsModule',
|
:active_for_category => 'EventNewsModule',
|
||||||
:available_for => 'managers'
|
:available_for => 'managers'
|
||||||
context_link 'tags',
|
context_link 'tags',
|
||||||
:link_path=>"admin_module_app_tags_path" ,
|
:link_path=>"admin_module_app_tags_path" ,
|
||||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'event_news').id}",
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'event_news_mod').id}",
|
||||||
:priority=>4,
|
:priority=>4,
|
||||||
:active_for_action=>{'admin/event_news'=>'tags'},
|
:active_for_action=>{'admin/event_news'=>'tags'},
|
||||||
:active_for_tag => 'EventNewsModule',
|
:active_for_tag => 'EventNewsModule',
|
||||||
|
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |