Add help page for Foodsoft variables

This commit is contained in:
wvengen 2015-03-20 16:32:58 +01:00
parent a6f02a24d4
commit 15ac566ece
5 changed files with 38 additions and 1 deletions

View file

@ -1,6 +1,7 @@
# encoding: utf-8
class PagesController < ApplicationController
before_filter -> { require_plugin_enabled FoodsoftWiki }
before_filter :catch_special_pages, only: [:show, :new]
skip_before_filter :authenticate, :only => :all
before_filter :only => :all do
@ -140,4 +141,18 @@ class PagesController < ApplicationController
redirect_to wiki_page_path(@page.permalink)
end
def variables
keys = Foodsoft::ExpansionVariables.variables.keys
@variables = Hash[keys.map {|k| [k, Foodsoft::ExpansionVariables.get(k)]}]
render 'variables'
end
private
def catch_special_pages
if params[:id] == 'Help:Foodsoft_variables'
variables
end
end
end