fix some bug and add update accessibility
This commit is contained in:
1 parent
c3e52b08df
commit
67ec45d3d0
26 files changed
+34632
-26
No files matched your search
+82
-26
@@ -7,7 +7,8 @@ class Filefield
|
||||
|
||||
|
||||
field :title, :type=> String ,default:"patchfile"
|
||||
field :file_show, :type=> Hash ,default:{"ckeditor"=>0,"site-preference(two-site-logo)"=>0,"member"=>0}
|
||||
field :file_show, :type=> Hash ,default:{"ckeditor"=>0,"site-preference(two-site-logo)"=>0,"member"=>0,"accessibility"=>0}
|
||||
field :recovery, :type=> String , default:"false"
|
||||
after_update :updatefile
|
||||
|
||||
|
||||
@@ -34,53 +35,108 @@ class Filefield
|
||||
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/'
|
||||
@model_path = Rails.root.to_s + '/app/models/'
|
||||
@helper_path = Rails.root.to_s + '/app/helpers/'
|
||||
@views_path = Rails.root.to_s + '/app/views/'
|
||||
@controller_path = Rails.root.to_s + '/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/'
|
||||
@app_path = File.expand_path(__dir__)
|
||||
@app_path = lastpath(@app_path)
|
||||
@app_path = lastpath(@app_path)
|
||||
@ckeditor_path = Rails.root.to_s + '/app/assets/javascripts/ckeditor/'
|
||||
puts 'copying CKEDITOR'
|
||||
@aa = FileUtils.cd(app_path+'/updatefiles/')
|
||||
puts @aa.to_s
|
||||
begin
|
||||
Dir.chdir(@ckeditor_path)
|
||||
File.rename('config.js.erb','config.js.erb_back')
|
||||
rescue
|
||||
puts Dir.pwd
|
||||
end
|
||||
FileUtils.cd(@app_path+'/updatefiles/')
|
||||
begin
|
||||
FileUtils.cp('config.js.erb' , @ckeditor_path)
|
||||
puts @ckeditor_path
|
||||
rescue
|
||||
rescue
|
||||
puts Dir.pwd
|
||||
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
|
||||
@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
|
||||
Dir.chdir(@model_path)
|
||||
File.rename('site.rb','site.rb_back')
|
||||
Dir.chdir(@helper_path)
|
||||
File.rename('application_helper.rb','application_helper.rb_back')
|
||||
Dir.chdir(@views_path+'admin/sites/')
|
||||
File.rename('preference.html.erb','preference.html.erb_back')
|
||||
rescue
|
||||
puts Dir.pwd
|
||||
end
|
||||
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
|
||||
FileUtils.cp('preference.html.erb',@views_path+'admin/sites/')
|
||||
rescue
|
||||
puts Dir.pwd
|
||||
Dir.chdir(Rails.root.to_s)
|
||||
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/')
|
||||
@app_path = File.expand_path(__dir__)
|
||||
@app_path = lastpath(@app_path)
|
||||
@app_path = lastpath(@app_path)
|
||||
begin
|
||||
Dir.chdir(@model_path)
|
||||
File.rename('member_profile.rb','member_profile.rb_back')
|
||||
Dir.chdir(@controller_path+'admin/')
|
||||
File.rename('members_controller.rb','members_controller.rb_back')
|
||||
Dir.chdir(@views_path+'admin/members/')
|
||||
File.rename('_user_basic_passwd.html.erb','_user_basic_passwd.html.erb_back')
|
||||
rescue
|
||||
puts Dir.pwd
|
||||
end
|
||||
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
|
||||
FileUtils.cd('admin/')
|
||||
FileUtils.cp('members_controller.rb' , @controller_path+'admin/')
|
||||
FileUtils.cp('_user_basic_passwd.html.erb' , @views_path+'admin/members/')
|
||||
rescue
|
||||
puts Dir.pwd
|
||||
Dir.chdir(Rails.root.to_s)
|
||||
puts 'error copy'
|
||||
end
|
||||
elsif key == "accessibility"
|
||||
@app_path = File.expand_path(__dir__)
|
||||
@app_path = lastpath(@app_path)
|
||||
@app_path = lastpath(@app_path)
|
||||
begin
|
||||
Dir.chdir(@views_path+'layouts/')
|
||||
File.rename('back_end.html.erb','back_end.html.erb_back')
|
||||
Dir.chdir(@views_path+'page_parts/')
|
||||
File.rename('_form.html.erb','_form.html.erb_back')
|
||||
rescue
|
||||
puts Dir.pwd
|
||||
end
|
||||
FileUtils.cd(@app_path+'/updatefiles/accessibility/')
|
||||
puts 'copying accessibility'
|
||||
begin
|
||||
FileUtils.cp('back_end.html.erb' , @views_path+'layouts/')
|
||||
FileUtils.cp('_form.html.erb' , @views_path+'page_parts/')
|
||||
FileUtils.cp_r('jquery-ui-1.12.1/' , ENV['PWD'] + '/app/assets/stylesheets/lib/jquery-ui-1.12.1/')
|
||||
rescue
|
||||
puts Dir.pwd
|
||||
Dir.chdir(Rails.root.to_s)
|
||||
puts 'error copy'
|
||||
end
|
||||
end
|
||||
Dir.chdir(Rails.root.to_s)
|
||||
FileUtils.cd(Rails.root.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user