Skip to content

Commit

Permalink
chore: set text codes as default (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwittstruck authored Sep 18, 2024
1 parent 391634a commit fe90f40
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
13 changes: 7 additions & 6 deletions lib/qrstorage_web/templates/qr_code/form.html.heex
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

<div class="btn-group mb-3 w-100 d-flex justify-content-between" id="content-type-selector" role="group">
<%= radio_button(:qr_code, :content_type, "text",
class: "btn-check content-type",
autocomplete: "off",
checked: content_group_checked(@changeset, "text")
) %>
<label class="btn btn-primary" for="qr_code_content_type_text">Text</label>
<%= radio_button(:qr_code, :content_type, "audio",
class: "btn-check content-type",
autocomplete: "off",
Expand All @@ -11,12 +18,6 @@
checked: content_group_checked(@changeset, "recording")
) %>
<label class="btn btn-primary" for="qr_code_content_type_recording">Recording</label>
<%= radio_button(:qr_code, :content_type, "text",
class: "btn-check content-type",
autocomplete: "off",
checked: content_group_checked(@changeset, "text")
) %>
<label class="btn btn-primary" for="qr_code_content_type_text">Text</label>
<%= radio_button(:qr_code, :content_type, "link",
class: "btn-check content-type",
autocomplete: "off",
Expand Down
4 changes: 2 additions & 2 deletions lib/qrstorage_web/views/qr_code_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ defmodule QrstorageWeb.QrCodeView do
alias Qrstorage.Scrubber.TextScrubber

def content_group_checked(changeset, content_group) do
# Without changes, we default to show the content group of the type audio:
# Without changes, we default to show the content group of the type text:
if changeset.changes == %{} do
case content_group do
"audio" -> true
"text" -> true
_ -> false
end
else
Expand Down
10 changes: 5 additions & 5 deletions priv/gettext/de/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ msgstr "Fehler beim Upload der Audio-Datei."
msgid "Error while extracting audio file from plug: Invalid content type"
msgstr "Fehler beim Upload der Audio-Datei."

#: lib/qrstorage/services/qr_code_service.ex:85
#: lib/qrstorage/services/qr_code_service.ex:89
#: lib/qrstorage/services/qr_code_service.ex:88
#: lib/qrstorage/services/qr_code_service.ex:92
#, elixir-autogen, elixir-format
msgid "Qr code recording not extracted"
msgstr "Fehler beim Upload der Audio-Datei."
Expand Down Expand Up @@ -260,8 +260,8 @@ msgstr "Die Seite konnte nicht gefunden werden."
msgid "QR-Code has been deleted?"
msgstr "QR-Codes werden nach Inaktivität und Ablauf der ausgewählten Speicherdauer gelöscht."

#: lib/qrstorage/services/qr_code_service.ex:102
#: lib/qrstorage/services/qr_code_service.ex:106
#: lib/qrstorage/services/qr_code_service.ex:105
#: lib/qrstorage/services/qr_code_service.ex:109
#, elixir-autogen, elixir-format
msgid "Qr code tts not stored"
msgstr ""
Expand All @@ -281,7 +281,7 @@ msgstr "Aufnahmen werden nach 30 Tagen Inaktivität gelöscht."
msgid "Text was automatically translated by DeepL."
msgstr "Der Text wurde automatisch übersetzt von DeepL."

#: lib/qrstorage/services/qr_code_service.ex:55
#: lib/qrstorage/services/qr_code_service.ex:58
#, elixir-autogen, elixir-format
msgid "Rate limit reached."
msgstr "Derzeit können keine QR-Codes erstellt werden. Bitte versuch es später erneut."
10 changes: 5 additions & 5 deletions priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ msgstr ""
msgid "Error while extracting audio file from plug: Invalid content type"
msgstr ""

#: lib/qrstorage/services/qr_code_service.ex:85
#: lib/qrstorage/services/qr_code_service.ex:89
#: lib/qrstorage/services/qr_code_service.ex:88
#: lib/qrstorage/services/qr_code_service.ex:92
#, elixir-autogen, elixir-format
msgid "Qr code recording not extracted"
msgstr ""
Expand Down Expand Up @@ -259,8 +259,8 @@ msgstr ""
msgid "QR-Code has been deleted?"
msgstr ""

#: lib/qrstorage/services/qr_code_service.ex:102
#: lib/qrstorage/services/qr_code_service.ex:106
#: lib/qrstorage/services/qr_code_service.ex:105
#: lib/qrstorage/services/qr_code_service.ex:109
#, elixir-autogen, elixir-format
msgid "Qr code tts not stored"
msgstr ""
Expand All @@ -280,7 +280,7 @@ msgstr ""
msgid "Text was automatically translated by DeepL."
msgstr ""

#: lib/qrstorage/services/qr_code_service.ex:55
#: lib/qrstorage/services/qr_code_service.ex:58
#, elixir-autogen, elixir-format
msgid "Rate limit reached."
msgstr ""
10 changes: 5 additions & 5 deletions priv/gettext/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ msgstr ""
msgid "Error while extracting audio file from plug: Invalid content type"
msgstr ""

#: lib/qrstorage/services/qr_code_service.ex:85
#: lib/qrstorage/services/qr_code_service.ex:89
#: lib/qrstorage/services/qr_code_service.ex:88
#: lib/qrstorage/services/qr_code_service.ex:92
#, elixir-autogen, elixir-format
msgid "Qr code recording not extracted"
msgstr ""
Expand Down Expand Up @@ -260,8 +260,8 @@ msgstr ""
msgid "QR-Code has been deleted?"
msgstr ""

#: lib/qrstorage/services/qr_code_service.ex:102
#: lib/qrstorage/services/qr_code_service.ex:106
#: lib/qrstorage/services/qr_code_service.ex:105
#: lib/qrstorage/services/qr_code_service.ex:109
#, elixir-autogen, elixir-format
msgid "Qr code tts not stored"
msgstr ""
Expand All @@ -281,7 +281,7 @@ msgstr ""
msgid "Text was automatically translated by DeepL."
msgstr "Text was automatically translated by DeepL."

#: lib/qrstorage/services/qr_code_service.ex:55
#: lib/qrstorage/services/qr_code_service.ex:58
#, elixir-autogen, elixir-format
msgid "Rate limit reached."
msgstr ""

0 comments on commit fe90f40

Please sign in to comment.