handle more liquid errors during page editing
This commit is contained in:
parent
45924d221a
commit
8196c0a6de
1
.gitignore
vendored
1
.gitignore
vendored
@ -24,3 +24,4 @@ tmp/*
|
||||
.rvmrc
|
||||
Capfile
|
||||
config/deploy.rb
|
||||
perf/test.rb
|
||||
|
@ -26,8 +26,11 @@ module Models
|
||||
@template.root.context.clear
|
||||
|
||||
self.serialized_template = BSON::Binary.new(Marshal.dump(@template))
|
||||
|
||||
rescue ::Liquid::SyntaxError => error
|
||||
self.errors.add :template, :liquid_syntax_error
|
||||
self.errors.add :template, :liquid_syntax
|
||||
rescue ::Locomotive::Liquid::PageNotFound => error
|
||||
self.errors.add :template, :liquid_extend
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -11,7 +11,8 @@ en:
|
||||
protected_page: "You can not remove index or 404 pages"
|
||||
extname_changed: "New file does not have the original extension"
|
||||
array_too_short: "is too small (minimum element number is %{count})"
|
||||
liquid_syntax_error: "Syntax error in page parts, please check the syntax"
|
||||
liquid_syntax: "Liquid Syntax error, please check the syntax"
|
||||
liquid_extend: "The page extends a template which does not exist"
|
||||
|
||||
attributes:
|
||||
defaults:
|
||||
|
@ -32,7 +32,8 @@ fr:
|
||||
protected_page: "Vous ne pouvez pas supprimer les pages index et 404"
|
||||
extname_changed: "Nouveau fichier n'a pas l'extension original"
|
||||
array_too_short: "est trop petit (le nombre minimum d'éléments est %{count})"
|
||||
liquid_syntax_error: "Erreur de syntaxe dans les sections de page, veuillez vérifier la syntaxe"
|
||||
liquid_syntax: "Erreur de syntaxe dans les sections de page, veuillez vérifier la syntaxe"
|
||||
liquid_extend: "La page étend le contenu d'une page qui n'existe pas"
|
||||
|
||||
attributes:
|
||||
defaults:
|
||||
|
5
lib/locomotive/liquid/errors.rb
Normal file
5
lib/locomotive/liquid/errors.rb
Normal file
@ -0,0 +1,5 @@
|
||||
module Locomotive
|
||||
module Liquid
|
||||
class PageNotFound < ::Liquid::Error; end
|
||||
end
|
||||
end
|
@ -3,8 +3,6 @@ module Locomotive
|
||||
module Tags
|
||||
class Extends < ::Liquid::Extends
|
||||
|
||||
class PageNotFound < ::Liquid::Error; end
|
||||
|
||||
def parse_parent_template(context)
|
||||
page = context[:site].pages.where(:fullpath => @template_name.gsub("'", '')).first
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user