liquid_feedback_frontend
view app/main/api/navigation.lua @ 1430:5d891c23c8d7
Removed wrong condition
author | bsw |
---|---|
date | Fri Oct 05 21:58:05 2018 +0200 (2018-10-05) |
parents | 32cc544d5a5b |
children |
line source
1 local access_token = param.get("access_token")
2 local client_id = param.get("client_id")
3 local login_url = param.get("login_url")
4 local format = param.get("format")
6 if format ~= "html" and format ~= "raw_html" then
7 format = "json"
8 end
10 local items = config.meta_navigation_items_func(app.access_token and app.access_token.member or nil, client_id, login_url)
12 if format == "json" then
13 slot.set_layout(nil, "application/json")
14 local r = json.array()
15 for i, item in ipairs(items) do
16 r[#r+1] = json.object{
17 name = item.name,
18 description = item.description,
19 url = item.url,
20 active = item.active
21 }
22 end
23 slot.put_into("data", json.export(json.object{ result = r }))
24 elseif format == "html" then
25 slot.set_layout(nil, "application/json")
26 local html = config.meta_navigation_style_func(items) .. config.meta_navigation_html_func(items) .. config.meta_navigation_script_func(items)
27 slot.put_into("data", json.export(json.object{ result = html }))
28 elseif format == "raw_html" then
29 slot.set_layout(nil, "text/html")
30 local html = config.meta_navigation_style_func(items) .. config.meta_navigation_html_func(items) .. config.meta_navigation_script_func(items)
31 slot.put_into("data", html)
32 end