fix some bug and add the feature that recovery ckeditor font list

This commit is contained in:
chiu committed 2019-09-28 23:38:15 +08:00
1 parent 8b44d2cc6f
commit 7eb02f0d1c
3 files changed
+67 -38

No files matched your search

+26 -13
View File
@@ -15,10 +15,6 @@ class Admin::PatchfilesController < OrbitAdminController
@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
@@ -78,17 +74,29 @@ class Admin::PatchfilesController < OrbitAdminController
redirect_to admin_patchfiles_showckeditor_path
end
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)
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
if params["patchfilefield"]["initial_btn"] == "true"
#render :html => @field.id and return
@field_to_copy = Patchfilefield.where("title"=>@app_title + "_back").first
@id = @field.id
@field = @field_to_copy
@field.id = @id
@field.title = @app_title
@field.update
redirect_to admin_patchfiles_editckeditor_path and return
else
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)
@key_arr = @field.font_array.keys
params["patchfilefield"]["font_array"].each_with_index do |(font,istrue),index|
if istrue =="0"
@field.font_array[@key_arr[index]][font] = false
elsif istrue =="1"
@field.font_array[@key_arr[index]][font] = true
end
end
@field.update
redirect_to admin_patchfiles_showckeditor_path and return
end
@field.update
redirect_to admin_patchfiles_showckeditor_path
end
def getfont
@ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor'
@@ -130,6 +138,11 @@ class Admin::PatchfilesController < OrbitAdminController
end
end
def create_first_field
if Patchfilefield.where("title"=>@app_title + "_back").take_while{true}.count == 0
@field = Patchfilefield.new()
@field.title=@app_title +"_back"
@field.save
end
@field
if Patchfilefield.where("title"=>@app_title).take_while{true}.count == 0
@field = Patchfilefield.new()