liquid_feedback_frontend

view app/main/_filter_view/30_navigation.lua @ 1668:6d75df24e66e

Updated German translation
author bsw
date Sun Mar 07 09:52:36 2021 +0100 (2021-03-07)
parents 63ce1a5c05c1
children 5a8a09119865
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 -- show notifications about things the user should take care of
120 --[[
121 if app.session.member then
122 execute.view{
123 module = "index", view = "_sidebar_notifications", params = {
124 mode = "link"
125 }
126 }
127 end
128 --]]
130 slot.select ("footer", function ()
131 ui.tag{ tag = "li", content = function()
132 ui.link{ content = _"Quick guide", module = "help", view = "introduction" }
133 end }
134 if app.session.member_id and app.session.member.admin then
135 if config.self_registration then
136 ui.tag{ tag = "li", content = function()
137 ui.link{ content = _"User management", module = "registration_admin", view = "index" }
138 end }
139 end
140 ui.tag{ tag = "li", content = function()
141 if config.admin_link then
142 ui.link(config.admin_link)
143 else
144 ui.link{ content = _"System settings", module = "admin", view = "index" }
145 end
146 end }
147 end
148 ui.tag{ tag = "li", content = function()
149 ui.link{
150 text = _"About site",
151 module = 'index',
152 view = 'about'
153 }
154 end }
155 if not config.extra_footer_func then
156 if config.use_terms and app.session.member then
157 ui.tag{ tag = "li", content = function()
158 ui.link{
159 text = _"Use terms",
160 module = 'index',
161 view = 'usage_terms'
162 }
163 end }
164 end
165 end
166 if config.extra_footer_func then
167 config.extra_footer_func()
168 end
169 ui.tag{ tag = "li", content = function()
170 ui.link{
171 text = _"LiquidFeedback",
172 external = "http://www.liquidfeedback.org/"
173 }
174 end }
175 end)
177 if not config.enable_debug_trace then
178 trace.disable()
179 else
180 slot.put_into('trace_button', '<div id="trace_show" onclick="document.getElementById(\'trace_content\').style.display=\'block\';this.style.display=\'none\';">TRACE</div>')
181 end
185 if app.current_initiative then
186 app.current_issue = app.current_initiative.issue
187 end
189 if app.current_issue then
190 app.current_area = app.current_issue.area
191 end
193 if app.current_area then
194 app.current_unit = app.current_area.unit
195 end

Impressum / About Us