diff --git a/app/models/extensions/page/parse.rb b/app/models/extensions/page/parse.rb index fedae94a..7395b241 100644 --- a/app/models/extensions/page/parse.rb +++ b/app/models/extensions/page/parse.rb @@ -61,7 +61,7 @@ module Models context = default_context.merge(context) @template = ::Liquid::Template.parse(self.raw_template, context) - + self.template_dependencies = context[:templates] self.snippet_dependencies = context[:snippets] diff --git a/app/models/snippet.rb b/app/models/snippet.rb index c79e1aa9..1da66f92 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -32,13 +32,15 @@ class Snippet end def update_templates - return unless (self.site rescue nil) # not run if the site is being destroyed - + return unless (self.site rescue false) # not run if the site is being destroyed + pages = self.site.pages.any_in(:snippet_dependencies => [self.slug]).to_a pages.each do |page| self._change_snippet_inside_template(page.template.root) + page.instance_variable_set(:@template_changed, true) + page.send(:_serialize_template) && page.save end end diff --git a/doc/TODO b/doc/TODO index 98ba0596..ce01edf2 100644 --- a/doc/TODO +++ b/doc/TODO @@ -27,9 +27,10 @@ x import tool: x disable sub tasks by passing options x exceptions x page to import theme +x snippet dependencies => do not work correctly - global regions: keyword in editable element (http://www.mongodb.org/display/DOCS/Updating) - write my first tutorial about locomotive -- snippet dependencies => do not work correctly + - refactor slugify method (use parameterize + create a module) - [content types] the "display column" selector should not include file types