Add help page for Foodsoft variables
This commit is contained in:
parent
a6f02a24d4
commit
15ac566ece
5 changed files with 38 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -85,5 +85,6 @@
|
|||
%td(colspan=2)
|
||||
%ul
|
||||
%li!= link_to t('.help.link_table'), '//www.mediawiki.org/wiki/Help:Tables', target: '_blank'
|
||||
%li!= link_to t('.help.link_variables'), page_path('Help:Foodsoft_variables'), target: '_blank'
|
||||
%li!= link_to t('.help.link_lists'), '//www.mediawiki.org/wiki/Help:Lists', target: '_blank'
|
||||
%li!= link_to t('.help.link_templates'), '//www.mediawiki.org/wiki/Help:Templates', target: '_blank'
|
||||
|
|
|
|||
16
plugins/wiki/app/views/pages/variables.html.haml
Normal file
16
plugins/wiki/app/views/pages/variables.html.haml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
- title t '.title'
|
||||
|
||||
%p= t '.description'
|
||||
|
||||
%table.table.table-hover
|
||||
%thead
|
||||
%tr
|
||||
%th= t '.variable'
|
||||
%th= t '.value'
|
||||
%tbody
|
||||
- @variables.each do |key, value|
|
||||
%tr
|
||||
%td
|
||||
%tt= "{{#{key}}}"
|
||||
%td
|
||||
= value
|
||||
Loading…
Add table
Add a link
Reference in a new issue