fix some bug

This commit is contained in:
BOHUNG 2019-09-28 21:19:38 +08:00
parent f8c03d2342
commit 4433d4d40d
2 changed files with 16 additions and 13 deletions

View File

@ -78,6 +78,7 @@ class Admin::PatchfilesController < OrbitAdminController
redirect_to admin_patchfiles_showckeditor_path redirect_to admin_patchfiles_showckeditor_path
end end
def newfont def newfont
params["patchfilefield"]["new_add_font"] = params["patchfilefield"]["new_add_font"].gsub('\"','').gsub("\'",'').gsub(";",'')
@field.new_add_font = params["patchfilefield"]["new_add_font"] rescue (redirect_to admin_patchfiles_showckeditor_path and return) @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| params["patchfilefield"]["font_array"].each_with_index do |(font,istrue),index|
if istrue =="0" if istrue =="0"

View File

@ -223,6 +223,7 @@ class Patchfilefield
end end
end end
@delete_font_array.each do |font_to_delete| @delete_font_array.each do |font_to_delete|
if @filedata.index(font_to_delete) != nil
@str_above_end = @filedata.index(font_to_delete) - 1 @str_above_end = @filedata.index(font_to_delete) - 1
@str_above_start @str_above_start
for @str_above_start in (0..@str_above_end).to_a.reverse for @str_above_start in (0..@str_above_end).to_a.reverse
@ -239,6 +240,7 @@ class Patchfilefield
@filedata.slice!(@i) @filedata.slice!(@i)
end end
end end
end
puts self.used_font puts self.used_font
puts @filedata puts @filedata
#render :html => @delete_font_array.to_s+" "+ @filedata and return #render :html => @delete_font_array.to_s+" "+ @filedata and return