liquid_feedback_frontend

view app/main/_filter_view/30_navigation.lua @ 1735:5a8a09119865

Added survey feature
author bsw
date Fri Oct 08 00:09:23 2021 +0200 (2021-10-08)
parents 63ce1a5c05c1
children 70c81027dbd5
line source
1 execute.inner()
3 local for_meta_navigation = false
4 if config.meta_navigation_items_func and config.meta_navigation_html_func then
5 for_meta_navigation =
6 request.get_module() == "index" and (
7 request.get_view() == "login"
8 or request.get_view() == "register"
9 or request.get_view() == "reset_password"
10 or request.get_view() == "send_login"
11 )
12 or (request.get_module() == "registration")
13 or (request.get_module() == "member" and request.get_view() == "show" and param.get_id() == app.session.member_id)
14 or (request.get_module() == "member" and request.get_view() == "history" and param.get_id() == app.session.member_id)
15 or (request.get_module() == "member" and (
16 string.match(request.get_view(), "^settings")
17 or string.match(request.get_view(), "^edit")
18 ))
19 local items = config.meta_navigation_items_func(app.session.member, for_meta_navigation and "login" or "LiquidFeedback")
20 local meta_navigation = config.meta_navigation_html_func(items)
21 slot.put_into("meta_navigation", meta_navigation)
22 local meta_navigation_style = config.meta_navigation_style_func(items)
23 slot.put_into("meta_navigation_style", meta_navigation_style)
24 if config.meta_navigation_extra_style_func then
25 local meta_navigation_extra_style = config.meta_navigation_extra_style_func(items)
26 slot.put_into("meta_navigation_style", meta_navigation_extra_style)
27 end
28 local meta_navigation_script = config.meta_navigation_script_func(items)
29 slot.put_into("script", meta_navigation_script)
30 end
32 if not config.meta_navigation_items_func or not config.meta_navigation_html_func then
33 slot.select ( 'header_bar', function ()
34 ui.tag{ tag = "header", attr = { class = "mdl-layout__header mdl-layout__header--seamed" }, content = function()
35 ui.container{ attr = { class = "mdl-layout__header-row" }, content = function()
36 ui.link{ module = "index", view = "index", attr = { class = "mdl-layout-title" }, content = function()
37 if config.instance_name then
38 ui.tag{ attr = { class = "mdl-layout--large-screen-only" }, content = config.instance_name .. " ♦" }
39 slot.put(" ")
40 end
41 ui.tag{ content = "LiquidFeedback" }
42 end }
43 ui.tag{ attr = { class = "mdl-layout-spacer" }, content = "" }
44 if app.session:has_access ("anonymous") then
45 ui.form { attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--expandable mdl-textfield--floating-label mdl-textfield--align-right" }, method = "get", module = "index", view = "search", content = function ()
46 ui.tag{ tag = "label", attr = { class = "mdl-button mdl-js-button mdl-button--icon", ["for"] = "fixed-header-drawer-exp" }, content = function()
47 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "search" }
48 end }
49 ui.container{ attr = { class = "mdl-textfield__expandable-holder" }, content = function()
50 ui.tag{ tag = "input", attr = { class = "mdl-textfield__input", type = "text", name = "q", id = "fixed-header-drawer-exp" }, content = "" }
51 end }
52 end }
53 end
55 if app.session.member == nil and not (
56 request.get_module() == "index" and (request.get_view() == "login" or request.get_view() == "reset_password" or request.get_view() == "send_login")
57 ) and not config.meta_navigation_html_func then
58 local redirect_params = json.object()
59 for key, val in pairs(request.get_param_strings()) do
60 if type(val) == "string" then
61 redirect_params[key] = val
62 else
63 -- shouldn't happen
64 error("array type params not implemented")
65 end
66 end
67 ui.tag{ tag = "nav", attr = { class = "mdl-navigation" }, content = function()
68 local link = {
69 content = function()
70 ui.tag{ tag = "i", attr = { class = "material-icons", ["aria-hidden"] = "true", role="presentation" }, content = "exit_to_app" }
71 slot.put(" ")
72 ui.tag{ attr = { class = "mdl-layout--large-screen-only" }, content = function()
73 ui.tag{ content = _"Login" }
74 end }
75 end,
76 text = _"Login",
77 attr = { class = "mdl-navigation__link" }
78 }
79 if config.login and config.login.method == "oauth2" then
80 link.module = "oauth2_client"
81 link.view = "redirect"
82 link.params = { provider = config.login.provider }
83 else
84 link.module = 'index'
85 link.view = 'login'
86 link.params = {
87 redirect_module = request.get_module(),
88 redirect_view = request.get_view(),
89 redirect_id = param.get_id(),
90 redirect_params = redirect_params
91 }
92 end
93 ui.link(link)
94 end }
95 end
97 if app.session.member and not (
98 config.meta_navigation_items_func and config.meta_navigation_html_func
99 ) then
100 ui.tag{ tag = "nav", attr = { class = "mdl-navigation" }, content = function()
101 ui.tag{ tag = "span", module = "member", view = "show", id = app.session.member.id, attr = { id = "lf-member-menu", class = "mdl-navigation__link" }, content = function()
102 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "person" }
103 ui.tag{ attr = { class = "mdl-layout--large-screen-only" }, content = function()
104 ui.tag{ content = app.session.member.name }
105 end }
106 end }
108 ui.tag { tag = "ul", attr = { class = "mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect", ["for"] = "lf-member-menu" }, content = function()
109 execute.view{ module = "member", view = "_menu", params = { item_class = "mdl-menu__item", link_class = "mdl-menu__link" } }
110 end }
111 end }
113 end -- if app.session.member
114 end }
115 end }
116 end)
117 end
119 if request.get_module() ~= "survey" then
120 execute.view{ module = "survey", view = "_notification" }
121 end
123 -- show notifications about things the user should take care of
124 --[[
125 if app.session.member then
126 execute.view{
127 module = "index", view = "_sidebar_notifications", params = {
128 mode = "link"
129 }
130 }
131 end
132 --]]
134 slot.select ("footer", function ()
135 ui.tag{ tag = "li", content = function()
136 ui.link{ content = _"Quick guide", module = "help", view = "introduction" }
137 end }
138 if app.session.member_id and app.session.member.admin then
139 if config.self_registration then
140 ui.tag{ tag = "li", content = function()
141 ui.link{ content = _"User management", module = "registration_admin", view = "index" }
142 end }
143 end
144 ui.tag{ tag = "li", content = function()
145 if config.admin_link then
146 ui.link(config.admin_link)
147 else
148 ui.link{ content = _"System settings", module = "admin", view = "index" }
149 end
150 end }
151 end
152 ui.tag{ tag = "li", content = function()
153 ui.link{
154 text = _"About site",
155 module = 'index',
156 view = 'about'
157 }
158 end }
159 if not config.extra_footer_func then
160 if config.use_terms and app.session.member then
161 ui.tag{ tag = "li", content = function()
162 ui.link{
163 text = _"Use terms",
164 module = 'index',
165 view = 'usage_terms'
166 }
167 end }
168 end
169 end
170 if config.extra_footer_func then
171 config.extra_footer_func()
172 end
173 ui.tag{ tag = "li", content = function()
174 ui.link{
175 text = _"LiquidFeedback",
176 external = "http://www.liquidfeedback.org/"
177 }
178 end }
179 end)
181 if not config.enable_debug_trace then
182 trace.disable()
183 else
184 slot.put_into('trace_button', '<div id="trace_show" onclick="document.getElementById(\'trace_content\').style.display=\'block\';this.style.display=\'none\';">TRACE</div>')
185 end
189 if app.current_initiative then
190 app.current_issue = app.current_initiative.issue
191 end
193 if app.current_issue then
194 app.current_area = app.current_issue.area
195 end
197 if app.current_area then
198 app.current_unit = app.current_area.unit
199 end

Impressum / About Us