Embed layout_parts in layout and correct typo

This commit is contained in:
chris2tof 2011-08-18 16:27:04 +08:00
parent 86443661e9
commit 20afb23a5f
4 changed files with 4 additions and 8 deletions

View File

@ -34,7 +34,6 @@ class Admin::PurchasesController < ApplicationController
temp_file.write response.body
temp_file.rewind
zip_name = response['content-disposition'].split('filename=')[1].gsub(/[\\\"]|.zip/, '') rescue ''
debugger
unzip_design(temp_file, zip_name)
temp_file.close
temp_file.unlink
@ -61,11 +60,12 @@ class Admin::PurchasesController < ApplicationController
temp = File.new(dir + '/' + title, 'w+')
temp.write orig_zip.read(zip_name + '/' + title)
design.layout.file = temp
design.layout.to_save = true
title = design.structure_css_filename
temp = File.new(dir + '/' + title, 'w+')
temp.write orig_zip.read(zip_name + '/' + title)
design.layout.file = temp
design.structure_css = temp
['themes', 'javascripts', 'images'].each do |type|
eval("design.#{type}").each do |object|

View File

@ -3,7 +3,7 @@ class Layout < DesignFile
embedded_in :design
attr_reader :content
has_many :layout_parts
embeds_many :layout_parts
def content
self.file.read

View File

@ -9,6 +9,6 @@ class LayoutPart
field :class_tag
field :content
belongs_to :layout
embedded_in :layout
end

View File

@ -230,12 +230,8 @@ module Parser
def parser_layout_layout_part(layout )
Radius::Context.new do |c|
c.define_tag 'javascripts' do |tag|
contents = tag.expand
contents.to_s
end
c.define_tag 'stylesheets' do |tag|
contents = tag.expand
contents.to_s
end
c.define_tag 'layout_part' do |tag|
data={}