liquid_feedback_frontend
view app/main/help/show.lua @ 1016:aab9dc793570
Corrected wrong usage of initiative list partial view in admin cancel issue
| author | bsw | 
|---|---|
| date | Sun Aug 11 22:09:01 2013 +0200 (2013-08-11) | 
| parents | d0f99272f675 | 
| children | 
 line source
     1 local id = param.get_id(atom.string)
     3 if not id then
     4   id = "index"
     5 else
     6   -- sanity check. Only allow letters, digits and _-
     7   id = string.match(id, "[%a%d_-]*")
     8 end
    10 if not app.html_title.title then
    11   app.html_title.title = _("Help #{id}", { id = id })
    12 end
    14 local basepath = request.get_app_basepath() 
    15 local found_help = false
    16 -- we try to load any help file that fits best
    17 for x,lang in ipairs{locale.get("lang"), "en"} do
    18   local file_name = basepath .. "/locale/help/" .. id .. "." .. lang .. ".txt.html"
    19   local file = io.open(file_name)
    20   if file ~= nil then
    21     local help_text = file:read("*a")
    22     if #help_text > 0 then
    23       found_help = true
    24       ui.container{
    25         attr = { class = "wiki" },
    26         content = function()
    27           slot.put(help_text)
    28         end
    29       }
    30       break
    31     end
    32   end
    33 end
    35 if not found_help then
    36   ui.field.text{ value = _("Missing help text: #{id}.#{lang}.txt", { id = id, lang = locale.get("lang") }) }
    37 end
