page templates were not updated if a related snippet got modified (BUG)
This commit is contained in:
parent
989f608755
commit
a1cbdf9ed8
@ -44,7 +44,9 @@ module Locomotive
|
||||
def update_templates
|
||||
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 = ::I18n.with_locale(::Mongoid::Fields::I18n.locale) do
|
||||
pages = self.site.pages.any_in(:snippet_dependencies => [self.slug]).to_a
|
||||
end
|
||||
|
||||
pages.each do |page|
|
||||
self._change_snippet_inside_template(page.template.root)
|
||||
|
4
doc/TODO
4
doc/TODO
@ -160,6 +160,10 @@ REFACTORING:
|
||||
- move content_type and content_instances in the CustomFields plugin (much more appropriate)
|
||||
|
||||
BUGS:
|
||||
x mode author: settings KO + editable elements non visibles
|
||||
x locales pour le locomotive editor => KO
|
||||
- impossible de sauvegarder une page
|
||||
|
||||
|
||||
NICE TO HAVE:
|
||||
- export site
|
||||
|
@ -49,6 +49,29 @@ describe Locomotive::Snippet do
|
||||
|
||||
end
|
||||
|
||||
context '#i18n' do
|
||||
|
||||
before :each do
|
||||
Mongoid::Fields::I18n.with_locale(:fr) do
|
||||
@snippet = FactoryGirl.create(:snippet, :site => @site, :slug => 'my_localized_test_snippet', :template => 'a testing template')
|
||||
@page = FactoryGirl.create(:page, :site => @site, :slug => 'my_localized_test_snippet', :raw_template => "{% block main %}{% include 'my_localized_test_snippet' %}{% endblock %}")
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns the snippet dependencies depending on the UI locale' do
|
||||
Mongoid::Fields::I18n.with_locale(:fr) { @page.snippet_dependencies.should_not be_empty }
|
||||
Mongoid::Fields::I18n.with_locale(:en) { @page.snippet_dependencies.should be_nil }
|
||||
end
|
||||
|
||||
it 'updates the templates with the new snippet' do
|
||||
Mongoid::Fields::I18n.with_locale(:fr) do
|
||||
@snippet.update_attributes(:template => 'a new template')
|
||||
Locomotive::Page.find(@page.id).render({}).should == 'a new template'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user