Fix bug when editing a page, the theme wasn't including blank
This commit is contained in:
parent
4db88282a1
commit
f2e3cb00db
|
@ -12,7 +12,7 @@ class Layout < DesignFile
|
|||
after_save :parse_layout
|
||||
|
||||
def content
|
||||
self.file.read.force_encoding("UTF-8")
|
||||
self.file.read.force_encoding("UTF-8") rescue ''
|
||||
end
|
||||
|
||||
def self.exist_one?
|
||||
|
|
|
@ -6,6 +6,6 @@ class Purchase
|
|||
field :title
|
||||
field :author
|
||||
field :intro
|
||||
field :downloaded
|
||||
field :downloaded, :type => Boolean
|
||||
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<p>
|
||||
<%= t('admin.theme') %>
|
||||
<% if @design %>
|
||||
<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }%>
|
||||
<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %>
|
||||
<% else %>
|
||||
<%= f.select :theme_id, @default_design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %>
|
||||
<% end %>
|
||||
|
|
|
@ -113,7 +113,7 @@ module Parser
|
|||
|
||||
def parse_page(page)
|
||||
if page._type == 'Page'
|
||||
layout_content = page.design.layout.content.force_encoding('UTF-8')
|
||||
layout_content = page.design.layout.content.force_encoding('UTF-8') rescue ''
|
||||
context = parser_context(page)
|
||||
parser = Radius::Parser.new(context, :tag_prefix => 'r')
|
||||
parser.parse(parser.parse(layout_content))
|
||||
|
@ -122,7 +122,7 @@ module Parser
|
|||
|
||||
def parse_page_edit(page)
|
||||
if page._type == 'Page'
|
||||
layout_content = page.design.layout.content.force_encoding('UTF-8')
|
||||
layout_content = page.design.layout.content.force_encoding('UTF-8') rescue ''
|
||||
context = parser_context_edit(page)
|
||||
parser = Radius::Parser.new(context, :tag_prefix => 'r')
|
||||
parser.parse(parser.parse(layout_content))
|
||||
|
@ -175,8 +175,8 @@ module Parser
|
|||
end
|
||||
c.define_tag 'stylesheets' do |tag|
|
||||
res = ''
|
||||
res << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />"
|
||||
res << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />"
|
||||
res << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />" if page.design.reset_css
|
||||
res << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />" if page.design.default_css
|
||||
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
|
||||
res << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />" if theme
|
||||
res
|
||||
|
|
|
@ -81,9 +81,9 @@ namespace :dev do
|
|||
design.build_layout
|
||||
design.layout.file = File.open("#{Rails.root}/lib/fraisier/layout.html")
|
||||
|
||||
design.layout
|
||||
theme
|
||||
theme_1
|
||||
design.layout.save
|
||||
theme.save
|
||||
theme_1.save
|
||||
# image.save
|
||||
# js.save
|
||||
|
||||
|
@ -105,9 +105,9 @@ namespace :dev do
|
|||
design_1.build_layout
|
||||
design_1.layout.file = File.open("#{Rails.root}/lib/fraisier/layout.html")
|
||||
|
||||
design_1.layout
|
||||
theme
|
||||
theme_1
|
||||
design_1.layout.save
|
||||
theme.save
|
||||
theme_1.save
|
||||
# image.save
|
||||
# js.save
|
||||
|
||||
|
|
Reference in New Issue