liquid_feedback_frontend

view app/main/_filter_view/30_navigation.lua @ 1788:b27b327be05e

Splitted translations for login as headline and as button
author bsw
date Wed Oct 20 15:25:41 2021 +0200 (2021-10-20)
parents 70c81027dbd5
children 2e5b303ea68e
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 [button]" }
74 end }
75 end,
76 attr = { class = "mdl-navigation__link" }
77 }
78 if config.login and config.login.method == "oauth2" then
79 link.module = "oauth2_client"
80 link.view = "redirect"
81 link.params = { provider = config.login.provider }
82 else
83 link.module = 'index'
84 link.view = 'login'
85 link.params = {
86 redirect_module = request.get_module(),
87 redirect_view = request.get_view(),
88 redirect_id = param.get_id(),
89 redirect_params = redirect_params
90 }
91 end
92 ui.link(link)
93 end }
94 end
96 if app.session.member and not (
97 config.meta_navigation_items_func and config.meta_navigation_html_func
98 ) then
99 ui.tag{ tag = "nav", attr = { class = "mdl-navigation" }, content = function()
100 ui.tag{ tag = "span", module = "member", view = "show", id = app.session.member.id, attr = { id = "lf-member-menu", class = "mdl-navigation__link" }, content = function()
101 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "person" }
102 ui.tag{ attr = { class = "mdl-layout--large-screen-only" }, content = function()
103 ui.tag{ content = app.session.member.name }
104 end }
105 end }
107 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()
108 execute.view{ module = "member", view = "_menu", params = { item_class = "mdl-menu__item", link_class = "mdl-menu__link" } }
109 end }
110 end }
112 end -- if app.session.member
113 end }
114 end }
115 end)
116 end
118 if config.survey and request.get_module() ~= "survey" then
119 execute.view{ module = "survey", view = "_notification" }
120 end
122 -- show notifications about things the user should take care of
123 --[[
124 if app.session.member then
125 execute.view{
126 module = "index", view = "_sidebar_notifications", params = {
127 mode = "link"
128 }
129 }
130 end
131 --]]
133 slot.select ("footer", function ()
134 ui.tag{ tag = "li", content = function()
135 ui.link{ content = _"Quick guide", module = "help", view = "introduction" }
136 end }
137 if app.session.member_id and app.session.member.admin then
138 if config.self_registration then
139 ui.tag{ tag = "li", content = function()
140 ui.link{ content = _"User management", module = "registration_admin", view = "index" }
141 end }
142 end
143 ui.tag{ tag = "li", content = function()
144 if config.admin_link then
145 ui.link(config.admin_link)
146 else
147 ui.link{ content = _"System settings", module = "admin", view = "index" }
148 end
149 end }
150 end
151 ui.tag{ tag = "li", content = function()
152 ui.link{
153 text = _"About site",
154 module = 'index',
155 view = 'about'
156 }
157 end }
158 if not config.extra_footer_func then
159 if config.use_terms and app.session.member then
160 ui.tag{ tag = "li", content = function()
161 ui.link{
162 text = _"Use terms",
163 module = 'index',
164 view = 'usage_terms'
165 }
166 end }
167 end
168 end
169 if config.extra_footer_func then
170 config.extra_footer_func()
171 end
172 ui.tag{ tag = "li", content = function()
173 ui.link{
174 text = _"LiquidFeedback",
175 external = "http://www.liquidfeedback.org/"
176 }
177 end }
178 end)
180 if not config.enable_debug_trace then
181 trace.disable()
182 else
183 slot.put_into('trace_button', '<div id="trace_show" onclick="document.getElementById(\'trace_content\').style.display=\'block\';this.style.display=\'none\';">TRACE</div>')
184 end
188 if app.current_initiative then
189 app.current_issue = app.current_initiative.issue
190 end
192 if app.current_issue then
193 app.current_area = app.current_issue.area
194 end
196 if app.current_area then
197 app.current_unit = app.current_area.unit
198 end

Impressum / About Us