liquid_feedback_frontend

diff app/main/api/navigation.lua @ 1309:32cc544d5a5b

Cumulative patch for upcoming frontend version 4
author bsw/jbe
date Sun Jul 15 14:07:29 2018 +0200 (2018-07-15)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/api/navigation.lua	Sun Jul 15 14:07:29 2018 +0200
     1.3 @@ -0,0 +1,34 @@
     1.4 +local access_token = param.get("access_token")
     1.5 +local client_id = param.get("client_id")
     1.6 +local login_url = param.get("login_url")
     1.7 +local format = param.get("format")
     1.8 +
     1.9 +if format ~= "html" and format ~= "raw_html" then
    1.10 +  format = "json"
    1.11 +end
    1.12 +
    1.13 +local items = config.meta_navigation_items_func(app.access_token and app.access_token.member or nil, client_id, login_url)
    1.14 +
    1.15 +if format == "json" then
    1.16 +  slot.set_layout(nil, "application/json")
    1.17 +  local r = json.array()
    1.18 +  for i, item in ipairs(items) do
    1.19 +    r[#r+1] = json.object{
    1.20 +      name = item.name,
    1.21 +      description = item.description,
    1.22 +      url = item.url,
    1.23 +      active = item.active
    1.24 +    }
    1.25 +  end
    1.26 +  slot.put_into("data", json.export(json.object{ result = r }))
    1.27 +elseif format == "html" then
    1.28 +  slot.set_layout(nil, "application/json")
    1.29 +  local html = config.meta_navigation_style_func(items) .. config.meta_navigation_html_func(items) .. config.meta_navigation_script_func(items)
    1.30 +  slot.put_into("data", json.export(json.object{ result = html }))
    1.31 +elseif format == "raw_html" then
    1.32 +  slot.set_layout(nil, "text/html")
    1.33 +  local html = config.meta_navigation_style_func(items) .. config.meta_navigation_html_func(items) .. config.meta_navigation_script_func(items)
    1.34 +  slot.put_into("data", html)
    1.35 +end
    1.36 +
    1.37 +

Impressum / About Us