This commit is contained in:
BOHUNG 2020-01-13 16:27:25 +08:00
parent 38f9601a2b
commit 2bd6a5de31
1 changed files with 12 additions and 14 deletions

View File

@ -14,21 +14,19 @@ end
#Add patchfile to Admin area #Add patchfile to Admin area
@patchfile_li = File.read(app_path+"/patchfile_li.txt") @patchfile_li = File.read(app_path+"/patchfile_li.txt")
@patchfile_li_choices = File.read(app_path+"/patchfile_li_choices.txt") @patchfile_li_choices = File.read(app_path+"/patchfile_li_choices.txt")
Dir.chdir(ENV['PWD']+'/app/views/shared') do @file_text = File.read(ENV['PWD']+'/app/views/shared/_side_bar.html.erb")
@file_text = File.read("_side_bar.html.erb") if !@file_text.include?('<div class="patchfile sub-nav-block icons-megaphone">')
if !@file_text.include?('<div class="patchfile sub-nav-block icons-megaphone">') @indert_index = @file_text.index('</nav>')
@indert_index = @file_text.index('</nav>') @file_text.insert(@indert_index , @patchfile_li_choices)
@file_text.insert(@indert_index , @patchfile_li_choices)
end
if !@file_text.include?('patchfile_li')
@indert_index = @file_text.index('<li title="<%= t(\'site_info\') %>">')
@file_text.insert(@indert_index , @patchfile_li)
end
f = File.open('_side_bar.html.erb','w')
f.write(@file_text)
f.close
puts "finish change patchfile in #{ENV['PWD']}/app/views/shared"
end end
if !@file_text.include?('patchfile_li')
@indert_index = @file_text.index('<li title="<%= t(\'site_info\') %>">')
@file_text.insert(@indert_index , @patchfile_li)
end
f = File.open(ENV['PWD']+'/app/views/shared/_side_bar.html.erb','w')
f.write(@file_text)
f.close
puts "finish change patchfile in #{ENV['PWD']}/app/views/shared"
# Describe your gem and declare its dependencies: # Describe your gem and declare its dependencies:
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "patchfile" s.name = "patchfile"