complete new parser for layout_part

This commit is contained in:
Kaito committed 2011-08-10 17:28:10 +08:00
1 parent 278938a52d
commit 34d0b8fac1
5 files changed
+37 -7

No files matched your search

@@ -5,6 +5,8 @@ class Admin::SnippetsController < ApplicationController
before_filter :find_parent_item
before_filter :is_admin?
#Snippet is a object admin user can define his own tag and being used later on in parser
def show
#TODO
end
+8 -1
View File
@@ -1,5 +1,5 @@
class Layout < DesignFile
include Parser
embedded_in :design
attr_reader :content
@@ -8,7 +8,14 @@ class Layout < DesignFile
def content
self.file.read
end
def self.exist_one?
Layout.count > 0
end
after_save:parse_layout
def parse_layout
parse_layout_layout_part(self)
end
end
+5 -2
View File
@@ -3,9 +3,12 @@ class LayoutPart
include Mongoid::Document
include Mongoid::Timestamps
field :name
field :name_tag
field :id_tag
field :editable_tag
field :class_tag
field :content
belongs_to :layout
end
end
+1 -2
View File
@@ -4,7 +4,6 @@
<%= f.label :title, t('admin.title') %>
<%= f.text_field :title, :class => 'text' %>
</p>
<p>
<%= f.label :author, t('admin.author') %>
<%= f.text_field :author, :class => 'text' %>
@@ -31,7 +30,7 @@
<% if @design.structure_css.blank? %>
<%= f.file_field :structure_css %>
<% else%>
<%= File.basename (Design.all.last.structure_css.url) %>
<%= File.basename (@design.structure_css.url) %>
<% end %>
</p>
<p>