liquid_feedback_frontend

view app/main/index/index.lua @ 1722:1e8469114b3c

Added hook for logo only on start page
author bsw
date Tue Sep 28 09:15:27 2021 +0200 (2021-09-28)
parents 2558d9c15c44
children 0b43b2485930
line source
1 local unit_id = request.get_param{ name = "unit" }
2 local area_id = request.get_param{ name = "area" }
4 if unit_id == "all" then
5 unit_id = nil
6 area_id = nil
7 end
9 if area_id == "all" then
10 area_id = nil
11 end
13 local unit
14 local area
16 if unit_id then
17 unit = Unit:by_id(unit_id)
18 if not unit or unit.attr.hidden then
19 execute.view { module = "index", view = "404" }
20 request.set_status("404 Not Found")
21 return
22 end
23 unit:load_delegation_info_once_for_member_id(app.session.member_id)
24 end
27 if area_id then
28 area = Area:by_id(area_id)
29 if not area or (unit and area.unit_id ~= unit.id) then
30 execute.view { module = "index", view = "404" }
31 request.set_status("404 Not Found")
32 return
33 end
34 area:load_delegation_info_once_for_member_id(app.session.member_id)
35 end
37 if area then
38 execute.view{ module = "area", view = "_head", params = { area = area } }
39 elseif unit then
40 execute.view{ module = "unit", view = "_head", params = { unit = unit } }
41 end
44 ui.grid{ content = function()
45 ui.cell_main{ content = function()
47 execute.view{ module = "index", view = "_sidebar_motd_public" }
48 if not unit_id and not area_id then
49 execute.view{ module = "index", view = "_sidebar_motd_intern_top" }
50 end
52 execute.view{ module = "issue", view = "_list" }
53 end }
55 ui.cell_sidebar{ content = function()
56 if config.logo_startpage then
57 config.logo_startpage()
58 end
59 execute.view{ module = "index", view = "_head" }
61 execute.view{ module = "index", view = "_sidebar_motd" }
62 if app.session.member then
63 execute.view{ module = "index", view = "_sidebar_notifications" }
64 end
65 if config.firstlife then
66 ui.container{ attr = { class = "map mdl-special-card mdl-shadow--2dp pos-before-main" }, content = function()
67 ui.tag{ tag = "iframe", attr = { src = config.firstlife.areaviewer_url .. "?" .. config.firstlife.coordinates .. "&domain=" .. request.get_absolute_baseurl(), class = "map" }, content = "" }
68 end }
69 end
70 if config.map then
71 local initiatives = Initiative:new_selector():exec()
72 local geo_objects = {}
73 for i, initiative in ipairs(initiatives) do
74 if initiative.location and initiative.location.coordinates then
75 local geo_object = {
76 lon = initiative.location.coordinates[1],
77 lat = initiative.location.coordinates[2],
78 label = "i" .. initiative.id,
79 description = slot.use_temporary(function()
80 ui.link{ module = "initiative", view = "show", id = initiative.id, text = initiative.display_name }
81 end),
82 type = "initiative"
83 }
84 table.insert(geo_objects, geo_object)
85 end
86 end
87 if ontomap_get_instances then
88 local instances = ontomap_get_instances()
89 for i, instance in ipairs(instances) do
90 table.insert(geo_objects, instance)
91 end
92 end
93 ui.container{ attr = { class = "map mdl-special-card mdl-shadow--2dp pos-before-main" }, content = function()
94 ui.map(geo_objects)
95 end }
96 end
97 if config.logo then
98 config.logo()
99 end
100 if area then
101 execute.view{ module = "area", view = "_sidebar_whatcanido", params = { area = area } }
102 elseif unit then
103 execute.view{ module = "unit", view = "_sidebar_whatcanido", params = { unit = unit } }
104 else
105 execute.view{ module = "index", view = "_sidebar_whatcanido" }
106 end
108 execute.view { module = "index", view = "_sidebar_members" }
110 end }
111 end }

Impressum / About Us