finish the first version of patch_file
This commit is contained in:
commit
a2d46ca121
398 files changed
+12910
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
.table .expired{
|
||||
color: #BE2E2E;
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,158 @@
|
||||
# encoding: utf-8
|
||||
require 'rubyXL'
|
||||
class Admin::PatchfilesController < OrbitAdminController
|
||||
include Admin::PatchfilesHelper
|
||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||
before_action :getfont , :create_first_field
|
||||
#before_action :load_access_levels
|
||||
def initialize
|
||||
super
|
||||
@app_title = "patchfile"
|
||||
end
|
||||
|
||||
def index
|
||||
@tags = @module_app.tags
|
||||
@categories = @module_app.categories.enabled
|
||||
@filter_fields = filter_fields(@categories, @tags)
|
||||
@table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified]
|
||||
#@file_to_show= Filefield.new
|
||||
#@file_to_show.save
|
||||
#@file_to_show = Filefield.find().first
|
||||
#@file_to_show = @file.file_show
|
||||
if request.xhr?
|
||||
render :partial => "index"
|
||||
end
|
||||
end
|
||||
def edit
|
||||
params["filefield"]["file_show"].each_with_index do |(key,value),index|
|
||||
@key = @file_to_show.file_show.keys[index]
|
||||
@file_to_show.file_show[@key] = value.to_i
|
||||
end
|
||||
@file_to_show.update
|
||||
redirect_to admin_patchfiles_path
|
||||
end
|
||||
def showckeditor
|
||||
end
|
||||
def editckeditor
|
||||
end
|
||||
def editfontfile
|
||||
end
|
||||
def update
|
||||
if params[:id] == "editfontfile"
|
||||
@field_name
|
||||
params["fontfile"]["font_file"] = "" if params["fontfile"]["font_file"].nil? == true
|
||||
params["fontfile"].each do |update_key,update_value|
|
||||
if update_key != "font_file"
|
||||
@font_settings["old_"+update_key] = @font_settings[update_key] rescue nil
|
||||
@font_settings[update_key] = update_value
|
||||
else
|
||||
@file = params["fontfile"]["font_file"] if params["fontfile"]["font_file"] != ""
|
||||
@file_path = Rails.root.to_s + '/app/assets/fonts'
|
||||
|
||||
if @file.nil? != true
|
||||
@file_name = @file.original_filename
|
||||
@file_content = @file.read
|
||||
@file_content.force_encoding('UTF-8')
|
||||
Dir.chdir(@file_path)
|
||||
@filetowrite
|
||||
if !File.file?(@file_name)
|
||||
@filetowrite = File.new(@file_name,"w")
|
||||
else
|
||||
@filetowrite = File.open(@file_name,"w")
|
||||
end
|
||||
@filetowrite.write(@file_content)
|
||||
@filetowrite.close
|
||||
Dir.chdir(Rails.root.to_s)
|
||||
else
|
||||
@file_name = @font_settings.font_file_name
|
||||
end
|
||||
@field_name = {"font_file_name" => @file_name,"font_dir" => @file_path}
|
||||
@field_name.each do |name,value|
|
||||
@font_settings["old_" + name.to_s] = @font_settings[name.to_s]
|
||||
@font_settings[name.to_s] = value.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
@font_settings.update
|
||||
end
|
||||
redirect_to admin_patchfiles_showckeditor_path
|
||||
end
|
||||
def newfont
|
||||
@field.new_add_font = params["patchfilefield"]["new_add_font"] rescue (redirect_to admin_patchfiles_showckeditor_path and return)
|
||||
params["patchfilefield"]["font_array"].each_with_index do |(font,istrue),index|
|
||||
if istrue =="0"
|
||||
@field.font_array[index.to_s][font] = false
|
||||
elsif istrue =="1"
|
||||
@field.font_array[index.to_s][font] = true
|
||||
end
|
||||
end
|
||||
@field.update
|
||||
redirect_to admin_patchfiles_showckeditor_path
|
||||
end
|
||||
def getfont
|
||||
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor'
|
||||
@filedata = File.read(@ckeditor_path+"/config.js.erb")
|
||||
@name_to_search ="config.font_names"
|
||||
@index_of_font = @filedata.index(@name_to_search)
|
||||
@font_str = ""
|
||||
@end_character
|
||||
@str_start
|
||||
@str_end
|
||||
if @index_of_font != nil
|
||||
@inex_start_to_search = @index_of_font + @name_to_search.length
|
||||
@str_start = @inex_start_to_search
|
||||
if (@filedata[@inex_start_to_search] != "\'" && @filedata[@inex_start_to_search] != "\"")
|
||||
for @str_start in @inex_start_to_search..@filedata.length
|
||||
break if (@filedata[@str_start] == "\'" || @filedata[@str_start] == "\"")
|
||||
end
|
||||
end
|
||||
@end_character = @filedata[@str_start]
|
||||
@str_end = @str_start+1
|
||||
if @str_start+1 < @filedata.length
|
||||
@str_end = @str_start+1
|
||||
for @str_end in @str_start+1..@filedata.length
|
||||
break if @filedata[@str_end] == @end_character || @str_end == @str_start
|
||||
if @filedata[@str_end] == "="
|
||||
@str_end = @str_start
|
||||
break
|
||||
end
|
||||
end
|
||||
if @str_end != @str_start
|
||||
@font_str = @filedata[@str_start+1...@str_end]
|
||||
else
|
||||
@font_str = ""
|
||||
end
|
||||
end
|
||||
@font_array = @font_str.split("\;")
|
||||
@font_array.map!{|i| i.strip}
|
||||
@font_array.delete("")
|
||||
end
|
||||
end
|
||||
def create_first_field
|
||||
@field
|
||||
if Patchfilefield.where("title"=>@app_title).take_while{true}.count == 0
|
||||
@field = Patchfilefield.new()
|
||||
@field.title=@app_title
|
||||
@field.save
|
||||
@field = Patchfilefield.where("title"=>@app_title).first
|
||||
else
|
||||
@field = Patchfilefield.where("title"=>@app_title).first
|
||||
end
|
||||
if params[:font] != nil
|
||||
if Fontfile.where("title"=>params[:font]).first.nil? == true
|
||||
@font_settings = Fontfile.new
|
||||
@font_settings.title = params[:font]
|
||||
@font_settings.save
|
||||
end
|
||||
@font_settings = Fontfile.where("title"=>params[:font]).first
|
||||
end
|
||||
if Filefield.where("title"=>@app_title).take_while{true}.count == 0
|
||||
@file_to_show = Filefield.new()
|
||||
@file_to_show.title=@app_title
|
||||
@file_to_show.save
|
||||
@file_to_show = Filefield.where("title"=>@app_title).first
|
||||
else
|
||||
@file_to_show = Filefield.where("title"=>@app_title).first
|
||||
end
|
||||
end
|
||||
end
|
||||
Whitespace-only changes.
@@ -0,0 +1,298 @@
|
||||
require "net/http"
|
||||
require "uri"
|
||||
require 'json'
|
||||
|
||||
module Admin::PatchfilesHelper
|
||||
def page_for_bulletin(bulletin)
|
||||
ann_page = nil
|
||||
pages = Page.where(:module=>'Patchfile')
|
||||
|
||||
pages.each do |page|
|
||||
if page.categories.count ==1
|
||||
if page.categories.include?(bulletin.category.id.to_s)
|
||||
ann_page = page
|
||||
end
|
||||
end
|
||||
break if !ann_page.nil?
|
||||
end
|
||||
|
||||
if ann_page.nil?
|
||||
pages.each do |page|
|
||||
if page.categories.include?(bulletin.category.id.to_s)
|
||||
ann_page = page
|
||||
end
|
||||
break if !ann_page.nil?
|
||||
end
|
||||
end
|
||||
|
||||
ann_page = pages.first if ann_page.nil?
|
||||
request.protocol+(request.host_with_port+ann_page.url+'/'+bulletin.to_param).gsub('//','/') rescue "/"
|
||||
end
|
||||
|
||||
def import_this_announcement(row,categories,tags)
|
||||
value = {}
|
||||
anns = Bulletin.new
|
||||
row.cells.each_with_index do |cell,index|
|
||||
next if cell.nil?
|
||||
val = cell.value
|
||||
next if val.nil? || val == ""
|
||||
case index
|
||||
when 0
|
||||
anns.category = categories[val.to_i]
|
||||
when 1
|
||||
new_tags = []
|
||||
if (val.include?(",") rescue false)
|
||||
ts = val.split(",")
|
||||
ts.each do |t|
|
||||
new_tags << tags[t.to_i]
|
||||
end
|
||||
else
|
||||
new_tags << tags[val.to_i]
|
||||
end
|
||||
anns.tags=new_tags
|
||||
when 2
|
||||
anns.postdate = val
|
||||
when 3
|
||||
anns.deadline = val
|
||||
when 4
|
||||
anns.is_top = (val.to_i == 1 ? true : false)
|
||||
when 5
|
||||
anns.is_hot = (val.to_i == 1 ? true : false)
|
||||
when 6
|
||||
anns.is_hidden = (val.to_i == 1 ? true : false)
|
||||
when 7
|
||||
anns.remote_image_url = val
|
||||
when 8
|
||||
value["en"] = val
|
||||
when 9
|
||||
value["zh_tw"] = val
|
||||
anns.image_description_translations = value
|
||||
value = {}
|
||||
when 10
|
||||
value["en"] = val
|
||||
when 11
|
||||
value["zh_tw"] = val
|
||||
anns.title_translations = value
|
||||
value = {}
|
||||
when 12
|
||||
value["en"] = val
|
||||
when 13
|
||||
value["zh_tw"] = val
|
||||
anns.subtitle_translations = value
|
||||
value = {}
|
||||
when 14
|
||||
value["en"] = val
|
||||
when 15
|
||||
value["zh_tw"] = val
|
||||
anns.text_translations = value
|
||||
value = {}
|
||||
when 16
|
||||
links = val.split(";") rescue []
|
||||
desc_en = row.cells[17].value.split(";") rescue []
|
||||
desc_zh_tw = row.cells[18].value.split(";") rescue []
|
||||
links.each_with_index do |link,i|
|
||||
bl = BulletinLink.new
|
||||
bl.url = link.strip
|
||||
bl.title_translations = {"en" => desc_en[i], "zh_tw" => desc_zh_tw[i]}
|
||||
bl.bulletin_id = anns.id
|
||||
bl.save
|
||||
end
|
||||
when 19
|
||||
files = val.split(";") rescue []
|
||||
desc_en = row.cells[20].value.split(";") rescue []
|
||||
desc_zh_tw = row.cells[21].value.split(";") rescue []
|
||||
alt_en = row.cells[22].value.split(";") rescue []
|
||||
alt_zh_tw = row.cells[23].value.split(";") rescue []
|
||||
files.each_with_index do |file, i|
|
||||
bf = BulletinFile.new
|
||||
bf.remote_file_url = file.strip rescue nil
|
||||
bf.title_translations = {"en" => (desc_en[i] rescue ""), "zh_tw" => (desc_zh_tw[i] rescue "")}
|
||||
bf.description_translations = {"en" => (alt_en[i] rescue ""), "zh_tw" => (alt_zh_tw[i] rescue "")}
|
||||
bf.bulletin_id = anns.id
|
||||
bf.save
|
||||
end
|
||||
end
|
||||
end
|
||||
anns.create_user_id = current_user.id.to_s
|
||||
anns.update_user_id = current_user.id.to_s
|
||||
anns.approved = true
|
||||
anns.save
|
||||
end
|
||||
|
||||
def send_rejection_email(announcement)
|
||||
user = User.find(announcement.create_user_id) rescue nil
|
||||
if !user.nil?
|
||||
email = user.member_profile.email
|
||||
if !email.nil? && email != ""
|
||||
url = "http://#{request.host_with_port}/admin/announcements/#{announcement.id}/edit"
|
||||
datatosend = "<h3>Hello #{user.name},</h3><p>#{current_user.name} #{t("announcement.rejected_annoucement")} : #{announcement.rejection_reason} <a href='#{url}'> #{t("announcement.click_here_to_see")}</a></p>"
|
||||
mail = Email.new(:mail_to => email, :mail_subject => "Announcement rejected公告未通過 : #{announcement.title}.", :template => "email/announcement_email.html.erb", :template_data => {"html" => datatosend})
|
||||
mail.deliver rescue nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_notification_mail_to_managers(announcement, type)
|
||||
users = []
|
||||
if @announcement_setting.email_to.include?("managers")
|
||||
authorizations = Authorization.where(:module_app_id => @module_app.id)
|
||||
users = authorizations.collect do |auth|
|
||||
auth.user
|
||||
end
|
||||
end
|
||||
if @announcement_setting.email_to.include?("admins")
|
||||
wg = Workgroup.where(:key => "admin").first
|
||||
admins = User.where(:workgroup_id => wg.id)
|
||||
users.delete(nil)
|
||||
users = users.concat(admins.to_a)
|
||||
end
|
||||
if @announcement_setting.email_to.include?("approvers")
|
||||
approvers = User.find(@announcement_setting.approvers).to_a rescue []
|
||||
auths = Authorization.where(:category_id => announcement.category_id).collect{|a| a.user}
|
||||
users = users.concat(approvers & auths)
|
||||
end
|
||||
users.each do |user|
|
||||
email = user.member_profile.email
|
||||
if !email.nil? && email != ""
|
||||
send_email(user.name, email, announcement, type)
|
||||
# sleep(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_email(name, useremail, announcement, type)
|
||||
url = "http://#{request.host_with_port}/admin/announcements?url=#{page_for_bulletin(announcement).sub("http://" + request.host_with_port, "")}&id=#{announcement.id}"
|
||||
|
||||
case type
|
||||
when "approval"
|
||||
datatosend = "<h3>#{t("announcement.approval_mail_hi", :name => name)},</h3><p>#{t("announcement.submitted_new_announcement", :poster => current_user.name)}<br /><br />#{t("announcement.approval_announcement_title")} : #{announcement.title} <br /> #{t("announcement.click_here_to_see")} : <a href='#{url}'> #{url} </a></p>"
|
||||
when "reapproval"
|
||||
datatosend = "<h3>#{t("announcement.approval_mail_hi", :name => name)},</h3><p>#{t("announcement.updated_annoucement", :poster => current_user.name)}<br /><br />#{t("announcement.approval_announcement_title")} : #{announcement.title} <br /> #{t("announcement.click_here_to_see")} : <a href='#{url}'> #{url} </a></p>"
|
||||
end
|
||||
email = Email.new(:mail_to => useremail, :mail_subject => " #{t("announcement.announcement_subject")} : #{announcement.title}.", :template => "email/announcement_email.html.erb", :template_data => {"html" => datatosend})
|
||||
email.deliver rescue nil
|
||||
end
|
||||
|
||||
def download_tmp_xml(url)
|
||||
xml = File.join(Rails.root, "tmp", "ann_cc_ntu.xml")
|
||||
open(xml, 'wb') do |fo|
|
||||
fo.print open(url).read
|
||||
end
|
||||
end
|
||||
|
||||
def import_from_tmp_xml(file)
|
||||
xml = Nokogiri::XML(file)
|
||||
return if xml.nil?
|
||||
announcements = []
|
||||
xml.xpath("//channel").xpath("//item").each do |anns|
|
||||
announcements << {
|
||||
:title => (anns>"title").text,
|
||||
:category => (anns>"category").text,
|
||||
:postdate => (anns>"pubDate").text,
|
||||
:text => (anns>"description").text,
|
||||
:rss2_sn => (anns>"link").text.split("=").last
|
||||
}
|
||||
end
|
||||
announcements.each do |anns|
|
||||
ma = ModuleApp.where(:key => "announcement").first
|
||||
cat = Category.where(:title => anns[:category]).first rescue nil
|
||||
if cat.nil?
|
||||
cat = Category.create(:title_translations => {"en" => anns[:category], "zh_tw" => anns[:category]}, :module_app_id => ma.id)
|
||||
end
|
||||
ann = Bulletin.where(:rss2_sn => anns[:rss2_sn]).first rescue nil
|
||||
if ann.nil?
|
||||
ann = Bulletin.new(:title_translations => {"en" => "", "zh_tw" => anns[:title]}, :postdate => anns[:postdate], :subtitle_translations => {"en" => "", "zh_tw" => anns[:title]}, :text_translations => {"en" => "", "zh_tw" => anns[:text]}, :rss2_sn => anns[:rss2_sn], :category_id => cat.id, :approved => true, :create_user_id => current_user.id)
|
||||
else
|
||||
ann.update_attributes(:title_translations => {"en" => "", "zh_tw" => anns[:title]}, :postdate => anns[:postdate], :subtitle_translations => {"en" => "", "zh_tw" => anns[:title]}, :text_translations => {"en" => "", "zh_tw" => anns[:text]})
|
||||
end
|
||||
ann.save
|
||||
end
|
||||
File.delete(file)
|
||||
end
|
||||
|
||||
def import_from_wordpress(xmlfile)
|
||||
xml_file = File.read(xmlfile)
|
||||
doc = Nokogiri::XML.parse(xml_file)
|
||||
|
||||
doc.xpath("//channel").each do|channel_data|
|
||||
channel_data.xpath('//item').each do|itme|
|
||||
|
||||
bu = Bulletin.where(:rss2_sn => itme.xpath('wp:post_id').text ).first rescue nil
|
||||
if bu.nil?
|
||||
bu = Bulletin.new
|
||||
bu.approved = true
|
||||
bu.rss2_sn = itme.xpath('wp:post_id').text
|
||||
bu.title_translations = {"en" => itme.xpath('title').text, "zh_tw" => itme.xpath('title').text}
|
||||
bu.text_translations = {"en" => itme.xpath('content:encoded').text, "zh_tw" => itme.xpath('content:encoded').text}
|
||||
bu.postdate = itme.xpath('wp:post_date').text
|
||||
|
||||
itme.xpath('category').each do |i_cate|
|
||||
if i_cate["domain"].to_s == "category"
|
||||
|
||||
cat = @module_app.categories.where(:title => i_cate.text.to_s).first rescue nil
|
||||
if cat.nil?
|
||||
cat = Category.new
|
||||
cat.module_app = @module_app
|
||||
cat.title_translations = {"en" => i_cate.text.to_s, "zh_tw" => i_cate.text.to_s}
|
||||
cat.save
|
||||
end
|
||||
bu.category = cat
|
||||
|
||||
elsif i_cate["domain"].to_s == "post_tag"
|
||||
|
||||
tag = Tag.where(:name => i_cate.text.to_s ).first rescue nil
|
||||
if tag.nil?
|
||||
tag = Tag.new
|
||||
tag.name_translations = {"en" => i_cate.text.to_s, "zh_tw" => i_cate.text.to_s}
|
||||
tag.module_app_ids << @module_app.id
|
||||
tag.save
|
||||
end
|
||||
|
||||
bu.tags = tag
|
||||
end
|
||||
end
|
||||
|
||||
bu.save
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
File.delete(xmlfile)
|
||||
end
|
||||
|
||||
def load_access_level
|
||||
if (current_user.is_admin? rescue false)
|
||||
@access_level = "admin"
|
||||
elsif (current_user.is_manager?(@module_app) rescue false)
|
||||
@access_level = "manager"
|
||||
else
|
||||
@access_level = "users"
|
||||
end
|
||||
end
|
||||
|
||||
def user_can_approve?(anns=nil)
|
||||
can_approve = false
|
||||
setting = AnnouncementSetting.first
|
||||
case @access_level
|
||||
when "admin"
|
||||
can_approve = true
|
||||
when "manager"
|
||||
can_approve = true
|
||||
else
|
||||
can_approve = false
|
||||
end
|
||||
if !can_approve
|
||||
if !anns.nil?
|
||||
if setting.approvers.include?(current_user.id.to_s)
|
||||
if (current_user.approved_categories_for_module(@module_app).include?(anns.category) rescue false)
|
||||
can_approve = true
|
||||
end
|
||||
end
|
||||
else
|
||||
can_approve = setting.approvers.include?(current_user.id.to_s)
|
||||
end
|
||||
end
|
||||
can_approve
|
||||
end
|
||||
|
||||
end
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,89 @@
|
||||
# encoding: utf-8
|
||||
require 'fileutils'
|
||||
class Filefield
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
|
||||
field :title, :type=> String ,default:"patchfile"
|
||||
field :file_show, :type=> Hash ,default:{"ckeditor"=>0,"site-preference(two-site-logo)"=>0,"member"=>0}
|
||||
after_update :updatefile
|
||||
|
||||
|
||||
def enabled_for?(lang)
|
||||
if lang.nil?
|
||||
return true
|
||||
else
|
||||
return self.choose_lang.include?(lang)
|
||||
end
|
||||
end
|
||||
def lastpath dir_path
|
||||
dir_path = dir_path.gsub('\\','/')
|
||||
dir_arr= dir_path.split('/')
|
||||
dir_str=''
|
||||
dir_arr.delete_at(-1)
|
||||
dir_arr.each_with_index do |path,index|
|
||||
dir_str = dir_str + path
|
||||
if index != dir_arr.count - 1
|
||||
dir_str = dir_str +"/"
|
||||
end
|
||||
end
|
||||
return dir_str
|
||||
end
|
||||
def updatefile
|
||||
self.file_show.each do |key,value|
|
||||
if value == 1
|
||||
@model_path = ENV['PWD'] + '/app/models/'
|
||||
@helper_path = ENV['PWD'] + '/app/helpers/'
|
||||
@views_path = ENV['PWD'] + '/app/views/'
|
||||
@controller_path = ENV['PWD'] + '/app/controllers/'
|
||||
if key == "ckeditor"
|
||||
app_path = File.expand_path(__dir__)
|
||||
app_path = lastpath(app_path)
|
||||
app_path = lastpath(app_path)
|
||||
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor/'
|
||||
puts 'copying CKEDITOR'
|
||||
@aa = FileUtils.cd(app_path+'/updatefiles/')
|
||||
puts @aa.to_s
|
||||
begin
|
||||
FileUtils.cp('config.js.erb' , @ckeditor_path)
|
||||
puts @ckeditor_path
|
||||
rescue
|
||||
puts 'error copy'
|
||||
end
|
||||
elsif key == "site-preference(two-site-logo)"
|
||||
app_path = File.expand_path(__dir__)
|
||||
app_path = lastpath(app_path)
|
||||
app_path = lastpath(app_path)
|
||||
puts app_path
|
||||
puts 'copying site'
|
||||
FileUtils.cd(app_path+'/updatefiles/')
|
||||
begin
|
||||
FileUtils.cp('site.rb' , @model_path)
|
||||
FileUtils.cp('application_helper.rb' , @helper_path)
|
||||
FileUtils.cd('admin/')
|
||||
FileUtils.cp('preference.html.erb',@views_path+'/admin/sites/')
|
||||
rescue
|
||||
puts 'error copy'
|
||||
end
|
||||
elsif key == "member"
|
||||
app_path = File.expand_path(__dir__)
|
||||
app_path = lastpath(app_path)
|
||||
app_path = lastpath(app_path)
|
||||
FileUtils.cd(app_path+'/updatefiles/')
|
||||
puts 'copying member'
|
||||
begin
|
||||
FileUtils.cp('member_profile.rb' , @model_path)
|
||||
FileUtils.cd('admin')
|
||||
FileUtils.cp('members_controller.rb' , @controller_path+'/admin/')
|
||||
rescue
|
||||
puts 'error copy'
|
||||
end
|
||||
end
|
||||
FileUtils.cd(Rails.root.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,227 @@
|
||||
class Fontfile
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
include OrbitModel::Status
|
||||
include OrbitModel::Impression
|
||||
# encoding: utf-8
|
||||
include OrbitTag::Taggable
|
||||
include OrbitCategory::Categorizable
|
||||
field :title ,type:String ,default:""
|
||||
field :is_delete_font_file, type:String,default: 'false'
|
||||
field :old_title ,type:String ,default:""
|
||||
#field :font_file ,type:String ,default:""
|
||||
field :font_link ,type:String ,default:""
|
||||
field :old_font_link ,type:String ,default:""
|
||||
mount_uploader :font_file, AssetUploader
|
||||
field :font_file_name, type:String ,default:""
|
||||
field :font_dir, type:String ,default:""
|
||||
field :old_font_file_name, type:String ,default:""
|
||||
field :old_font_dir, type:String ,default:""
|
||||
scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])}
|
||||
scope :is_approved, ->{where(:approved => true)}
|
||||
#has_many :filefields, :autosave => true, :dependent => :destroy
|
||||
# accepts_nested_attributes_for :filefields, :allow_destroy => true
|
||||
# before_create
|
||||
#before_update :set_old_link#,:set_old_title
|
||||
#before_save :set_old_title
|
||||
#before_create :set_expire
|
||||
after_update :change_font_name,:set_css_link,:change_font_settings
|
||||
#after_save :change_font_name
|
||||
def change_font_settings
|
||||
if self.old_font_file_name == self.font_file_name && self.is_delete_font_file =='true'
|
||||
self.font_file_name = ""
|
||||
self.is_delete_font_file = 'false'
|
||||
self.save
|
||||
elsif self.is_delete_font_file =='true'
|
||||
self.is_delete_font_file = 'false'
|
||||
end
|
||||
template_path = ENV['PWD'] + '/app/templates'
|
||||
all_template = Dir.glob(template_path+'/*/')
|
||||
all_template.each do |folder|
|
||||
next if !Dir.exist?(folder+"partial/")
|
||||
if folder.split('/')[-1] != 'mobile'
|
||||
begin
|
||||
Dir.chdir(folder+"partial/")
|
||||
@file_name = "_head.html.erb"
|
||||
@filetowrite
|
||||
if !File.file?(@file_name)
|
||||
@filetowrite = File.new(@file_name,"w")
|
||||
@filetowrite.close
|
||||
end
|
||||
@file_content = File.read(@file_name)
|
||||
if self.old_font_dir != '' && self.old_font_file_name != '' && self.old_font_file_name != self.font_file_name
|
||||
if self.old_font_dir != ""
|
||||
Dir.chdir(self.old_font_dir)
|
||||
File.delete(self.old_font_file_name) if File.exist?(self.old_font_file_name)
|
||||
end
|
||||
Dir.chdir(folder+"partial/")
|
||||
@font_link_str = "<link href=\'/assets/"+"#{self.old_font_file_name}"+"\' type=\'text/css\' rel=\'stylesheet\'>"
|
||||
if @file_content.include? @font_link_str
|
||||
@file_content = @file_content.gsub(@font_link_str,'')
|
||||
@filetowrite = File.open(@file_name,"w")
|
||||
@filetowrite.write(@file_content)
|
||||
@filetowrite.close
|
||||
end
|
||||
elsif self.old_font_link != ""&& self.old_font_link != self.font_link
|
||||
@font_link_str = "<link href=\'"+"#{self.old_font_link}"+"\' rel=\'stylesheet\'>"
|
||||
if @file_content.include? @font_link_str
|
||||
@file_content = @file_content.gsub(@font_link_str,'')
|
||||
@filetowrite = File.open(@file_name,"w")
|
||||
@filetowrite.write(@file_content)
|
||||
@filetowrite.close
|
||||
end
|
||||
end
|
||||
rescue
|
||||
puts folder
|
||||
puts 'error copy'
|
||||
end
|
||||
end
|
||||
end
|
||||
Dir.chdir(Rails.root.to_s)
|
||||
end
|
||||
def set_css_link
|
||||
template_path = ENV['PWD'] + '/app/templates'
|
||||
all_template = Dir.glob(template_path+'/*/')
|
||||
all_template.each do |folder|
|
||||
next if !Dir.exist?(folder+"partial")
|
||||
if folder.split('/')[-1] != 'mobile'
|
||||
begin
|
||||
Dir.chdir(folder+"partial/")
|
||||
@file_name = "_head.html.erb"
|
||||
@filetowrite
|
||||
if !File.file?(@file_name)
|
||||
@filetowrite = File.new(@file_name,"w")
|
||||
@filetowrite.close
|
||||
end
|
||||
@file_content = File.read(@file_name)
|
||||
@file_content = @file_content.force_encoding('UTF-8').gsub('%20',' ')
|
||||
if self.font_dir != '' && self.font_file_name != ''
|
||||
@font_link_str = "<link href=\'/assets/"+"#{self.font_file_name}"+"\' type=\'text/css\' rel=\'stylesheet\'>"
|
||||
@str_to_search = '/assets/'+ self.font_file_name.to_s
|
||||
if @file_content.include? @str_to_search
|
||||
|
||||
@str_start = @file_content.index(@str_to_search)
|
||||
@istrue = 0
|
||||
@str_match = 'href'.reverse
|
||||
@index = 0
|
||||
for @i in (0...@str_start.to_i).to_a.reverse
|
||||
next if @file_content[@i] == ' ' || @file_content[@i] == '=' || @file_content[@i] == '\''
|
||||
if @file_content[@i] == @str_match[@index]
|
||||
@index = @index + 1
|
||||
else
|
||||
break
|
||||
end
|
||||
if @index == @str_match.length
|
||||
@istrue = 1
|
||||
break
|
||||
end
|
||||
end
|
||||
if @istrue == 0
|
||||
open(@file_name, 'a') { |f|
|
||||
f.puts @font_link_str
|
||||
}
|
||||
end
|
||||
else
|
||||
open(@file_name, 'a') { |f|
|
||||
f.puts @font_link_str
|
||||
}
|
||||
end
|
||||
elsif self.font_link != ""
|
||||
@font_link_str = "<link href=\'"+"#{self.font_link}"+"\' rel=\'stylesheet\'>"
|
||||
@str_to_search = self.font_link.to_s
|
||||
if @file_content.include? @str_to_search
|
||||
@str_start = @file_content.index(@str_to_search)
|
||||
@istrue = 0
|
||||
@str_match = 'href'.reverse
|
||||
@index = 0
|
||||
for @i in (0...@str_start).to_a.reverse
|
||||
next if @file_content[@i] == ' ' || @file_content[@i] == '=' || @file_content[@i] == '\''
|
||||
if @file_content[@i] == @str_match[@index]
|
||||
@index = @index + 1
|
||||
else
|
||||
break
|
||||
end
|
||||
if @index == @str_match.length
|
||||
@istrue = 1
|
||||
break
|
||||
end
|
||||
end
|
||||
if @istrue == 0
|
||||
open(@file_name, 'a') { |f|
|
||||
f.puts @font_link_str
|
||||
}
|
||||
end
|
||||
else
|
||||
open(@file_name, 'a') { |f|
|
||||
f.puts @font_link_str
|
||||
}
|
||||
end
|
||||
end
|
||||
rescue
|
||||
puts folder
|
||||
puts 'error copy'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
def change_font_name
|
||||
if self.old_title !="" && self.old_title != self.title
|
||||
@field = Patchfilefield.where("title"=>"patchfile").first
|
||||
@index
|
||||
@font_old_name
|
||||
@field.font_array.each do |index,font_hash|
|
||||
font_hash.each do |font,istrue|
|
||||
if font == self.old_title
|
||||
@index = index
|
||||
@font_old_name = font
|
||||
break
|
||||
end
|
||||
end
|
||||
break if @index != nil
|
||||
end
|
||||
if @font_old_name.nil? == false && @index.nil? == false
|
||||
@istrue = @field.font_array[@index.to_s][@font_old_name]
|
||||
@field.font_array[@index.to_s][self.title] = @istrue
|
||||
@field.font_array[@index.to_s].delete(@font_old_name)
|
||||
@field.delete_font = @font_old_name
|
||||
@field.update
|
||||
@field = Patchfilefield.where("title"=>"patchfile").first
|
||||
@field.set_un_used_font
|
||||
@field.set_used_font
|
||||
@field.update
|
||||
end
|
||||
end
|
||||
end
|
||||
def email_members
|
||||
MemberProfile.find(self.email_member_ids) rescue []
|
||||
end
|
||||
|
||||
def email_addresses
|
||||
addresses = self.email_members.collect{|member| member.email} rescue []
|
||||
addresses = addresses +[self.other_mailaddress] if !self.other_mailaddress.blank?
|
||||
addresses.flatten
|
||||
end
|
||||
|
||||
def email
|
||||
mail = Email.find(self.email_id) rescue nil
|
||||
end
|
||||
|
||||
def expired?
|
||||
(self.deadline < Time.now) rescue false
|
||||
end
|
||||
|
||||
def destroy_email
|
||||
mail = Email.find(self.email_id) rescue nil
|
||||
mail.destroy if !mail.nil?
|
||||
end
|
||||
|
||||
def self.remove_expired_status
|
||||
self.where(:is_top => true, :top_end_date.ne => nil, :top_end_date.lt => Time.now).each do |b|
|
||||
b.is_top = false
|
||||
b.top_end_date = nil
|
||||
b.update
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,308 @@
|
||||
class Patchfilefield
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitModel::Status
|
||||
include OrbitModel::Impression
|
||||
# encoding: utf-8
|
||||
include OrbitTag::Taggable
|
||||
include OrbitCategory::Categorizable
|
||||
#include Slug
|
||||
field :font_array , :type => Hash, default:{}
|
||||
field :new_add_font, type: String, default:""
|
||||
field :delete_font, type: String, default:""
|
||||
field :used_font , :type => Array, default:[]
|
||||
field :un_used_font , :type => Array, default:[]
|
||||
#field :title, as: :slug_title, type: String, localize: true
|
||||
field :title ,type:String ,default:""
|
||||
field :subtitle, localize: true
|
||||
field :text, localize: true
|
||||
#field :create_user_id
|
||||
#field :update_user_id
|
||||
# field :public, :type => Boolean, :default => true
|
||||
#field :postdate , :type => DateTime, :default => Time.now
|
||||
#field :deadline , :type => DateTime
|
||||
# field :rss2_sn
|
||||
#field :approved, :type => Boolean, :default => false
|
||||
#field :is_preview, :type => Boolean, :default => false
|
||||
#field :expirable_created_at, type: DateTime
|
||||
# field :rejected, :type => Boolean, :default => false
|
||||
#field :reapproval, :type => Boolean, :default => false
|
||||
# field :rejection_reason
|
||||
#field :is_external_link, :type => Boolean, :default => false
|
||||
#field :external_link
|
||||
#field :email_id
|
||||
#field :email_sent, :type => Boolean, :default => false
|
||||
# field :email_sentdate , :type => DateTime
|
||||
# field :email_member_ids
|
||||
#field :other_mailaddress
|
||||
# field :image_description, localize: true
|
||||
# field :top_end_date, :type => DateTime
|
||||
# mount_uploader :image, ImageUploader
|
||||
#has_many :bulletin_links, :autosave => true, :dependent => :destroy
|
||||
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
||||
|
||||
#accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
||||
# accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
|
||||
# before_destroy :destroy_email
|
||||
scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])}
|
||||
scope :is_approved, ->{where(:approved => true)}
|
||||
before_create :get_font_to_store,:set_un_used_font , :set_used_font
|
||||
before_update :get_font_to_store,:set_un_used_font , :set_used_font
|
||||
before_save :get_font_to_store,:set_un_used_font , :set_used_font
|
||||
after_update :set_config
|
||||
after_save :set_config
|
||||
#before_create :set_expire
|
||||
def get_font_to_store
|
||||
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor'
|
||||
@filedata = File.read(@ckeditor_path+"/config.js.erb")
|
||||
@name_to_search ="config.font_names"
|
||||
@index_of_font = @filedata.index(@name_to_search)
|
||||
@font_str = ""
|
||||
@end_character
|
||||
if @index_of_font != nil
|
||||
@inex_start_to_search = @index_of_font + @name_to_search.length
|
||||
#@str_start = 0 #if @str_start=0 =>not reach the start of font string
|
||||
@str_start = @inex_start_to_search
|
||||
if (@filedata[@inex_start_to_search] != "\'" && @filedata[@inex_start_to_search] != "\"")
|
||||
for @str_start in @inex_start_to_search..@filedata.length
|
||||
break if (@filedata[@str_start] == "\'" || @filedata[@str_start] == "\"")
|
||||
end
|
||||
end
|
||||
@end_character = @filedata[@str_start]
|
||||
@str_end = @str_start+1
|
||||
if @str_start+1 < @filedata.length
|
||||
@str_end = @str_start+1
|
||||
for @str_end in @str_start+1..@filedata.length
|
||||
break if @filedata[@str_end] == @end_character || @str_end == @str_start
|
||||
if @filedata[@str_end] == "="
|
||||
@str_end = @str_start
|
||||
break
|
||||
end
|
||||
end
|
||||
if @str_end != @str_start
|
||||
@font_str = @filedata[@str_start+1...@str_end]
|
||||
else
|
||||
@font_str = ""
|
||||
end
|
||||
end
|
||||
@font_array = @font_str.split("\;")
|
||||
@font_array.map!{|i| i.strip}
|
||||
@font_array.delete("")
|
||||
@font_array.each do |font|
|
||||
@i = 0
|
||||
if font != self.delete_font
|
||||
self.font_array.values.each do |each_font|
|
||||
if each_font.keys.first == font
|
||||
@i = 1
|
||||
end
|
||||
break if @i == 1
|
||||
end
|
||||
if @i == 0
|
||||
@count = self.font_array.count
|
||||
self.font_array = self.font_array.merge({@count =>{font => true}})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.new_add_font.strip !=""
|
||||
@i = 0
|
||||
self.font_array.values.each do |each_font|
|
||||
if each_font.keys.first == self.new_add_font
|
||||
@i = 1
|
||||
end
|
||||
break if @i == 1
|
||||
end
|
||||
if @i == 0
|
||||
@count = self.font_array.count
|
||||
self.font_array = self.font_array.merge({@count =>{self.new_add_font.strip => true}})
|
||||
end
|
||||
#self.cuurent_used_font push true
|
||||
self.new_add_font = ""
|
||||
end
|
||||
end
|
||||
# def set_expire
|
||||
# self.expirable_created_at = Time.now if self.is_preview
|
||||
# return true
|
||||
# end
|
||||
def set_un_used_font
|
||||
@un_use_font = []
|
||||
self.font_array.each do |index,font_hash|
|
||||
font_hash.each do |font,istrue|
|
||||
if istrue == false
|
||||
@un_use_font.push font.strip
|
||||
end
|
||||
end
|
||||
end
|
||||
self.un_used_font = @un_use_font
|
||||
end
|
||||
def set_used_font
|
||||
@use_font = []
|
||||
self.font_array.each do |index,font_hash|
|
||||
font_hash.each do |font,istrue|
|
||||
if istrue == true
|
||||
@use_font.push font.strip
|
||||
end
|
||||
end
|
||||
end
|
||||
@use_font.delete("")
|
||||
self.used_font = @use_font
|
||||
end
|
||||
def check_font_state
|
||||
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor'
|
||||
@filedata = File.read(@ckeditor_path+"/config.js.erb")
|
||||
@name_to_search ="config.font_names"
|
||||
@index_of_font = @filedata.index(@name_to_search)
|
||||
@font_str = ""
|
||||
@end_character
|
||||
@str_start
|
||||
@str_end
|
||||
@font_array
|
||||
if @index_of_font != nil
|
||||
@inex_start_to_search = @index_of_font + @name_to_search.length
|
||||
@str_start = @inex_start_to_search
|
||||
if (@filedata[@inex_start_to_search] != "\'" && @filedata[@inex_start_to_search] != "\"")
|
||||
for @str_start in @inex_start_to_search..@filedata.length
|
||||
break if (@filedata[@str_start] == "\'" || @filedata[@str_start] == "\"")
|
||||
end
|
||||
end
|
||||
@end_character = @filedata[@str_start]
|
||||
@str_end = @str_start+1
|
||||
if @str_start+1 < @filedata.length
|
||||
@str_end = @str_start+1
|
||||
for @str_end in @str_start+1..@filedata.length
|
||||
break if @filedata[@str_end] == @end_character || @str_end == @str_start
|
||||
if @filedata[@str_end] == "="
|
||||
@str_end = @str_start
|
||||
break
|
||||
end
|
||||
end
|
||||
if @str_end != @str_start
|
||||
@font_str = @filedata[@str_start+1...@str_end]
|
||||
else
|
||||
@font_str = ""
|
||||
end
|
||||
end
|
||||
@font_array = @font_str.split("\;")
|
||||
@font_array.map!{|i| i.strip}
|
||||
@font_array.delete("")
|
||||
if !check_eql_array(@font_array,self.used_font)
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
def set_config
|
||||
@istrue = check_font_state
|
||||
if @istrue == false
|
||||
@delete_font_array = []
|
||||
self.un_used_font.each do |font_to_delete|
|
||||
if @font_array.include? font_to_delete.strip
|
||||
@delete_font_array.push font_to_delete.strip
|
||||
end
|
||||
end
|
||||
@delete_font_array.push(self.delete_font) if self.delete_font != ""
|
||||
self.delete_font = ""
|
||||
puts "111111111111111111111111111111111111111111111111"
|
||||
puts @delete_font_array
|
||||
@add_font_array = []
|
||||
@use_font = self.used_font rescue []
|
||||
@use_font.each do |font_to_add|
|
||||
if !(@font_array.include? font_to_add.strip)
|
||||
@add_font_array.push font_to_add.strip
|
||||
end
|
||||
end
|
||||
if @add_font_array != [] || @delete_font_array != []
|
||||
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor'
|
||||
Dir.chdir(@ckeditor_path)
|
||||
if !File.file?("config_back.js.erb")
|
||||
@filetowrite = File.new("config_back.js.erb","w")
|
||||
if @add_font_array != []
|
||||
@add_font_array.each do |new_add_font|
|
||||
@filedata = @filedata.insert(@str_end,"\;"+new_add_font)
|
||||
end
|
||||
end
|
||||
@delete_font_array.each do |font_to_delete|
|
||||
@str_above_end = @filedata.index(font_to_delete) - 1
|
||||
@str_above_start
|
||||
for @str_above_start in (0..@str_above_end).to_a.reverse
|
||||
if @filedata[@str_above_start] =="\'" || @filedata[@str_above_start] =="\""
|
||||
break
|
||||
end
|
||||
break if @filedata[@str_above_start] == "\;"
|
||||
end
|
||||
@str_to_delete = (( @filedata[@str_above_start..@str_above_end].include? "\;") ? @filedata[@str_above_start..@str_above_end] : "")+font_to_delete
|
||||
@filedata =@filedata.sub(@str_to_delete,"")
|
||||
for @i in @str_start+1...@str_end
|
||||
next if @filedata[@i] == " "
|
||||
break if @filedata[@i] != "\;"
|
||||
@filedata.slice!(@i)
|
||||
end
|
||||
end
|
||||
puts self.used_font
|
||||
puts @filedata
|
||||
#render :html => @delete_font_array.to_s+" "+ @filedata and return
|
||||
@filetowrite.write(@filedata)
|
||||
@filetowrite.close
|
||||
@filetocover = File.open("config.js.erb","w")
|
||||
@filetocover.write(@filedata)
|
||||
@filetocover.close
|
||||
File.delete("config_back.js.erb")
|
||||
else
|
||||
@filedata1 = File.read("config.js.erb")
|
||||
@filedata2 = File.read("config_back.js.erb")
|
||||
if @filedata1.length < @filedata2.length
|
||||
@filetocover = File.open("config.js.erb","w")
|
||||
@filetocover.write(@filedata2)
|
||||
@filetocover.close
|
||||
end
|
||||
File.delete("config_back.js.erb")
|
||||
end
|
||||
Dir.chdir(Rails.root.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
def check_eql_array(array1,array2)
|
||||
if array1.count == array2.count
|
||||
array1.each do |item|
|
||||
if !(array2.include? item)
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
def update_user
|
||||
User.find(update_user_id) rescue nil
|
||||
end
|
||||
def update_user=(user)
|
||||
self.update_user_id = user.id
|
||||
end
|
||||
def email_members
|
||||
MemberProfile.find(self.email_member_ids) rescue []
|
||||
end
|
||||
def email_addresses
|
||||
addresses = self.email_members.collect{|member| member.email} rescue []
|
||||
addresses = addresses +[self.other_mailaddress] if !self.other_mailaddress.blank?
|
||||
addresses.flatten
|
||||
end
|
||||
def email
|
||||
mail = Email.find(self.email_id) rescue nil
|
||||
end
|
||||
def expired?
|
||||
(self.deadline < Time.now) rescue false
|
||||
end
|
||||
def destroy_email
|
||||
mail = Email.find(self.email_id) rescue nil
|
||||
mail.destroy if !mail.nil?
|
||||
end
|
||||
def self.remove_expired_status
|
||||
self.where(:is_top => true, :top_end_date.ne => nil, :top_end_date.lt => Time.now).each do |b|
|
||||
b.is_top = false
|
||||
b.top_end_date = nil
|
||||
b.save
|
||||
end
|
||||
end
|
||||
end
|
||||
Whitespace-only changes.
@@ -0,0 +1,122 @@
|
||||
<style>
|
||||
#approvalModal {
|
||||
width: 90%;
|
||||
height: 600px;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
margin: auto;
|
||||
position: absolute;
|
||||
}
|
||||
#approvalModal .preview-iframe {
|
||||
border: 0;
|
||||
outline: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#approvalModal .modal-body {
|
||||
background-color: #fff;
|
||||
padding: 0;
|
||||
max-height: none;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
#approvalModal .modal-left {
|
||||
overflow: auto;
|
||||
float: left;
|
||||
width: 19.8%;
|
||||
border-right: 1px solid #DFDFDF;
|
||||
height: 100%;
|
||||
padding: 1em;
|
||||
margin: 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#approvalModal .modal-right {
|
||||
float: right;
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
}
|
||||
.approvalModal__form {
|
||||
padding: 0 10px;
|
||||
margin: 0;
|
||||
}
|
||||
label.approvalModal__radio {
|
||||
display: inline-block;
|
||||
}
|
||||
label.control-label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.approvalModal__controls {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.approvalModal__group {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
label.approvalModal__label {
|
||||
display: inline-block;
|
||||
margin: 0 4px 0 7px;
|
||||
position: relative;
|
||||
top: -1px;
|
||||
}
|
||||
.approvalModal__controls .approvalModal__privacy {
|
||||
margin: 0 5px;
|
||||
}
|
||||
.approvalModal__controls .approvalModal__large {
|
||||
}
|
||||
#approvalModal .modal-footer {
|
||||
text-align: left;
|
||||
padding: 15px 10px 10px;
|
||||
}
|
||||
.approvalModal__group.confirm {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
<div id="approvalModal" class="modal hide fade" role="dialog">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3>預覽</h3>
|
||||
</div>
|
||||
<div class="modal-body clearfix">
|
||||
<div class="modal-left">
|
||||
<label for="____">寄送對象</label>
|
||||
</div>
|
||||
<div class="modal-right">
|
||||
<iframe class="preview-iframe"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<%= form_tag "/admin/announcement/approve_bulletin", :class=>"approvalModal__form" do %>
|
||||
<div class="approvalModal__group">
|
||||
<label class="control-label" for="bulletin_approval_stat">審核狀態</label>
|
||||
<div class="approvalModal__controls">
|
||||
<label class="approvalModal__radio">
|
||||
<input class="approvalModal__privacy" id="bulletin_is_checked_true" name="approved" type="radio" value="true">已認可
|
||||
</label>
|
||||
<label class="approvalModal__radio">
|
||||
<input checked="checked" class="approvalModal__privacy" id="bulletin_approved_false" name="approved" type="radio" value="false">拒絕
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="approvalModal__group group--reject">
|
||||
<label class="approvalModal__label" for="is_checked_false_拒絕原因">拒絕原因</label>
|
||||
<div class="approvalModal__controls">
|
||||
<input class="approvalModal__large" id="bulletin_not_checked_reason" name="reason" size="30" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="approvalModal__group confirm">
|
||||
<input class="approvalModal__btn btn btn-primary" name="commit" type="submit" value="送出">
|
||||
<input type="hidden" id="object_id" name="id" />
|
||||
<button class="approvalModal__btn btn" data-dismiss="modal" aria-hidden="true">關閉</button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,38 @@
|
||||
<%= form_for @announcement_feed, url: admin_announcement_updatefeed_path(:id => @announcement_feed.id), html: {class: "form-horizontal main-forms"} do |f| %>
|
||||
<fieldset>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="bulletin_feed_title_translations_<%= locale.to_s %>"><%= t(:title) + " (#{t(locale.to_s)})" %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, data: {"fv-validation" => "required;","fv-messages" => "Cannot be empty.;"}, value: (@announcement_feed.title_translations[locale.to_s] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<hr />
|
||||
<div class="tags">
|
||||
<div id="tags-list">
|
||||
<ul class="tags-groups checkbox-card module-tags">
|
||||
<% @module_app.tags.each do |tag| %>
|
||||
<li class="filter-item module">
|
||||
<p class='card pull-left <%= @announcement_feed.tag_ids.include?(tag.id.to_s) ? "active" : "" %>'>
|
||||
<input type="checkbox" <%= @announcement_feed.tag_ids.include?(tag.id.to_s) ? "checked=checked" : "" %> class="tag-checkbox" value="<%= tag.id.to_s %>" name="bulletin_feed[tag_ids][]">
|
||||
</p>
|
||||
<a href="#" onclick="return false;">
|
||||
<% @site_in_use_locales.each_with_index do |locale,index| %>
|
||||
<span class="tag"><%= tag.name_translations[locale] %></span>
|
||||
<% if index < (@site_in_use_locales.count - 1) %>
|
||||
/
|
||||
<% end %>
|
||||
<% end %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<tr>
|
||||
<td>
|
||||
<%= feed.title %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if can_edit_or_delete?(feed) %>
|
||||
<li><a href="#" class="edit-feed" data-feed-id="<%= feed.id.to_s %>"><%= t(:edit) %></a></li>
|
||||
<li><a href="/admin/announcement/deletefeed?id=<%= feed.id.to_s %>" class="delete-feed text-error" ><%= t(:delete_) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="tags">
|
||||
<div id="tags-list">
|
||||
<ul class="tags-groups checkbox-card module-tags">
|
||||
<% tags_to_remove = [] %>
|
||||
<% feed.tag_ids.each do |t| %>
|
||||
<% tag = Tag.find(t) rescue nil %>
|
||||
<% if !tag.nil? %>
|
||||
<li class="filter-item module">
|
||||
<a href="#" onclick="return false;">
|
||||
<% @site_in_use_locales.each_with_index do |locale,index| %>
|
||||
<span class="tag"><%= tag.name_translations[locale] %></span>
|
||||
<% if index < (@site_in_use_locales.count - 1) %>
|
||||
/
|
||||
<% end %>
|
||||
<% end %>
|
||||
</a>
|
||||
</li>
|
||||
<% else %>
|
||||
<% tags_to_remove << t %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !tags_to_remove.blank?
|
||||
tags_to_remove.each do |t|
|
||||
feed.tag_ids.delete(t)
|
||||
end
|
||||
feed.save
|
||||
end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/xhr/announcements/rssfeed/<%= feed.uid %>.rss" target="_blank">RSS Feed</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/xhr/announcements/feed/<%= feed.uid %>.json" target="_blank">JSON Feed</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,38 @@
|
||||
<%= form_for @announcement_feed, url: admin_announcement_createfeed_path, html: {class: "form-horizontal main-forms"} do |f| %>
|
||||
<fieldset>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="bulletin_feed_title_translations_<%= locale.to_s %>"><%= t(:title) + " (#{t(locale.to_s)})" %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, data: {"fv-validation" => "required;","fv-messages" => "Cannot be empty.;"}, value: (@announcement_feed.title_translations[locale.to_s] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<hr />
|
||||
<div class="tags">
|
||||
<div id="tags-list">
|
||||
<ul class="tags-groups checkbox-card module-tags">
|
||||
<% @module_app.tags.each do |tag| %>
|
||||
<li class="filter-item module">
|
||||
<p class="card pull-left">
|
||||
<input type="checkbox" class="tag-checkbox" value="<%= tag.id.to_s %>" name="bulletin_feed[tag_ids][]">
|
||||
</p>
|
||||
<a href="#" onclick="return false;">
|
||||
<% @site_in_use_locales.each_with_index do |locale,index| %>
|
||||
<span class="tag"><%= tag.name_translations[locale] %></span>
|
||||
<% if index < (@site_in_use_locales.count - 1) %>
|
||||
/
|
||||
<% end %>
|
||||
<% end %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -0,0 +1,472 @@
|
||||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||
<%= stylesheet_link_tag "lib/main-list" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||
<%= javascript_include_tag "lib/file-type" %>
|
||||
<%= javascript_include_tag "lib/module-area" %>
|
||||
<% end %>
|
||||
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
|
||||
<!-- Module Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
||||
<ul class="nav nav-pills module-nav">
|
||||
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
||||
<li><a href="#status" data-toggle="tab"><%= t(:status) %></a></li>
|
||||
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
||||
<li><a href="#imageupload" data-toggle="tab"><%= t(:image) %></a></li>
|
||||
<li><a href="#mail-group" data-toggle="tab"><%= t('announcement.email_reminder')%></a></li>
|
||||
</ul>
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
|
||||
<!-- Category -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:category) %></label>
|
||||
<div class="controls">
|
||||
<%= select_category(f, @module_app) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Date Time Picker -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:start_date) %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @bulletin.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:end_date) %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @bulletin.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :is_external_link, t("announcement.is_external_link"), :class => "control-label muted" %>
|
||||
<div class="controls">
|
||||
<%= f.check_box :is_external_link %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="display: none;" id="external_link_box">
|
||||
<%= f.label :external_link, t("announcement.external_link"), :class => "control-label muted" %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :external_link %>
|
||||
<div class="hint"><%= t("announcement.external_link_hint") %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Status Module -->
|
||||
<div class="tab-pane fade" id="status">
|
||||
|
||||
<!-- Status -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:status) %></label>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn <%= 'active' if @bulletin.is_top? || (!@bulletin.top_end_date.nil? && @bulletin.top_end_date > Time.now) %>">
|
||||
<%= f.check_box :is_top %> <%= t(:top) %>
|
||||
</label>
|
||||
<label class="checkbox inline btn <%= 'active' if @bulletin.is_hot? %>">
|
||||
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
||||
</label>
|
||||
<label class="checkbox inline btn <%= 'active' if @bulletin.is_hidden? %>">
|
||||
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
||||
</label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<% if !@bulletin.is_top? && !AnnouncementSetting.check_limit_for_user((@bulletin.new_record? ? current_user.id : @bulletin.create_user_id)) %>
|
||||
<span>Top limit has been reached. The bulletin wont be marked as top even if you click on it.</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group <%= @bulletin.is_top? || (!@bulletin.top_end_date.nil? && @bulletin.top_end_date > Time.now) ? "" : "hide" %>" data-for="is_top">
|
||||
<label for="" class="control-label muted">Top end time</label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :top_end_date, :no_label => true, :new_record => @bulletin.new_record? %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<%# end %>
|
||||
|
||||
<!-- Tag Module -->
|
||||
<div class="tab-pane fade" id="tag">
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:tags) %></label>
|
||||
<%= select_tags(f, @module_app) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Images Module -->
|
||||
<div class="tab-pane fade" id="imageupload">
|
||||
|
||||
<!-- Images Upload -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:image) %></label>
|
||||
<div class="controls">
|
||||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @bulletin.image.file %>" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @bulletin.image.file %>
|
||||
<%= image_tag @bulletin.image %>
|
||||
<% else %>
|
||||
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||
<span class="btn btn-file">
|
||||
<span class="fileupload-new"><%= t(:select_image) %></span>
|
||||
<span class="fileupload-exists"><%= t(:change) %></span>
|
||||
<%= f.file_field :image %>
|
||||
</span>
|
||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||
<%= f.check_box :remove_image %><%= t(:remove) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= f.fields_for :image_description_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="image_description_<%= locale.to_s %>"><%= t(:description) + " (#{t(locale.to_s)})" %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, value: (@bulletin.image_description_translations[locale.to_s] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Mail Group Module -->
|
||||
<div class="tab-pane fade" id="mail-group">
|
||||
|
||||
<!-- Mail Group -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("announcement.email_to") %></label>
|
||||
<div class="controls">
|
||||
|
||||
<label class="checkbox inline">
|
||||
<%= check_box_tag('bulletin[email_sent]', '1', (!@bulletin.email_sent.blank? ? true : false), :id=>'remind-check') %><%= t('announcement.activate_email_reminder')%>
|
||||
</label>
|
||||
|
||||
<div class="content-box">
|
||||
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'bulletin[email_member_ids][]', email_members: @bulletin.email_members} %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"></label>
|
||||
<div class="controls">
|
||||
<div class="content-box">
|
||||
<span class="help-block"><%= "#{t("announcement.other_mailaddress")}(#{t("announcement.other_mailaddress_note")})"%> </span>
|
||||
<%= f.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-box">
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("announcement.email_sentdate") %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :email_sentdate, :no_label => true %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if (@bulletin.email.is_sent rescue false) %>
|
||||
<div class="content-box">
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("announcement.resend_mail") %></label>
|
||||
<div class="controls">
|
||||
<input type="checkbox" name="resend_mail" value="true">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!-- Language -->
|
||||
<div class="tab-content language-area">
|
||||
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<!-- Title-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t(:title) %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@bulletin.title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sub Title -->
|
||||
<div class="control-group input-subtitle">
|
||||
<label class="control-label muted"><%= t(:subtitle) %></label>
|
||||
<div class="controls">
|
||||
<div class="textarea">
|
||||
<%= f.fields_for :subtitle_translations do |f| %>
|
||||
<%= f.text_area locale, rows: 2, class: "input-block-level", value: (@bulletin.subtitle_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="control-group input-content">
|
||||
<label class="control-label muted"><%= t(:content) %></label>
|
||||
<div class="controls">
|
||||
<div class="textarea">
|
||||
<%= f.fields_for :text_translations do |f| %>
|
||||
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@bulletin.text_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<!-- Link -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:link) %></label>
|
||||
<div class="controls add-input">
|
||||
|
||||
<!-- Exist -->
|
||||
<% if @bulletin && !@bulletin.bulletin_links.blank? %>
|
||||
<div class="exist">
|
||||
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
|
||||
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
|
||||
<%= render :partial => 'form_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Add -->
|
||||
<div class="add-target">
|
||||
</div>
|
||||
<p class="add-btn">
|
||||
<%= hidden_field_tag 'bulletin_link_field_count', @bulletin.bulletin_links.count %>
|
||||
<a id="add_link" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- File -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:file_) %></label>
|
||||
<div class="controls">
|
||||
|
||||
<!-- Exist -->
|
||||
<% if @bulletin && !@bulletin.bulletin_files.blank? %>
|
||||
<div class="exist">
|
||||
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
|
||||
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
|
||||
<%= render :partial => 'form_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Add -->
|
||||
<div class="add-target">
|
||||
</div>
|
||||
<p class="add-btn">
|
||||
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
|
||||
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<%= get_referer_url[:action] rescue "" %>
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
||||
<%= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn', type: :button %>
|
||||
<%= link_to t('cancel'), admin_announcements_path, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
<span id='show_preview'>
|
||||
<div class="modal hide fade in banner-preview" id="">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= t(:preview) %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<iframe id="preview-iframe" src=""></iframe>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
<% if !@module_app.tags.empty? %>
|
||||
<script type="text/javascript">
|
||||
$("form.previewable").on("submit", function(){
|
||||
if(!$("input[name='bulletin[tags][]']").is(":checked")){
|
||||
if(!confirm("You have selected no tag, do you wish to continue?")){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<script>
|
||||
function Appendzero(obj)
|
||||
{
|
||||
if(obj<10) return "0" +""+ obj;
|
||||
else return obj;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
if (location.pathname.substr(-3)=='new'){
|
||||
var getDate = new Date();
|
||||
var toDay = getDate.getFullYear()+"/"+ (Appendzero(getDate.getMonth()+1))+"/"+Appendzero(getDate.getDate())+" "+Appendzero(getDate.getHours())+":"+Appendzero(getDate.getMinutes());
|
||||
$('input[name="bulletin[postdate]"]').val(toDay);
|
||||
}
|
||||
|
||||
$("#main-wrap").after("");
|
||||
|
||||
$(document).on('click', '#add_link', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_bulletin_links", "g");
|
||||
var on = $('.language-nav li.active').index();
|
||||
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :bulletin_links) %>").replace(old_id, new_id));
|
||||
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
||||
formTip();
|
||||
});
|
||||
$(document).on('click', '#add_file', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_bulletin_files", "g");
|
||||
var on = $('.language-nav li.active').index();
|
||||
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :bulletin_files) %>").replace(old_id, new_id));
|
||||
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
||||
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
||||
});
|
||||
formTip();
|
||||
});
|
||||
$(document).on('click', '.delete_link', function(){
|
||||
$(this).parents('.input-prepend').remove();
|
||||
});
|
||||
$(document).on('click', '.delete_file', function(){
|
||||
$(this).parents('.input-prepend').remove();
|
||||
});
|
||||
$(document).on('click', '.remove_existing_record', function(){
|
||||
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||
$(this).children('.should_destroy').attr('value', 1);
|
||||
$(this).parents('.start-line').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
|
||||
$('#remind-check').on('change', function() {
|
||||
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
|
||||
})
|
||||
|
||||
$('#button_for_preview').click(function(){
|
||||
var method = $('.main-forms input[name="_method"]').val();
|
||||
$('.main-forms input[name="_method"]').val("post");
|
||||
|
||||
for ( instance in CKEDITOR.instances )
|
||||
CKEDITOR.instances[instance].updateElement();
|
||||
|
||||
var formData = new FormData( $('.main-forms')[0] );
|
||||
formData.append("preview_type", ( (method==undefined) ? "new" : "edit" ));
|
||||
formData.append("bulletin_id", '<%= @bulletin.id.to_s %>');
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: '<%= admin_announcement_preview_path %>',
|
||||
data : formData,
|
||||
processData: false,
|
||||
contentType: false
|
||||
}).done(function(data){
|
||||
if(window.location.protocol === "https:"){
|
||||
data = data.replace("http:","https:");
|
||||
}
|
||||
$('.modal-body iframe').attr('src',data);
|
||||
$('#show_preview .modal').modal();
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
|
||||
var slug = data.split('/')[(data.split('/').length-1)];
|
||||
// $('#preview-iframe').on('load', function(){
|
||||
// $.get('/admin/announcement/destroy_preview/'+slug,function(data){
|
||||
// });
|
||||
// });
|
||||
});
|
||||
$('.main-forms input[name="_method"]').val(method);
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#bulletin_is_top").parent().on("click",function(){
|
||||
setTimeout(function(){
|
||||
if($("#bulletin_is_top").parent().hasClass("active")){
|
||||
$("div[data-for=is_top]").removeClass("hide");
|
||||
}else{
|
||||
$("div[data-for=is_top]").addClass("hide");
|
||||
$("div[data-for=is_top]").find("input[type=text]").val("");
|
||||
}
|
||||
},100)
|
||||
})
|
||||
|
||||
$("#bulletin_is_external_link").on("click",function(){
|
||||
if($(this).is(":checked")){
|
||||
$("#external_link_box").show();
|
||||
}else{
|
||||
$("#external_link_box").hide();
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
@@ -0,0 +1,69 @@
|
||||
<% if form_file.new_record? %>
|
||||
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
|
||||
<% else %>
|
||||
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
|
||||
<% if form_file.file.blank? %>
|
||||
<%= t(:no_file) %>
|
||||
<% else %>
|
||||
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="input-prepend input-append">
|
||||
<label>
|
||||
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
|
||||
<i class="icons-paperclip"></i>
|
||||
<%= f.file_field :file %>
|
||||
</span>
|
||||
<div class="uneditable-input input-medium">
|
||||
<i class="icon-file fileupload-exists"></i>
|
||||
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
|
||||
</div>
|
||||
</label>
|
||||
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
|
||||
<span class="tab-content">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</span>
|
||||
<span class="add-on icons-pencil" title='<%= t(:description) %>'></span>
|
||||
<span class="tab-content">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
|
||||
<%= f.fields_for :description_translations do |f| %>
|
||||
<%= f.text_field locale, :class => "input-medium", placeholder: t(:description), :value => (form_file.description_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
<span class="add-on btn-group btn" title="<%= t('archive.show_lang') %>">
|
||||
<i class="icons-earth"></i> <span class="caret"></span>
|
||||
<ul class="dropdown-menu">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<li>
|
||||
<label class="checkbox">
|
||||
<%= check_box_tag "bulletin[bulletin_files_attributes][#{( form_file.new_record? ? 'new_bulletin_files' : "#{i}" )}][choose_lang][]", locale, form_file.choose_lang.include?(locale.to_s) %>
|
||||
<%= t(locale.to_s) %>
|
||||
</label>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= hidden_field_tag 'bulletin[bulletin_files_attributes][0][choose_lang][]', '' %>
|
||||
</span>
|
||||
<% if form_file.new_record? %>
|
||||
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
|
||||
<a class="icon-trash"></a>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
|
||||
<%= f.hidden_field :id %>
|
||||
<a class="icon-remove"></a>
|
||||
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
<div class="input-prepend input-append start-line">
|
||||
<span class="add-on icons-link" title="<%= t(:url) %>"></span>
|
||||
<%= f.text_field :url, class: "input-large", placeholder: t(:url) %>
|
||||
<span class="add-on icons-pencil" title="<%= t(:url_alt) %>"></span>
|
||||
<span class="tab-content">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= f.text_field locale, :class => "input-large", placeholder: t(:url_alt), :value => (form_link.title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
<% if form_link.new_record? %>
|
||||
<span class="delete_link add-on btn" title="<%= t(:delete_) %>">
|
||||
<a class="icon-trash"></a>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
|
||||
<%= f.hidden_field :id %>
|
||||
<a class="icon-remove"></a>
|
||||
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,37 @@
|
||||
<h3 title="CKEDITOR現有字形">CKEDITOR現有字形</h3>
|
||||
<%=form_for @field,:url=>{:controller=>"patchfiles" ,:action=>"newfont"} do |f|%>
|
||||
<% @i = 0 %>
|
||||
<div style="padding-left:1em">
|
||||
<%= f.fields_for :font_array do |fontfield|%>
|
||||
<% @count = @field.font_array.count %>
|
||||
<% for @i in 0...@count %>
|
||||
<div style="float:left;">
|
||||
<% if @field.font_array[@i.to_s].values.first == true%>
|
||||
<%=fontfield.check_box @field.font_array[@i.to_s].keys.first,{:checked=>true,:id=>"checkbox"+@i.to_s,:style=>"float:left;"} %>
|
||||
<% else %>
|
||||
<%=fontfield.check_box @field.font_array[@i.to_s].keys.first,{:id=>"checkbox"+@i.to_s,:style=>"float:left;"} %>
|
||||
<% end %>
|
||||
<%=fontfield.label @field.font_array[@i.to_s].keys.first,{:for=>"checkbox"+@i.to_s,:style=>"float:right;"}%>
|
||||
</div>
|
||||
<%end%>
|
||||
<%end%>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<div style="padding-left:1em"><label for="newfont" style="float:left;"><%=t(:newfont)%>:</label><%=f.text_field :new_add_font,{:id=>"newfont",:placeholder=>t(:newfont)}%></div>
|
||||
<%=f.submit "#{t(:updatefont)}"%>
|
||||
<%end%>
|
||||
<%@field.font_array%>
|
||||
|
||||
<style type="text/css">
|
||||
.show_li,.show_li *{
|
||||
list-style:none;
|
||||
color:black;
|
||||
}
|
||||
.show_li ul{
|
||||
display:none;
|
||||
}
|
||||
#clicktosee{
|
||||
color:blue;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,34 @@
|
||||
<%=form_for @font_settings,{:class=>"form-horizontal",:url=>{:controller=>"patchfiles" ,:action=>"editfontfile",:font=>"#{params[:font]}"}} do |f|%>
|
||||
<label for="fontname" style="float:left;margin-bottom:1em;padding-top: 0.3em;">font name:</label><%=f.text_field :title,{:value=>@font_settings.title,:id=>"fontname"}%>
|
||||
<div style="clear:both;"></div>
|
||||
<label for="fonturl" style="float:left;margin-bottom:1em;padding-top: 0.3em;">font url_link:</label><%=f.text_field :font_link,{:id=>"fonturl"}%>
|
||||
<div style="clear:both;"></div>
|
||||
<% if @font_settings.font_file_name != ""%>
|
||||
<label for="fontfile" style="float:left;margin-bottom:1em;padding-top: 0.3em;">font file:</label>
|
||||
<span id="fontfilename" style="font-size:1.2em;padding-top: 0.2em;float: left;"><%= @font_settings.font_file_name %></span>
|
||||
<div id="editname" style="float: left;cursor:pointer;"><a style="padding:0 1em;">edit</a></div>
|
||||
<div id="deletename" style="float: left;cursor:pointer;"><a>delete</a></div>
|
||||
<%=f.text_field :is_delete_font_file, {:id=>"hidden-file",:type => "hidden",:value=>@font_settings.is_delete_font_file} %>
|
||||
<%=f.file_field :font_file,{:id=>"fontfile",:value=>@font_settings.font_file_name,:style=>"display:none;"}%>
|
||||
<% else %>
|
||||
<label for="fontfile" style="float:left;margin-bottom:1em;padding-top: 0.3em;">font file:</label><%=f.file_field :font_file,{:id=>"fontfile",:value=>@font_settings.font_file_name}%>
|
||||
<% end %>
|
||||
<div style="clear:both;"></div>
|
||||
<%=f.submit "#{t(:updatefont)}"%>
|
||||
<%end%>
|
||||
<script>
|
||||
$('#editname').off('click').on('click',function(){
|
||||
$('#fontfilename').css('display','none');
|
||||
$('#editname').css('display','none');
|
||||
$('#fontfile').css('display','block');
|
||||
$('#deletename').css('display','none');
|
||||
});
|
||||
$('#deletename').off('click').on('click',function(){
|
||||
$('#fontfilename').css('display','none');
|
||||
$('#editname').css('display','none');
|
||||
$('#deletename').css('display','none');
|
||||
$('#hidden-file').val('true');
|
||||
$('#fontfile').css('display','block');
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,125 @@
|
||||
# encoding: utf-8
|
||||
|
||||
wb = xlsx_package.workbook
|
||||
|
||||
wb.add_worksheet(name: "Annoucement") 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 = ""
|
||||
@module_app.categories.asc(:created_at).each_with_index do |cat,i|
|
||||
t = t + "#{i}" + " -> " + cat.title + ", "
|
||||
end
|
||||
if @module_app.categories.count > 0
|
||||
t = t + " Example : 0"
|
||||
else
|
||||
t = "Leave this field blank"
|
||||
end
|
||||
row2 << t
|
||||
|
||||
row << t("tags")
|
||||
row1 << "select"
|
||||
t = ""
|
||||
@module_app.tags.asc(:created_at).each_with_index do |tag,i|
|
||||
t = t + "#{i}" + " -> " + tag.name + ", "
|
||||
end
|
||||
if @module_app.tags.count > 0
|
||||
t = t + " Example : 0,1,2"
|
||||
else
|
||||
t = "Leave this field blank"
|
||||
end
|
||||
row2 << t
|
||||
|
||||
row << t("start_date")
|
||||
row1 << "date"
|
||||
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
|
||||
|
||||
row << t("end_date")
|
||||
row1 << "date"
|
||||
row2 << "Format: YYYY/MM/DD, Example: 2015/12/12"
|
||||
|
||||
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("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("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"
|
||||
|
||||
|
||||
sheet.add_row row, :style => heading
|
||||
sheet.add_row row1
|
||||
sheet.add_row row2, :style => example
|
||||
|
||||
end
|
||||
@@ -0,0 +1,177 @@
|
||||
# encoding: utf-8
|
||||
|
||||
wb = xlsx_package.workbook
|
||||
|
||||
wb.add_worksheet(name: "Annoucement") 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("start_date")
|
||||
row1 << "date"
|
||||
row2 << "Format: YYYY/MM/DD, Example: 2015/12/10"
|
||||
|
||||
row << t("end_date")
|
||||
row1 << "date"
|
||||
row2 << "Format: YYYY/MM/DD, Example: 2015/12/12"
|
||||
|
||||
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("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("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"
|
||||
|
||||
|
||||
sheet.add_row row, :style => heading
|
||||
sheet.add_row row1
|
||||
sheet.add_row row2, :style => example
|
||||
|
||||
@announcements.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.postdate.strftime("%Y/%m/%d") rescue "")
|
||||
row << (anns.deadline.strftime("%Y/%m/%d") 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.subtitle_translations["en"]
|
||||
row << anns.subtitle_translations["zh_tw"]
|
||||
row << anns.text_translations["en"]
|
||||
row << anns.text_translations["zh_tw"]
|
||||
|
||||
links = anns.bulletin_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.bulletin_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(";")
|
||||
sheet.add_row row
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,124 @@
|
||||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag("admin/tags") %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "validator" %>
|
||||
<% end %>
|
||||
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<% @table_feed_fields.each do |f| %>
|
||||
<%= thead(f) %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render :partial => "feed", :collection => @feeds %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% if current_user.is_admin? or current_user.is_manager?(@module_app) %>
|
||||
|
||||
<div class="bottomnav clearfix" style="left: 81px;">
|
||||
<div class="action pull-right">
|
||||
<a class="btn btn-primary new-feed" href="#">
|
||||
<i class="icon-plus"></i> <%= t(:new_) %>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pagination pagination-centered"></div>
|
||||
</div>
|
||||
|
||||
<div id="newFeedModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="newFeedModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="newFeedModalLabel">Create New Feed</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%#= render :partial => "feed_form" %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" id="save_new_feed">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(".new-feed").on("click",function(){
|
||||
var modal = $("#newFeedModal");
|
||||
modal.find("#newFeedModalLabel").text("Create New Feed");
|
||||
modal.modal("show");
|
||||
openFeedModal("new",null);
|
||||
})
|
||||
|
||||
var bindEditButtons = function(){
|
||||
$(".edit-feed").on("click",function(){
|
||||
var modal = $("#newFeedModal");
|
||||
modal.find("#newFeedModalLabel").text("Edit Feed");
|
||||
modal.modal("show");
|
||||
openFeedModal("edit",$(this).data("feed-id"));
|
||||
return false;
|
||||
})
|
||||
$(".delete-feed").on("click",function(){
|
||||
if(confirm("Are you sure?")){
|
||||
var el = $(this);
|
||||
$.ajax({
|
||||
url : el.attr("href"),
|
||||
type : "delete",
|
||||
dataType : "html"
|
||||
}).done(function(data){
|
||||
$("table.main-list tbody").html(data);
|
||||
bindEditButtons();
|
||||
})
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
bindEditButtons();
|
||||
var openFeedModal = function(type,feed_id){
|
||||
$.ajax({
|
||||
url : "/admin/announcements/feedform",
|
||||
type : "get",
|
||||
data : {"type" : type, "id" : feed_id},
|
||||
dataType : "html"
|
||||
}).done(function(form){
|
||||
$("#newFeedModal .modal-body").html(form);
|
||||
bindHandlers();
|
||||
})
|
||||
}
|
||||
|
||||
var bindHandlers = function(){
|
||||
$(".tag-checkbox").on("click",function(){
|
||||
if($(this).is(":checked")){
|
||||
$(this).parent().addClass("active");
|
||||
}else{
|
||||
$(this).parent().removeClass("active");
|
||||
}
|
||||
})
|
||||
|
||||
var fv = new FormValidator($("#newFeedModal form"));
|
||||
fv.form.on("submit",function(){
|
||||
$.ajax({
|
||||
url : fv.form.attr("action"),
|
||||
data : fv.form.serializeArray(),
|
||||
type : "post",
|
||||
dataType : "html"
|
||||
}).done(function(data){
|
||||
$("table.main-list tbody").html(data);
|
||||
bindEditButtons();
|
||||
$("#newFeedModal").modal("hide");
|
||||
fv.form.resetForm();
|
||||
fv.form.find("ul.tags-groups p.active").removeClass("active");
|
||||
})
|
||||
return false;
|
||||
})
|
||||
$("#save_new_feed").on("click",function(){
|
||||
if(fv.isFormValidated()){
|
||||
fv.form.submit();
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</br>
|
||||
@@ -0,0 +1,87 @@
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<script type="text/javascript" src="/assets/validator.js"></script>
|
||||
<% end %>
|
||||
<form action="<%= admin_announcement_importanns_path %>" method="post" class="form-horizontal main-forms" id="import-anns-xls" enctype="multipart/form-data">
|
||||
<h3 style="padding-left: 30px;"><%= t("announcement.export_to_excel") %></h3>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<a href="<%= admin_announcement_export_excel_path(:format => "xlsx") %>"><%= t("announcement.export_all_anns") %></a>
|
||||
</div>
|
||||
</div>
|
||||
<h3 style="padding-left: 30px;"><%= t("announcement.import_from_excel") %></h3>
|
||||
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
|
||||
<div class="input-area">
|
||||
<% if @module_app.categories.count > 0 %>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<a href="<%= admin_announcement_excel_format_path(:format => "xlsx") %>"><%= t("announcement.download_example_sheet_here") %></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label for="import-anns" class="control-label muted"><%= t("upload") %></label>
|
||||
<div class="controls">
|
||||
<input type="file" id="import-anns" name="import_file" data-fv-validation="required;mustbexls;" data-fv-messages="Cannot be empty; Must be an excel file.;" />
|
||||
<span class="help-block"><%= t("announcement.please_create_tags_cats") %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<h4><%= t("announcement.create_atleast_one_cat") %></h4>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if @module_app.categories.count > 0 %>
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<%= t("restful_actions.import") %>" class="btn btn-primary">
|
||||
</div>
|
||||
<% end %>
|
||||
</form>
|
||||
|
||||
|
||||
<!-- import from wp xml -->
|
||||
<form action="<%= admin_announcement_import_from_wp_path %>" method="post" class="form-horizontal main-forms" id="import-anns-wp-xml" enctype="multipart/form-data">
|
||||
<h3 style="padding-left: 30px;"><%= t("announcement.import_from_wp_xml") %></h3>
|
||||
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
|
||||
<div class="input-area">
|
||||
<div class="control-group">
|
||||
<label for="import-anns-wp-xml" class="control-label muted"><%= t("upload") %></label>
|
||||
<div class="controls">
|
||||
<input type="file" id="import-anns-wp-xml" name="import_xml" data-fv-validation="required;mustbexml;" data-fv-messages="Cannot be empty; Must be an XML file.;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<%= t("restful_actions.import") %>" class="btn btn-primary">
|
||||
</div>
|
||||
</form>
|
||||
<!-- <form action="<%#= admin_announcement_import_from_xml_path %>" method="post" class="form-horizontal main-forms" id="import-anns-xml" enctype="multipart/form-data">
|
||||
<h3 style="padding-left: 30px;">Import from XML</h3>
|
||||
<%#= hidden_field_tag :authenticity_token, form_authenticity_token %>
|
||||
<div class="input-area">
|
||||
<div class="control-group">
|
||||
<label for="import-anns" class="control-label muted">URL :</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="import-anns" name="import_xml" data-fv-validation="required;url;" data-fv-messages="Cannot be empty; Must be an URL.;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="Import" class="btn btn-primary">
|
||||
</div>
|
||||
</form> -->
|
||||
<script type="text/javascript">
|
||||
var form = new FormValidator($("#import-anns-xls"));
|
||||
form.validate_functions.mustbexls = function(val){
|
||||
var t = val.split("."),
|
||||
ext = t[t.length - 1];
|
||||
return (ext == "xls" || ext == "xlsx")
|
||||
}
|
||||
var form = new FormValidator($("#import-anns-wp-xml"));
|
||||
form.validate_functions.mustbexml = function(val){
|
||||
var t = val.split("."),
|
||||
ext = t[t.length - 1];
|
||||
return (ext == "xml")
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,46 @@
|
||||
<div style="clear:both;"></div>
|
||||
<% @i = 0 %>
|
||||
<%=form_for @file_to_show ,:url=>{:controller=>"patchfiles" ,:action=>"edit"} do |file|%>
|
||||
<%= file.fields_for :file_show do |filefield|%>
|
||||
<% @file_to_show.file_show.each do |show| %>
|
||||
<%if show[1] == 1%>
|
||||
<%=filefield.check_box "file_show"+@i.to_s,{:checked=>true,:id=>"checkbox"+@i.to_s,:style=>"float:left;"}%>
|
||||
<%else%>
|
||||
<%=filefield.check_box "file_show"+@i.to_s,{:checked=>false,:id=>"checkbox"+@i.to_s,:style=>"float:left;"}%>
|
||||
<%end%>
|
||||
<% @i = @i+1 %>
|
||||
<%=show[0]%>
|
||||
<div style="clear:both;"></div>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<%=file.submit "#{t(:updatefont)}"%>
|
||||
<%end%>
|
||||
<li id ="ckeditorFont" class="show_li">
|
||||
<a title="CKEDITOR現有字形">CKEDITOR現有字形</a>
|
||||
<% @ckicktosee_str = (I18n.locale.to_s == "en") ? "click me to see all font which CKEDITOR have now" : "點擊我來查看編輯器所有目前擁有的字形" %>
|
||||
<a id="clicktosee" title="<%= @ckicktosee_str %>" class="Toggleclass"><%= @ckicktosee_str %></a>
|
||||
<ul>
|
||||
<% @font_array.each do |font|%>
|
||||
<li><a title="<%= font %>"><%= font %></a></li>
|
||||
<%end%>
|
||||
</ul>
|
||||
</li>
|
||||
<a></a>
|
||||
<style type="text/css">
|
||||
.show_li,.show_li *{
|
||||
list-style:none;
|
||||
color:balck;
|
||||
}
|
||||
.show_li ul{
|
||||
display:none;
|
||||
}
|
||||
#clicktosee{
|
||||
color:blue;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$('.Toggleclass').off("click").on("click",function(){
|
||||
$(this).parent().find(">ul").slideToggle();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,5 @@
|
||||
<%= form_for @bulletin, url: admin_announcements_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render :partial => 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
Whitespace-only changes.
@@ -0,0 +1,150 @@
|
||||
<style type="text/css">
|
||||
#notification{
|
||||
background-color: #ececec;
|
||||
font-size: 14px;
|
||||
left: 40%;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
top: 40px;
|
||||
width: auto;
|
||||
z-index: 1200;
|
||||
display: none;
|
||||
}
|
||||
.badge-info{
|
||||
margin-left: 10px;
|
||||
}
|
||||
#approver-list{
|
||||
list-style: none;
|
||||
margin-left: 5px;
|
||||
}
|
||||
#approver-list li {
|
||||
border-bottom: 1px solid #efefef;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
#approver-list .approver-avatar{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
#approver-list .approver-check{
|
||||
vertical-align: middle;
|
||||
margin-top: 25px;
|
||||
}
|
||||
#approver-list .approver-check input{
|
||||
margin-right: 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#approver-list .approver-check label{
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#approver-list .approver-title{
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<%
|
||||
sub_managers = @module_app.sub_managers
|
||||
sub_managers.delete(nil)
|
||||
%>
|
||||
<div id="notification"><%= t("announcement.click_on_submit") %></div>
|
||||
<%= form_for @setting, url: (@setting.new_record? ? admin_announcement_createsettings_path : admin_announcement_updatesettings_path), html: {class: "form-horizontal main-forms"} do |f| %>
|
||||
<div class="input-area">
|
||||
<div class="control-group">
|
||||
<%= f.label :top_limit, t("announcement.top_limit"), :class => "control-label muted" %>
|
||||
<div class="controls">
|
||||
<%= f.number_field :top_limit, :min => "0" %>
|
||||
<span class="help-block"><%= t("announcement.for_unlimited") %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% if AnnouncementSetting.is_pro? %>
|
||||
<% if !sub_managers.blank? %>
|
||||
<div class="control-group">
|
||||
<%= f.label "Approver Setting", :class => "control-label muted" %>
|
||||
<div class="controls">
|
||||
<a href="#approverModal" role="button" class="btn" data-toggle="modal"><%= t("announcement.approvers_list") %></a>
|
||||
<span class="badge badge-info"><%= @setting.approvers.count %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="control-group">
|
||||
<a href="/admin/authorizations/announcement"><%= t("announcement.click_set_sub_manager") %></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="control-group">
|
||||
<%= f.label "Send emails to", :class => "control-label muted" %>
|
||||
<div class="controls">
|
||||
<input type="checkbox" name="announcement_setting[email_to][]" value="admins" <%= @setting.email_to.include?("admins") ? "checked=checked" : "" %>> <%= t("admin") %>
|
||||
<input type="checkbox" name="announcement_setting[email_to][]" value="managers" <%= @setting.email_to.include?("managers") ? "checked=checked" : "" %>> <%= t("manager") %>
|
||||
<input type="checkbox" name="announcement_setting[email_to][]" value="approvers" <%= @setting.email_to.include?("approvers") ? "checked=checked" : "" %>> <%= t("announcement.approver") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden-approver-list">
|
||||
<% sub_managers.each do |sm| %>
|
||||
<% if @setting.approvers.include?(sm.id.to_s) %>
|
||||
<input type="hidden" id="check_<%= sm.id.to_s %>" value="<%= sm.id.to_s %>" name="announcement_setting[approvers][]">
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="form-actions">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if AnnouncementSetting.is_pro? %>
|
||||
<div id="approverModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="approverModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="approverModalLabel"><%= t("sub_manager") %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul id="approver-list">
|
||||
<% sub_managers.each do |sm| %>
|
||||
<li>
|
||||
<%= image_tag sm.member_profile.avatar.thumb, :class => "approver-avatar" %>
|
||||
<span class="approver-title"><%= sm.name %></span>
|
||||
<span class="pull-right approver-check">
|
||||
<input id="checkbox_<%= sm.id %>" type="checkbox" value="<%= sm.id %>" <%= @setting.approvers.include?(sm.id.to_s) ? "checked=checked" : "" %>>
|
||||
<label for="checkbox_<%= sm.id %>"><%= t("announcement.approver") %></label>
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Ok</button>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var approverList = $(".hidden-approver-list");
|
||||
$(".approver-check input").on("click",function(){
|
||||
var el = $(this);
|
||||
if(el.is(":checked")){
|
||||
var t = $("<input type='hidden'>");
|
||||
t.val(el.val());
|
||||
t.attr("name", "announcement_setting[approvers][]");
|
||||
t.attr("id", "check_" + el.val());
|
||||
approverList.append(t);
|
||||
}else{
|
||||
approverList.find("#check_" + el.val()).remove();
|
||||
}
|
||||
})
|
||||
$("#approverModal").on("hidden",function(){
|
||||
$("#notification").slideDown();
|
||||
$(".badge-info").text($(".hidden-approver-list input").length);
|
||||
})
|
||||
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<li id ="ckeditorFont" class="show_li">
|
||||
<a title="CKEDITOR現有字形">CKEDITOR現有字形</a>
|
||||
<% @ckicktosee_str = (I18n.locale.to_s == "en") ? "click me to see all font which CKEDITOR have now" : "點擊我來查看編輯器所有目前擁有的字形" %>
|
||||
<a id="clicktosee" title="<%= @ckicktosee_str %>" class="Toggleclass"><%= @ckicktosee_str %></a>
|
||||
<ul>
|
||||
<% @font_array.each do |font|%>
|
||||
<li><a title="<%= font %>" href="<%= admin_patchfiles_path %>/editfontfile?font=<%= font %>"><%= font %></a></li>
|
||||
<%end%>
|
||||
</ul>
|
||||
</li>
|
||||
<a href="<%=admin_patchfiles_path%>/editckeditor">點擊編輯</a>
|
||||
<a></a>
|
||||
<style type="text/css">
|
||||
.show_li,.show_li *{
|
||||
list-style:none;
|
||||
color:balck;
|
||||
}
|
||||
.show_li ul{
|
||||
display:none;
|
||||
}
|
||||
#clicktosee{
|
||||
color:blue;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$('.Toggleclass').off("click").on("click",function(){
|
||||
$(this).parent().find(">ul").slideToggle();
|
||||
});
|
||||
</script>
|
||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
<%= @data["html"].html_safe %>
|
||||
@@ -0,0 +1,3 @@
|
||||
<h3>Hello <%= @data["name"] %>,</h3>
|
||||
<p><%= @data["submitter"] %> <%= t("announcement.updated_annoucement") %>
|
||||
<a href="<%= @data['url'] %>" ><%= t("announcement.click_here_to_see") %></a>
|
||||
@@ -0,0 +1,3 @@
|
||||
<h3>Hello <%= @data["name"] %>,</h3>
|
||||
<p><%= @data["rejector"] %> <%= t("annoucement.rejected_annoucement") %> : <%= @data["reason"].nil? || @data["reason"] == "" ? "" : "#{@data["reason"]}" %></p>
|
||||
<a href="<%= @data['url'] %>" ><%= t("announcement.click_here_to_see") %></a>
|
||||
Reference in new issue
Block a user