Skip to content

Commit

Permalink
make privacy and legal links configurable (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek authored Nov 9, 2024
1 parent 34436a1 commit c91dd9f
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 28 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,7 @@ Logos and text provided with courtesy of kits.
- https://github.com/gerardo-navarro
- https://github.com/nwittstruck
- Lightbulb stock image by LED Supermarket at Pexels: https://www.pexels.com/de-de/foto/die-gluhbirne-577514/

## Image Licenses
- Lightbulb, Pexels / CC0: https://www.pexels.com/license/, https://www.pexels.com/terms-of-service/
- GitHub Logo: https://github.com/logos
2 changes: 1 addition & 1 deletion assets/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ a .bi {
}

.bg-mindwendel {
background-image: url("/images/mindwendel.jpg");
background-image: url("/images/mindwendel.png");
background-repeat: no-repeat;
background-size: cover;
}
Expand Down
7 changes: 7 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ feature_file_upload =
String.trim(System.get_env("MW_FEATURE_IDEA_FILE_UPLOAD") || "")
)

feature_privacy_imprint_enabled =
Enum.member?(
["true"],
String.trim(System.get_env("MW_FEATURE_LEGAL_PRIVACY_LINKS") || "")
)

# enable/disable brainstorming teasers and configure delete brainstormings option:
config :mindwendel, :options,
feature_brainstorming_teasers:
Expand All @@ -171,6 +177,7 @@ config :mindwendel, :options,
),
feature_file_upload: feature_file_upload,
feature_brainstorming_removal_after_days: delete_brainstormings_after_days,
feature_privacy_imprint_enabled: feature_privacy_imprint_enabled,
# use a strict csp everywhere except in development. we need to relax the setting a bit for webpack
csp_relax: config_env() == :dev

Expand Down
25 changes: 25 additions & 0 deletions lib/mindwendel_web/controllers/static_page_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,29 @@ defmodule MindwendelWeb.StaticPageController do
form: form
)
end

def legal(conn, _params) do
if Application.fetch_env!(:mindwendel, :options)[:feature_privacy_imprint_enabled] do
render(conn, "legal.html")
else
render_404(conn)
end
end

def privacy(conn, _params) do
if Application.fetch_env!(:mindwendel, :options)[:feature_privacy_imprint_enabled] do
render(conn, "privacy.html")
else
render_404(conn)
end
end

defp render_404(conn) do
conn
|> put_status(:not_found)
|> put_view(MindwendelWeb.ErrorHTML)
|> put_layout(false)
|> put_root_layout(false)
|> render(:"404")
end
end
17 changes: 14 additions & 3 deletions lib/mindwendel_web/controllers/static_page_html/home.html.heex
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<div class="d-flex w-100 h-100 p-3 pb-0 mx-auto flex-column bg-mindwendel text-white">
<header class="mb-auto bg-none container">
<img src={~p"/images/mindwendel_logo_white.svg"} height="40px" class="float-md-start me-3" />
<.link
href="https://github.com/b310-digital/mindwendel"
class="text-reset text-decoration-none"
>
<img src={~p"/images/GitHub-Mark-Light-64px.png"} height="40" class="float-end" />
</.link>
<img src={~p"/images/mindwendel_logo_white.svg"} height="40" class="float-md-start me-3" />
<h3 class="mb-0">mindwendel</h3>
</header>

