Skip to content

Commit

Permalink
Add all_songs switch
Browse files Browse the repository at this point in the history
  • Loading branch information
pehala committed Dec 1, 2023
1 parent 5a88821 commit ed8db76
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 25 deletions.
34 changes: 17 additions & 17 deletions backend/locale/cs/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-26 16:41+0000\n"
"POT-Creation-Date: 2023-12-01 13:22+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -47,7 +47,7 @@ msgstr "Přidat Kategorii"
msgid "Add Song"
msgstr "Přidat písničku"

#: backend/menus.py:33 backend/models.py:95
#: backend/menus.py:33 backend/models.py:70
msgid "Songs"
msgstr "Písničky"

Expand All @@ -63,35 +63,35 @@ msgstr "Změna hesla"
msgid "Account"
msgstr "Účet"

#: backend/models.py:32
#: backend/models.py:24
msgid "Name"
msgstr "Název písničky"

#: backend/models.py:34
#: backend/models.py:26
msgid "Capo"
msgstr ""

#: backend/models.py:35
#: backend/models.py:27
msgid "Author"
msgstr "Autor"

#: backend/models.py:36
#: backend/models.py:28
msgid "Youtube Link"
msgstr "Odkaz na Youtube"

#: backend/models.py:37
#: backend/models.py:29
msgid "Categories"
msgstr "Kategorie"

#: backend/models.py:38
#: backend/models.py:30
msgid "Archived"
msgstr "Archivovat"

#: backend/models.py:39
#: backend/models.py:31
msgid "Lyrics"
msgstr "Text"

#: backend/models.py:94
#: backend/models.py:69
msgid "Song"
msgstr "Písnička"

Expand All @@ -118,12 +118,12 @@ msgid "Edit"
msgstr "Editor"

#: backend/templates/songs/fragments/song.html:20
#: backend/templates/songs/index.html:47 backend/templates/songs/song.html:18
#: backend/templates/songs/index.html:49 backend/templates/songs/song.html:18
msgid "Delete"
msgstr "Smazat"

#: backend/templates/songs/fragments/song.html:34
#: backend/templates/songs/index.html:60 backend/templates/songs/song.html:30
#: backend/templates/songs/index.html:64 backend/templates/songs/song.html:30
msgid "Transpose"
msgstr "Transponovat"

Expand All @@ -135,25 +135,25 @@ msgstr "Skrýt akordy"
msgid "Prevent sleep"
msgstr "Zabránit uspání"

#: backend/templates/songs/index.html:73
#: backend/templates/songs/index.html:77
msgid "Search"
msgstr "Hledat"

#: backend/templates/songs/index.html:75
#: backend/templates/songs/index.html:79
msgid "Number, text or author"
msgstr "Číslo, text nebo autor"

#: backend/views.py:88
#: backend/views.py:84
#, python-format
msgid "Song %(name)s was successfully created"
msgstr "Písnička %(name)s byla úspěšně přidána"

#: backend/views.py:104
#: backend/views.py:100
#, python-format
msgid "Song %(name)s was successfully updated"
msgstr "Písnička %(name)s byla úspěšně upravena"

#: backend/views.py:120
#: backend/views.py:116
#, python-format
msgid "Song %s was successfully deleted"
msgstr "Písnička %s byla úspěšně odstraněna"
3 changes: 2 additions & 1 deletion backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
SongUpdateView,
SongDeleteView,
IndexSongListView,
SongListView,
)

urlpatterns = [
path("", IndexSongListView.as_view(), name="index"),
path("add", SongCreateView.as_view(), name="add"),
path("edit/<int:pk>", SongUpdateView.as_view(), name="edit"),
path("delete/<int:pk>", SongDeleteView.as_view(), name="delete"),
# path("api/songs", SongsDatatableView.as_view(), name="songs"),
path("all", SongListView.as_view(), name="all"),
]
4 changes: 2 additions & 2 deletions pdf/locale/cs/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-26 16:41+0000\n"
"POT-Creation-Date: 2023-12-01 13:21+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -164,7 +164,7 @@ msgstr "Přesouvání PDF požadavků do Tenant"
msgid "To Tenant"
msgstr "Do Tenanta"

#: pdf/templates/pdf/index.html:46
#: pdf/templates/pdf/index.html:45
msgid "Table of Contents"
msgstr "Obsah"

Expand Down
18 changes: 15 additions & 3 deletions tenants/locale/cs/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-20 18:41+0000\n"
"POT-Creation-Date: 2023-12-01 13:21+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -23,11 +23,15 @@ msgstr ""
msgid "Tenant"
msgstr "Zpěvník"

#: tenants/menus.py:50
#: tenants/menus.py:27
msgid "All songs"
msgstr ""

#: tenants/menus.py:53
msgid "Files"
msgstr "Soubory"

#: tenants/menus.py:60
#: tenants/menus.py:63
msgid "Categories"
msgstr "Kategorie"

Expand Down Expand Up @@ -65,6 +69,14 @@ msgid ""
msgstr ""
"Kam by měla úvodní stránka přesměrovat uživatele, většinou URL kategorie"

#: tenants/models.py:24
msgid "All Songs"
msgstr "Všechny Písničky"

#: tenants/models.py:25
msgid "True, if all songs category should be added to navigation"
msgstr "Pokud je zaškrknuto tak se do navigace přidá odkaz na všechny písničky"

#: tenants/templates/tenant/add.html:4 tenants/templates/tenant/add.html:5
msgid "Tenant Editor"
msgstr "Uprava Zpěvníku"
Expand Down
5 changes: 4 additions & 1 deletion tenants/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@

def categories(request):
"""Returns MenuItems for all Categories"""
return [
items = [
MenuItem(
category["name"],
reverse("category:index", kwargs={"slug": category["slug"]}),
skip_translate=True,
)
for category in Category.objects.filter(tenant=request.tenant).values("name", "slug")
]
if request.tenant.all_songs_category:
items.append(MenuItem(title=_("All songs"), url=reverse("backend:all"), separator=True))
return items


def distinct_requests(request):
Expand Down
18 changes: 18 additions & 0 deletions tenants/migrations/0002_tenant_all_songs_category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.5 on 2023-12-01 13:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('tenants', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='tenant',
name='all_songs_category',
field=models.BooleanField(default=True, help_text='True, if all songs category should be added to navigation', verbose_name='All Songs'),
),
]
7 changes: 6 additions & 1 deletion tenants/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tenant models"""
from django.contrib.auth import get_user_model
from django.db.models import Model, CharField, ManyToManyField
from django.db.models import Model, CharField, ManyToManyField, BooleanField
from django.utils.translation import gettext_lazy as _

# Create your models here.
Expand All @@ -19,6 +19,11 @@ class Tenant(Model):
help_text=_("Where should new tenant redirect from index page, usually a category slug"),
max_length=32,
)
all_songs_category = BooleanField(
default=True,
verbose_name=_("All Songs"),
help_text=_("True, if all songs category should be added to navigation"),
)
admins = ManyToManyField(get_user_model())

def __str__(self):
Expand Down

0 comments on commit ed8db76

Please sign in to comment.