mv template load in page create and added tests

This commit is contained in:
Daniele Grandini
2016-08-27 15:51:18 +02:00
parent d702026134
commit fdbde7840d
2 changed files with 29 additions and 1 deletions
+7 -1
View File
@@ -105,7 +105,6 @@ module Precious
@css = settings.wiki_options[:css]
@js = settings.wiki_options[:js]
@mathjax_config = settings.wiki_options[:mathjax_config]
@template_page=wiki_page("/_Template").page.raw_data if settings.wiki_options[:template_page]
end
get '/' do
@@ -156,6 +155,7 @@ module Precious
get '/edit/*' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first)
@name = wikip.name
@path = wikip.path
@@ -320,6 +320,12 @@ module Precious
get '/create/*' do
forbid unless @allow_editing
if settings.wiki_options[:template_page] then
temppage = wiki_page("/_Template")
@template_page = (temppage.page != nil) ? temppage.page.raw_data : "Template page option is set, but no /_Template page is present or committed."
end
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
@name = wikip.name.to_url
@path = wikip.path