Embed layout_parts in layout and correct typo
This commit is contained in:
parent
86443661e9
commit
20afb23a5f
|
@ -34,7 +34,6 @@ class Admin::PurchasesController < ApplicationController
|
||||||
temp_file.write response.body
|
temp_file.write response.body
|
||||||
temp_file.rewind
|
temp_file.rewind
|
||||||
zip_name = response['content-disposition'].split('filename=')[1].gsub(/[\\\"]|.zip/, '') rescue ''
|
zip_name = response['content-disposition'].split('filename=')[1].gsub(/[\\\"]|.zip/, '') rescue ''
|
||||||
debugger
|
|
||||||
unzip_design(temp_file, zip_name)
|
unzip_design(temp_file, zip_name)
|
||||||
temp_file.close
|
temp_file.close
|
||||||
temp_file.unlink
|
temp_file.unlink
|
||||||
|
@ -61,11 +60,12 @@ class Admin::PurchasesController < ApplicationController
|
||||||
temp = File.new(dir + '/' + title, 'w+')
|
temp = File.new(dir + '/' + title, 'w+')
|
||||||
temp.write orig_zip.read(zip_name + '/' + title)
|
temp.write orig_zip.read(zip_name + '/' + title)
|
||||||
design.layout.file = temp
|
design.layout.file = temp
|
||||||
|
design.layout.to_save = true
|
||||||
|
|
||||||
title = design.structure_css_filename
|
title = design.structure_css_filename
|
||||||
temp = File.new(dir + '/' + title, 'w+')
|
temp = File.new(dir + '/' + title, 'w+')
|
||||||
temp.write orig_zip.read(zip_name + '/' + title)
|
temp.write orig_zip.read(zip_name + '/' + title)
|
||||||
design.layout.file = temp
|
design.structure_css = temp
|
||||||
|
|
||||||
['themes', 'javascripts', 'images'].each do |type|
|
['themes', 'javascripts', 'images'].each do |type|
|
||||||
eval("design.#{type}").each do |object|
|
eval("design.#{type}").each do |object|
|
||||||
|
|
|
@ -3,7 +3,7 @@ class Layout < DesignFile
|
||||||
embedded_in :design
|
embedded_in :design
|
||||||
|
|
||||||
attr_reader :content
|
attr_reader :content
|
||||||
has_many :layout_parts
|
embeds_many :layout_parts
|
||||||
|
|
||||||
def content
|
def content
|
||||||
self.file.read
|
self.file.read
|
||||||
|
|
|
@ -9,6 +9,6 @@ class LayoutPart
|
||||||
field :class_tag
|
field :class_tag
|
||||||
field :content
|
field :content
|
||||||
|
|
||||||
belongs_to :layout
|
embedded_in :layout
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -230,12 +230,8 @@ module Parser
|
||||||
def parser_layout_layout_part(layout )
|
def parser_layout_layout_part(layout )
|
||||||
Radius::Context.new do |c|
|
Radius::Context.new do |c|
|
||||||
c.define_tag 'javascripts' do |tag|
|
c.define_tag 'javascripts' do |tag|
|
||||||
contents = tag.expand
|
|
||||||
contents.to_s
|
|
||||||
end
|
end
|
||||||
c.define_tag 'stylesheets' do |tag|
|
c.define_tag 'stylesheets' do |tag|
|
||||||
contents = tag.expand
|
|
||||||
contents.to_s
|
|
||||||
end
|
end
|
||||||
c.define_tag 'layout_part' do |tag|
|
c.define_tag 'layout_part' do |tag|
|
||||||
data={}
|
data={}
|
||||||
|
|
Loading…
Reference in New Issue