# HG changeset patch
# User bsw
# Date 1643153601 -3600
# Node ID 2e5b303ea68e6a0bb1d89e8acc1f0f295a281cfa
# Parent 85ca5a7e46ec1ffdf3355ff75e7157230afda44f
Better handling of use terms, added view for privacy policy
diff -r 85ca5a7e46ec -r 2e5b303ea68e app/main/_filter/21_auth.lua
--- a/app/main/_filter/21_auth.lua Tue Jan 25 00:46:06 2022 +0100
+++ b/app/main/_filter/21_auth.lua Wed Jan 26 00:33:21 2022 +0100
@@ -70,7 +70,8 @@
or module == "draft" and view == "show"
or module == "file" and view == "show.jpg"
or module == "index" and view == "search"
- or module == "index" and view == "usage_terms"
+ or module == "index" and view == "usage_terms" and config.use_terms_public_access == true
+ or module == "index" and view == "privacy" and config.use_terms_public_access == true
or module == "help" and view == "introduction"
or module == "style"
then
diff -r 85ca5a7e46ec -r 2e5b303ea68e app/main/_filter_view/30_navigation.lua
--- a/app/main/_filter_view/30_navigation.lua Tue Jan 25 00:46:06 2022 +0100
+++ b/app/main/_filter_view/30_navigation.lua Wed Jan 26 00:33:21 2022 +0100
@@ -155,16 +155,25 @@
view = 'about'
}
end }
- if not config.extra_footer_func then
- if config.use_terms and app.session.member then
+ if not config.extra_footer_func and (config.use_terms_public_access or app.session.member)then
+ if config.use_terms then
ui.tag{ tag = "li", content = function()
ui.link{
- text = _"Use terms",
+ text = config.use_terms_linktext or _"Use terms",
module = 'index',
view = 'usage_terms'
}
end }
end
+ if config.privacy_policy then
+ ui.tag{ tag = "li", content = function()
+ ui.link{
+ text = config.privacy_policy_linktext or _"Privacy policy",
+ module = 'index',
+ view = 'privacy'
+ }
+ end }
+ end
end
if config.extra_footer_func then
config.extra_footer_func()
diff -r 85ca5a7e46ec -r 2e5b303ea68e app/main/index/privacy.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/index/privacy.lua Wed Jan 26 00:33:21 2022 +0100
@@ -0,0 +1,24 @@
+if not config.privacy_policy then
+ return execute.view { module = "index", view = "404" }
+end
+
+ui.title(config.privacy_policy_headline or _"Privacy policy")
+
+ui.grid{ content = function()
+ ui.cell_main{ content = function()
+ ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
+ ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
+ ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = function()
+ ui.tag{ content = config.privacy_policy_headline or _"Privacy policy" }
+ if config.privacy_policy_subheadline then
+ slot.put("
")
+ ui.tag{ attr = { style = "font-size: 75%;" }, content = config.privacy_policy_subheadline }
+ end
+ end }
+ end }
+ ui.container{ attr = { class = "mdl-card__content draft" }, content = function()
+ slot.put(config.privacy_policy)
+ end }
+ end }
+ end }
+end }
diff -r 85ca5a7e46ec -r 2e5b303ea68e app/main/index/usage_terms.lua
--- a/app/main/index/usage_terms.lua Tue Jan 25 00:46:06 2022 +0100
+++ b/app/main/index/usage_terms.lua Wed Jan 26 00:33:21 2022 +0100
@@ -1,19 +1,24 @@
-ui.title(_"Terms of use")
-
-ui.section( function()
+if not config.use_terms then
+ return execute.view { module = "index", view = "404" }
+end
- ui.sectionHead( function()
- ui.heading { level = 1, content = _"Terms of use" }
- end )
-
- ui.sectionRow( function()
+ui.title(config.use_terms_headline or _"Terms of use")
- ui.container{
- attr = { class = "wiki use_terms" },
- content = function()
+ui.grid{ content = function()
+ ui.cell_main{ content = function()
+ ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
+ ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
+ ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = function()
+ ui.tag{ content = config.use_terms_headline or _"Terms of use" }
+ if config.use_terms_subheadline then
+ slot.put("
")
+ ui.tag{ attr = { style = "font-size: 75%;" }, content = config.use_terms_subheadline }
+ end
+ end }
+ end }
+ ui.container{ attr = { class = "mdl-card__content draft" }, content = function()
slot.put(config.use_terms)
- end
- }
-
- end )
-end )
\ No newline at end of file
+ end }
+ end }
+ end }
+end }