Expand All @@ -27,7 +33,7 @@
</.button>
</div>
</.simple_form>
<small class="text-muted">
<small class="text-light">
<%= gettext("Brainstormings will be deleted after %{days} days.",
days:
Application.fetch_env!(:mindwendel, :options)[
Expand Down Expand Up @@ -63,6 +69,11 @@
<% end %>
</main>
<footer class="mt-auto">
<p>Made with &hearts; by Gerardo, Jannik and Nicho</p>
<span class="me-2">Made with ❤️ in the 🇪🇺</span>
<%= if Application.fetch_env!(:mindwendel, :options)[:feature_privacy_imprint_enabled] do %>
<br class="d-md-none" />
<.link href={~p"/legal"}><%= gettext("Legal Disclosure") %></.link>
| <.link href={~p"/privacy"}><%= gettext("Privacy") %></.link>
<% end %>
</footer>
</div>
3 changes: 3 additions & 0 deletions lib/mindwendel_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ defmodule MindwendelWeb.Router do
get("/", StaticPageController, :home)
get("/files/:id", FileController, :get_file)

get("/legal", StaticPageController, :legal)
get("/privacy", StaticPageController, :privacy)

scope "/admin", Admin, as: :admin do
delete("/brainstormings/:id", BrainstormingController, :delete)
get("/brainstormings/:id/export", BrainstormingController, :export)
Expand Down
11 changes: 11 additions & 0 deletions lib/mindwendel_web/templates/layout/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@
</ul>
</li>

<%= if Application.fetch_env!(:mindwendel, :options)[:feature_privacy_imprint_enabled] do %>
<li aria-current="page" class="nav-item">
<.link href={~p"/privacy"} class="nav-link"><%= gettext("Privacy") %></.link>
</li>
<li aria-current="page" class="nav-item">
<.link href={~p"/legal"} class="nav-link">
<%= gettext("Legal Disclosure") %>
</.link>
</li>
<% end %>

<li class="nav-item"><hr class="dropdown-divider" /></li>
<%= for brainstorming <- list_brainstormings_for(@current_user, 10) do %>
<li class="nav-item d-lg-none">
Expand Down
28 changes: 20 additions & 8 deletions priv/gettext/de/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ msgstr ""
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:11
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:17
#, elixir-autogen, elixir-format
msgid "Brainstorm"
msgstr "Los geht's!"

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:20
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:26
#, elixir-autogen, elixir-format
msgid "How might we ..."
msgstr "Wie können wir ..."

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:10
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:16
#, elixir-autogen, elixir-format
msgid "Ready?"
msgstr "Fertig?"
Expand Down Expand Up @@ -60,12 +60,12 @@ msgstr "Schließen"
msgid "Copy"
msgstr "Kopieren"

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:9
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:15
#, elixir-autogen, elixir-format
msgid "Create a challenge."
msgstr "Erstelle ein Brainstorming."

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:26
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:32
#, elixir-autogen, elixir-format
msgid "Create!"
msgstr "Erstellen!"
Expand Down Expand Up @@ -179,7 +179,7 @@ msgstr "Editiere Brainstorming"
msgid "Export"
msgstr "Export"

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:44
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:50
#, elixir-autogen
msgid "Your latest brainstormings"
msgstr "Deine letzten Brainstormings"
Expand Down Expand Up @@ -215,7 +215,7 @@ msgstr "Zeige Link zur Administration für alle Nutzer"
msgid "Warning: Please make sure you save the admin link at the top, before hiding the settings link!"
msgstr "Achtung: Bitte speichere den Admin-Link oben ab, bevor du den Link zur Administration versteckst."

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:31
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:37
#, elixir-autogen, elixir-format
msgid "Brainstormings will be deleted after %{days} days."
msgstr "Brainstormings werden nach %{days} Tagen gelöscht."
Expand Down Expand Up @@ -315,7 +315,7 @@ msgstr "Leere das Brainstorming"
msgid "Brainstorming will be deleted %{days}"
msgstr "Brainstorming wird gelöscht %{days}"

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:56
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:62
#, elixir-autogen, elixir-format
msgid "Attention: Brainstormings will be deleted %{available_until} after last access!"
msgstr "Achtung: Brainstormings werden %{available_until} nach dem letzten Zugriff gelöscht!"
Expand Down Expand Up @@ -508,3 +508,15 @@ msgstr "Zu viele Dateien ausgewählt"
#, elixir-autogen, elixir-format, fuzzy
msgid "Allowed files: JPG/GIF/PNG/PDF"
msgstr "Erlaubte Dateiformate: JPG/PNG/PDF"

#: lib/mindwendel_web/components/../templates/layout/root.html.heex:86
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:75
#, elixir-autogen, elixir-format
msgid "Legal Disclosure"
msgstr "Impressum"

#: lib/mindwendel_web/components/../templates/layout/root.html.heex:82
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:76
#, elixir-autogen, elixir-format
msgid "Privacy"
msgstr "Datenschutzerklärung"
28 changes: 20 additions & 8 deletions priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
msgid ""
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:11
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:17
#, elixir-autogen, elixir-format
msgid "Brainstorm"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:20
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:26
#, elixir-autogen, elixir-format
msgid "How might we ..."
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:10
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:16
#, elixir-autogen, elixir-format
msgid "Ready?"
msgstr ""
Expand Down Expand Up @@ -59,12 +59,12 @@ msgstr ""
msgid "Copy"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:9
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:15
#, elixir-autogen, elixir-format
msgid "Create a challenge."
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:26
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:32
#, elixir-autogen, elixir-format
msgid "Create!"
msgstr ""
Expand Down Expand Up @@ -178,7 +178,7 @@ msgstr ""
msgid "Export"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:44
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:50
#, elixir-autogen
msgid "Your latest brainstormings"
msgstr ""
Expand Down Expand Up @@ -214,7 +214,7 @@ msgstr ""
msgid "Warning: Please make sure you save the admin link at the top, before hiding the settings link!"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:31
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:37
#, elixir-autogen, elixir-format
msgid "Brainstormings will be deleted after %{days} days."
msgstr ""
Expand Down Expand Up @@ -314,7 +314,7 @@ msgstr ""
msgid "Brainstorming will be deleted %{days}"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:56
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:62
#, elixir-autogen, elixir-format
msgid "Attention: Brainstormings will be deleted %{available_until} after last access!"
msgstr ""
Expand Down Expand Up @@ -507,3 +507,15 @@ msgstr ""
#, elixir-autogen, elixir-format
msgid "Allowed files: JPG/GIF/PNG/PDF"
msgstr ""

#: lib/mindwendel_web/components/../templates/layout/root.html.heex:86
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:75
#, elixir-autogen, elixir-format
msgid "Legal Disclosure"
msgstr ""

#: lib/mindwendel_web/components/../templates/layout/root.html.heex:82
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:76
#, elixir-autogen, elixir-format
msgid "Privacy"
msgstr ""
28 changes: 20 additions & 8 deletions priv/gettext/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ msgstr ""
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:11
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:17
#, elixir-autogen, elixir-format
msgid "Brainstorm"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:20
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:26
#, elixir-autogen, elixir-format
msgid "How might we ..."
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:10
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:16
#, elixir-autogen, elixir-format
msgid "Ready?"
msgstr ""
Expand Down Expand Up @@ -60,12 +60,12 @@ msgstr ""
msgid "Copy"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:9
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:15
#, elixir-autogen, elixir-format
msgid "Create a challenge."
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:26
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:32
#, elixir-autogen, elixir-format
msgid "Create!"
msgstr ""
Expand Down Expand Up @@ -179,7 +179,7 @@ msgstr ""
msgid "Export"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:44
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:50
#, elixir-autogen
msgid "Your latest brainstormings"
msgstr ""
Expand Down Expand Up @@ -215,7 +215,7 @@ msgstr ""
msgid "Warning: Please make sure you save the admin link at the top, before hiding the settings link!"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:31
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:37
#, elixir-autogen, elixir-format
msgid "Brainstormings will be deleted after %{days} days."
msgstr ""
Expand Down Expand Up @@ -315,7 +315,7 @@ msgstr ""
msgid "Brainstorming will be deleted %{days}"
msgstr ""

#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:56
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:62
#, elixir-autogen, elixir-format
msgid "Attention: Brainstormings will be deleted %{available_until} after last access!"
msgstr ""
Expand Down Expand Up @@ -508,3 +508,15 @@ msgstr ""
#, elixir-autogen, elixir-format, fuzzy
msgid "Allowed files: JPG/GIF/PNG/PDF"
msgstr ""

#: lib/mindwendel_web/components/../templates/layout/root.html.heex:86
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:75
#, elixir-autogen, elixir-format
msgid "Legal Disclosure"
msgstr ""

#: lib/mindwendel_web/components/../templates/layout/root.html.heex:82
#: lib/mindwendel_web/controllers/static_page_html/home.html.heex:76
#, elixir-autogen, elixir-format
msgid "Privacy"
msgstr ""
Binary file added priv/static/images/GitHub-Mark-Light-64px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed priv/static/images/mindwendel.jpg
Binary file not shown.
Binary file added priv/static/images/mindwendel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c91dd9f

Please sign in to comment.