Trying nokogiri
This commit is contained in:
1 parent
f9c5ee5d18
commit
f5fd3dec7a
10 files changed
+172
-75
No files matched your search
@@ -2,6 +2,8 @@ class Layout < DesignFile
|
||||
include ParserLayout
|
||||
|
||||
attr_reader :content
|
||||
|
||||
field :body
|
||||
|
||||
embeds_one :menu
|
||||
embedded_in :design
|
||||
@@ -17,8 +19,10 @@ class Layout < DesignFile
|
||||
Layout.count > 0
|
||||
end
|
||||
|
||||
def parse_layout
|
||||
parse_layout_contents(self)
|
||||
def parse_layout
|
||||
html = Nokogiri::HTML(self.file.read)
|
||||
self.body = html.at_css("body").inner_html
|
||||
parse_body(self)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -7,5 +7,9 @@ class Meta
|
||||
field :value, :default => nil
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
def get_name_content
|
||||
[self.key, self.value ? self.value : self.i18n_variable[I18n.locale]]
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user