From bd3d851a95018cd4abf695a8d8102df3e2d4a3e3 Mon Sep 17 00:00:00 2001 From: Jannik Streek Date: Tue, 19 Nov 2024 10:56:54 +0100 Subject: [PATCH] refactored component --- .../components/core_components.ex | 12 ++++++++-- .../brainstorming_live/share_component.ex | 9 +++++--- .../share_component.html.heex | 23 ++++++++----------- priv/gettext/de/LC_MESSAGES/default.po | 8 +++---- priv/gettext/default.pot | 8 +++---- priv/gettext/en/LC_MESSAGES/default.po | 8 +++---- 6 files changed, 38 insertions(+), 30 deletions(-) diff --git a/lib/mindwendel_web/components/core_components.ex b/lib/mindwendel_web/components/core_components.ex index d72b6dac..8bfe0e62 100644 --- a/lib/mindwendel_web/components/core_components.ex +++ b/lib/mindwendel_web/components/core_components.ex @@ -280,7 +280,11 @@ defmodule MindwendelWeb.CoreComponents do attr :errors, :list, default: [] attr :checked, :boolean, doc: "the checked flag for checkbox inputs" attr :prompt, :string, default: nil, doc: "the prompt for select inputs" - attr :options, :list, doc: "the options to pass to Phoenix.HTML.Form.options_for_select/2" + + attr :options, :list, + default: [], + doc: "the options to pass to Phoenix.HTML.Form.options_for_select/2" + attr :multiple, :boolean, default: false, doc: "the multiple flag for select inputs" attr :rest, :global, @@ -305,7 +309,11 @@ defmodule MindwendelWeb.CoreComponents do end) ~H""" -
+
<%= if has_moderating_permission(@brainstorming, @current_user) do %> -
- String.split("#") |> length == 2, do: true, else: false} - type="checkbox" - /> - -
+ <.input + name="admin_url_id" + type="checkbox" + options={["switch"]} + id="brainstorming-link-toggle-admin-secret" + phx-click="toggle_url_secret" + phx-target={@myself} + checked={secret_in_uri(@uri)} + label={gettext("Give moderating permissions")} + /> <% end %>
diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po index 709b9a6f..4d47572e 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -271,12 +271,12 @@ msgstr "Teilen" msgid "Share brainstorming" msgstr "Teile Dein Brainstorming" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:82 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:79 #, elixir-autogen, elixir-format msgid "Download as png" msgstr "Download als PNG" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:71 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:68 #, elixir-autogen, elixir-format msgid "Download as svg" msgstr "Download als SVG" @@ -327,7 +327,7 @@ msgstr "Nutzern das Verschieben und Sortieren von Ideen erlauben" msgid "Back" msgstr "Zurück" -#: lib/mindwendel_web/components/core_components.ex:514 +#: lib/mindwendel_web/components/core_components.ex:522 #, elixir-autogen, elixir-format msgid "Actions" msgstr "" @@ -565,7 +565,7 @@ msgstr "Datenschutzerklärung" msgid "Idea details" msgstr "Detailansicht" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:45 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:43 #, elixir-autogen, elixir-format msgid "Give moderating permissions" msgstr "Änderungen erlauben" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index e53ead55..1ed0acf2 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -270,12 +270,12 @@ msgstr "" msgid "Share brainstorming" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:82 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:79 #, elixir-autogen, elixir-format msgid "Download as png" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:71 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:68 #, elixir-autogen, elixir-format msgid "Download as svg" msgstr "" @@ -326,7 +326,7 @@ msgstr "" msgid "Back" msgstr "" -#: lib/mindwendel_web/components/core_components.ex:514 +#: lib/mindwendel_web/components/core_components.ex:522 #, elixir-autogen, elixir-format msgid "Actions" msgstr "" @@ -564,7 +564,7 @@ msgstr "" msgid "Idea details" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:45 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:43 #, elixir-autogen, elixir-format msgid "Give moderating permissions" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 307058c2..d16618e4 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -271,12 +271,12 @@ msgstr "Share" msgid "Share brainstorming" msgstr "Share brainstorming" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:82 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:79 #, elixir-autogen, elixir-format msgid "Download as png" msgstr "Download as png" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:71 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:68 #, elixir-autogen, elixir-format msgid "Download as svg" msgstr "Download as svg" @@ -327,7 +327,7 @@ msgstr "Allow users to change the order of ideas" msgid "Back" msgstr "" -#: lib/mindwendel_web/components/core_components.ex:514 +#: lib/mindwendel_web/components/core_components.ex:522 #, elixir-autogen, elixir-format msgid "Actions" msgstr "" @@ -565,7 +565,7 @@ msgstr "" msgid "Idea details" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:45 +#: lib/mindwendel_web/live/brainstorming_live/share_component.html.heex:43 #, elixir-autogen, elixir-format msgid "Give moderating permissions" msgstr ""