diff --git a/app/controllers/admin/.designs_controller.rb.swp b/app/controllers/admin/.designs_controller.rb.swp index d81669d2..5131583d 100644 Binary files a/app/controllers/admin/.designs_controller.rb.swp and b/app/controllers/admin/.designs_controller.rb.swp differ diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb index 8289ae07..3228eb6a 100644 --- a/app/controllers/admin/designs_controller.rb +++ b/app/controllers/admin/designs_controller.rb @@ -27,13 +27,10 @@ class Admin::DesignsController < ApplicationController Zip::ZipFile.open(file) { |zip_file| design = Design.new.from_json(zip_file.read("#{zip_name}/info.json")) Dir.mktmpdir('f_path') { |dir| - #layout_entry ="" - #struct_css_entry ="" design.build_layout themes_entries = [] javascripts_entries = [] images_entries = [] - debugger temp_file4layout = File.new(dir + '/' + zip_name+'-1', 'w+') temp_file4layout.binmode #dir/zip_name @@ -60,21 +57,22 @@ class Admin::DesignsController < ApplicationController images_entries << entry end end - debugger ['themes', 'javascripts', 'images'].each do |type| + eval("#{type}_entries").each do |entry| #incompleted - eval("#{type}.entries").each do |entry| - title = File.basename entry - debugger - temp_file = File.new(dir + '/' + title+'-3', 'w+') + filename = File.basename entry.to_s + temp_file = File.new(dir + '/' + filename, 'w+') + temp_file.binmode temp_file.write zip_file.read entry - object.file = temp_file - object.to_save = true + build_and_store = eval("design.#{type}").build + build_and_store.file = temp_file + build_and_store.file_filename = filename + build_and_store._type = (File.extname entry.to_s).delete '.' + build_and_store.to_save = true end end } - design.save } end