\g<0>', value)) if value else ''
+
+
+@register.simple_tag(takes_context=True)
+def readmore(context, value: str):
+ current_view = resolve(context.request.path).url_name
+
+ if 'reverse' not in current_view:
+ reverse_view_url = reverse_lazy(
+ current_view + '-reverse', args=(value.id,))
+
+ res = value.content.split('')
+ cntnt = res[0]
+ if len(res) > 1:
+ cntnt += f'
...
Czytaj dalej'
+
+ return mark_safe(tableoverflow(cntnt))
+
+
+@register.simple_tag()
+def content(value: str):
+ return mark_safe(tableoverflow(value.content))
+
+
+@register.simple_tag()
+def buttons(value: str):
+ lines = value.split('\n')
+
+ def parse(line: str) -> str:
+ try:
+ if '->' in line:
+ text, url = line.split('->')
+ return f'
{text}'
+ else:
+ text, url = line.split('|')
+ return f'
{text}'
+ except:
+ return ''
+
+ return mark_safe(''.join([parse(line) for line in lines]))
+
+
+@register.filter()
+def firstbutton(value: str):
+ lines = value.split('\n')
+
+ def parse(line: str) -> str:
+ try:
+ text, url = line.split('|' if '|' in line else '->')
+ return url
+ except:
+ return ''
+
+ return mark_safe(parse(lines[0]))
diff --git a/core/urls.py b/core/urls.py
index ec03a91..b518eb2 100644
--- a/core/urls.py
+++ b/core/urls.py
@@ -1,23 +1,28 @@
from django.urls import path
-from .views import *
+from .views import rtpath, tpath
+
+from db.main.models import Post
+from db.tournaments.models import Tournament
+from db.youth.models import Youth
urlpatterns = [
- path('', HomeView.as_view(), name='home'),
- path('zarzad', AdministrationView.as_view(), name='administration'),
- path('zarzad/ogloszenia', AdministrationAnnouncementsView.as_view(),
- name='administration_announcements'),
- path('zarzad/protokolyiuchwaly', AdministrationProtocolsView.as_view(),
- name='administration_protocols'),
- path('zarzad/regulaminy', AdministrationRegulationsView.as_view(),
- name='administration_regulations'),
- path('zarzad/rodo', AdministrationRODOView.as_view(),
- name='administration_rodos'),
- path('ligi', LeagueView.as_view(), name='league'),
- path('kalendarz', CalendarView.as_view(), name='calendar'),
- path('grandprixbialegostoku', GrandPrixView.as_view(), name='gpx'),
- path('inneturnieje', TournamentView.as_view(), name='tournaments'),
- path('skladki', MembershipView.as_view(), name='membership'),
- path('mlodziez', YouthView.as_view(), name='youth'),
- path('atu', AtuView.as_view(), name='atu'),
- path('mbkb', MBKBView.as_view(), name='mbkb'),
+ tpath('', 'home', {'home': 'active'}),
+ rtpath('aktualnosci/
', 'home', Post, {'home': 'active'}),
+
+ tpath('zarzad', 'administration'),
+ tpath('zarzad/ogloszenia', 'administration/announcements'),
+ tpath('zarzad/protokolyiuchwaly', 'administration/protocols'),
+ tpath('zarzad/regulaminy', 'administration/regulations'),
+ tpath('zarzad/rodo', 'administration/rodos'),
+
+ tpath('ligi', 'league'),
+ tpath('kalendarz', 'calendar'),
+ tpath('grandprixbialegostoku', 'grandprix'),
+ tpath('inneturnieje', 'tournaments'),
+ rtpath('inneturnieje/', 'tournaments', Tournament),
+ tpath('skladki', 'membership'),
+ tpath('mlodziez', 'youth'),
+ rtpath('mlodziez/', 'youth', Youth),
+ tpath('atu', 'atu'),
+ tpath('mbkb', 'mbkb'),
]
diff --git a/core/views.py b/core/views.py
index abd1c54..56e36b7 100644
--- a/core/views.py
+++ b/core/views.py
@@ -1,65 +1,26 @@
from django.shortcuts import render
-from django.views.generic import TemplateView
-import importlib
-import pkgutil
+from django.urls import path
+
# Create your views here.
+def template(filename, ec={}):
+ def closure(request):
+ return render(request, filename+'.html', ec)
-class HomeView(TemplateView):
- template_name = 'home.html'
- extra_context = {
- 'home': 'active'
- }
+ return closure
-class AdministrationView(TemplateView):
- template_name = 'administration.html'
+def reverse_template(filename, model, ec={}):
+ def closure(request, id):
+ return render(request, filename+'-reverse.html', {**ec, 'focus': model.objects.get(id=id)})
+
+ return closure
-class AdministrationAnnouncementsView(TemplateView):
- template_name = 'administration/announcements.html'
+def tpath(p: str, filename: str, ec={}):
+ return path(p, template(filename, ec), name=filename.replace('/', '_'))
-class AdministrationProtocolsView(TemplateView):
- template_name = 'administration/protocols.html'
-
-
-class AdministrationRegulationsView(TemplateView):
- template_name = 'administration/regulations.html'
-
-
-class AdministrationRODOView(TemplateView):
- template_name = 'administration/rodos.html'
-
-
-class LeagueView(TemplateView):
- template_name = 'league.html'
-
-
-class CalendarView(TemplateView):
- template_name = 'calendar.html'
-
-
-class GrandPrixView(TemplateView):
- template_name = 'grandprix.html'
-
-
-class TournamentView(TemplateView):
- template_name = "tournaments.html"
-
-
-class MembershipView(TemplateView):
- template_name = 'membership.html'
-
-
-class YouthView(TemplateView):
- template_name = "youth.html"
-
-
-class AtuView(TemplateView):
- template_name = 'atu.html'
-
-
-class MBKBView(TemplateView):
- template_name = "mbkb.html"
+def rtpath(p: str, filename: str, model, ec={}):
+ return path(p, reverse_template(filename, model, ec), name=filename.replace('/', '_')+'-reverse')
diff --git a/db/main/admin.py b/db/main/admin.py
index 62bb1ff..73c29e0 100644
--- a/db/main/admin.py
+++ b/db/main/admin.py
@@ -7,7 +7,7 @@ from .models import *
@admin.register(Post)
class PostModelAdmin(OrderableAdmin, admin.ModelAdmin):
- list_display = ['__str__', 'ordering']
+ list_display = ['__str__', 'link', 'ordering']
list_editable = ['ordering']
ordering_field_hide_input = True
exclude = ['ordering']
diff --git a/db/main/models.py b/db/main/models.py
index 49745a0..da78615 100644
--- a/db/main/models.py
+++ b/db/main/models.py
@@ -1,4 +1,6 @@
from django.db import models
+from django.urls.base import reverse_lazy
+from django.utils.safestring import mark_safe
from tinymce.models import HTMLField
from admin_ordering.models import OrderableModel
from core.utils import SingletonModel
@@ -16,6 +18,11 @@ class Post(OrderableModel):
def __str__(self):
return self.title or '(brak tytułu)'
+ @property
+ def link(self):
+ href = reverse_lazy('home-reverse', args=[self.id])
+ return mark_safe(f'{href}')
+
class Meta(OrderableModel.Meta):
verbose_name = 'Aktualność PodlZBS'
verbose_name_plural = 'Aktualności PodlZBS'
diff --git a/db/tournaments/admin.py b/db/tournaments/admin.py
index fdab371..9e209f2 100644
--- a/db/tournaments/admin.py
+++ b/db/tournaments/admin.py
@@ -7,7 +7,7 @@ from .models import *
@admin.register(Tournament)
class TournamentModelAdmin(OrderableAdmin, admin.ModelAdmin):
- list_display = ['__str__', 'ordering']
+ list_display = ['__str__', 'link', 'ordering']
list_editable = ['ordering']
ordering_field_hide_input = True
exclude = ['ordering']
diff --git a/db/tournaments/migrations/0006_remove_tournament_link_remove_tournament_link_title_and_more.py b/db/tournaments/migrations/0006_remove_tournament_link_remove_tournament_link_title_and_more.py
new file mode 100644
index 0000000..6ad8740
--- /dev/null
+++ b/db/tournaments/migrations/0006_remove_tournament_link_remove_tournament_link_title_and_more.py
@@ -0,0 +1,26 @@
+# Generated by Django 4.0.5 on 2022-08-17 21:39
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('tournaments', '0005_tournament_link_title_tournament_published_and_more'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='tournament',
+ name='link',
+ ),
+ migrations.RemoveField(
+ model_name='tournament',
+ name='link_title',
+ ),
+ migrations.AddField(
+ model_name='tournament',
+ name='buttons',
+ field=models.TextField(blank=True, default='', verbose_name='Przyciski'),
+ ),
+ ]
diff --git a/db/tournaments/models.py b/db/tournaments/models.py
index 784784e..24951a8 100644
--- a/db/tournaments/models.py
+++ b/db/tournaments/models.py
@@ -1,10 +1,31 @@
from django.db import models
+from django.urls.base import reverse_lazy
+from django.utils.safestring import mark_safe
from admin_ordering.models import OrderableModel
from tinymce.models import HTMLField
from filebrowser.fields import FileBrowseField
# Create your models here.
+buttons_help_text = """Tutaj można wpisać dowolną ilość przycisków w następującym formacie:
+
+ tekst1 -> link
+ teskt2 | link
+ ...
+
+ Symbol -> oznacza, że link będzie otwarty w nowej karcie
+ Symbol | oznacza, że link będzie otwarty w tej samej karcie
+ Na przykład:
+
+ pzbs -> https://pzbs.pl
+ fotogaleria | https://galeria.podlaskizbs.pl
+ cezar -> https://www.msc.com.pl/cezar
+
+ PZBS i Cezar zostaną otwarte w nowej karcie
+ UWAGA !!
+ Klikając na zdjęcie zawsze zostaniemy przekierowani na pierwszy link w nowej karcie
+ """.replace('\n', '
')
+
class Tournament(OrderableModel):
published = models.BooleanField('Wpis opublikowany', default=True)
@@ -13,13 +34,17 @@ class Tournament(OrderableModel):
photo = FileBrowseField(
'Zdjęcie', directory='inneturnieje/', max_length=200, blank=True)
content = HTMLField('Tekst', default='', blank=True)
- link = models.TextField('Link do wyników')
- link_title = models.CharField(
- 'Tytuł linku', default='', blank=True, max_length=250)
+ buttons = models.TextField(
+ 'Przyciski', default='', blank=True, help_text=buttons_help_text)
def __str__(self):
return self.title or '(brak tytułu)'
+ @property
+ def link(self):
+ href = reverse_lazy('youth-reverse', args=[self.id])
+ return mark_safe(f'{href}')
+
class Meta(OrderableModel.Meta):
verbose_name = 'Inny turniej'
verbose_name_plural = 'Inne turnieje'
diff --git a/db/youth/admin.py b/db/youth/admin.py
index 41db4b3..84c261d 100644
--- a/db/youth/admin.py
+++ b/db/youth/admin.py
@@ -7,7 +7,7 @@ from .models import *
@admin.register(Youth)
class YouthModelAdmin(OrderableAdmin, admin.ModelAdmin):
- list_display = ['__str__', 'ordering']
+ list_display = ['__str__', 'link', 'ordering']
list_editable = ['ordering']
ordering_field_hide_input = True
exclude = ['ordering']
diff --git a/db/youth/migrations/0003_youth_buttons.py b/db/youth/migrations/0003_youth_buttons.py
new file mode 100644
index 0000000..1ce4501
--- /dev/null
+++ b/db/youth/migrations/0003_youth_buttons.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.0.5 on 2022-08-17 21:39
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('youth', '0002_alter_youth_options_youth_ordering_youth_published_and_more'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='youth',
+ name='buttons',
+ field=models.TextField(blank=True, default='', verbose_name='Przyciski'),
+ ),
+ ]
diff --git a/db/youth/models.py b/db/youth/models.py
index 3763300..a16c6c1 100644
--- a/db/youth/models.py
+++ b/db/youth/models.py
@@ -1,19 +1,46 @@
from django.db import models
+from django.urls.base import reverse_lazy
+from django.utils.safestring import mark_safe
from tinymce.models import HTMLField
from admin_ordering.models import OrderableModel
+
# Create your models here.
+buttons_help_text = """Tutaj można wpisać dowolną ilość przycisków w następującym formacie:
+
+ tekst1 -> link
+ teskt2 | link
+ ...
+
+ Symbol -> oznacza, że link będzie otwarty w nowej karcie
+ Symbol | oznacza, że link będzie otwarty w tej samej karcie
+ Na przykład:
+
+ pzbs -> https://pzbs.pl
+ fotogaleria | https://galeria.podlaskizbs.pl
+ cezar -> https://www.msc.com.pl/cezar
+
+ PZBS i Cezar zostaną otwarte w nowej karcie
+ """.replace('\n', '
')
+
class Youth(OrderableModel):
published = models.BooleanField('Wpis opublikowany', default=True)
show_title = models.BooleanField('Pokaż tytuł', default=True)
title = models.CharField('Tytuł', default='', blank=True, max_length=250)
content = HTMLField('Tekst', default='', blank=True)
+ buttons = models.TextField(
+ 'Przyciski', default='', blank=True, help_text=buttons_help_text)
def __str__(self):
return self.title or '(brak tytułu)'
+ @property
+ def link(self):
+ href = reverse_lazy('youth-reverse', args=[self.id])
+ return mark_safe(f'{href}')
+
class Meta(OrderableModel.Meta):
verbose_name = 'Młodzież'
verbose_name_plural = 'Młodzież'
diff --git a/pdlzbs/settings.py b/pdlzbs/settings.py
index dc7e9e0..b36da83 100644
--- a/pdlzbs/settings.py
+++ b/pdlzbs/settings.py
@@ -153,7 +153,7 @@ TINYMCE_DEFAULT_CONFIG = {
"height": "320px",
"width": "960px",
"menubar": "file edit view insert format tools table help",
- "plugins": "advlist autolink lists link image charmap print preview anchor searchreplace visualblocks code "
+ "plugins": "advlist autolink lists link image charmap print preview anchor searchreplace visualblocks code pagebreak "
"fullscreen insertdatetime media table paste code help wordcount spellchecker",
"toolbar": "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft "
"aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor "
diff --git a/static/atu.jpg b/static/atu.jpg
deleted file mode 100644
index b24a402..0000000
Binary files a/static/atu.jpg and /dev/null differ
diff --git a/static/cezar.gif b/static/cezar.gif
deleted file mode 100644
index af45dad..0000000
Binary files a/static/cezar.gif and /dev/null differ
diff --git a/static/css/dist/styles.css b/static/css/dist/styles.css
index 2984374..b84440e 100644
--- a/static/css/dist/styles.css
+++ b/static/css/dist/styles.css
@@ -1300,18 +1300,22 @@ select {
margin-bottom: 1rem;
}
-.mt-8 {
- margin-top: 2rem;
-}
-
.mb-auto {
margin-bottom: auto;
}
+.mt-4 {
+ margin-top: 1rem;
+}
+
.block {
display: block;
}
+.inline-block {
+ display: inline-block;
+}
+
.inline {
display: inline;
}
@@ -1336,14 +1340,6 @@ select {
display: none;
}
-.h-\[40px\] {
- height: 40px;
-}
-
-.h-full {
- height: 100%;
-}
-
.h-screen {
height: 100vh;
}
@@ -1364,10 +1360,6 @@ select {
width: 100%;
}
-.w-\[48px\] {
- width: 48px;
-}
-
.w-36 {
width: 9rem;
}
@@ -1388,10 +1380,6 @@ select {
max-width: 768px;
}
-.shrink-0 {
- flex-shrink: 0;
-}
-
.basis-1\/2 {
flex-basis: 50%;
}
@@ -1520,6 +1508,10 @@ select {
padding: 0.5rem;
}
+.p-8 {
+ padding: 2rem;
+}
+
.px-4 {
padding-left: 1rem;
padding-right: 1rem;
@@ -1540,9 +1532,9 @@ select {
padding-bottom: 0.5rem;
}
-.px-16 {
- padding-left: 4rem;
- padding-right: 4rem;
+.px-12 {
+ padding-left: 3rem;
+ padding-right: 3rem;
}
.pb-1 {
@@ -1553,10 +1545,6 @@ select {
padding-bottom: 1rem;
}
-.pb-6 {
- padding-bottom: 1.5rem;
-}
-
.text-left {
text-align: left;
}
@@ -1593,10 +1581,6 @@ select {
font-size: 15px;
}
-.text-\[13px\] {
- font-size: 13px;
-}
-
.text-\[2\.25rem\] {
font-size: 2.25rem;
}
@@ -1614,8 +1598,8 @@ select {
font-weight: 300;
}
-.font-bold {
- font-weight: 700;
+.font-normal {
+ font-weight: 400;
}
.font-semibold {
@@ -1642,11 +1626,6 @@ select {
letter-spacing: 0em;
}
-.text-white {
- --tw-text-opacity: 1;
- color: rgb(255 255 255 / var(--tw-text-opacity));
-}
-
.antialiased {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@@ -1821,14 +1800,15 @@ h4 {
margin-bottom: 0.3em;
}
-.prose-a\:text-center :is(:where(a):not(:where([class~="not-prose"] *))) {
- text-align: center;
-}
-
.prose-img\:m-1 :is(:where(img):not(:where([class~="not-prose"] *))) {
margin: 0.25rem;
}
+.prose-img\:my-1 :is(:where(img):not(:where([class~="not-prose"] *))) {
+ margin-top: 0.25rem;
+ margin-bottom: 0.25rem;
+}
+
@media (min-width: 1024px) {
.lg\:w-screen {
width: 100vw;
diff --git a/static/favicon.ico b/static/favicon.ico
new file mode 100644
index 0000000..c2b3a64
Binary files /dev/null and b/static/favicon.ico differ
diff --git a/static/icon-192x192.png b/static/icon-192x192.png
new file mode 100644
index 0000000..fc4cf89
Binary files /dev/null and b/static/icon-192x192.png differ
diff --git a/static/icon-512x512.png b/static/icon-512x512.png
new file mode 100644
index 0000000..7d01f18
Binary files /dev/null and b/static/icon-512x512.png differ
diff --git a/static/kareta.jpg b/static/kareta.jpg
deleted file mode 100644
index 3839049..0000000
Binary files a/static/kareta.jpg and /dev/null differ
diff --git a/static/labs.jpg b/static/labs.jpg
deleted file mode 100644
index a20896e..0000000
Binary files a/static/labs.jpg and /dev/null differ
diff --git a/static/labs.webp b/static/labs.webp
deleted file mode 100644
index b243cf6..0000000
Binary files a/static/labs.webp and /dev/null differ
diff --git a/static/logo.jpg b/static/logo.jpg
new file mode 100644
index 0000000..d3ee954
Binary files /dev/null and b/static/logo.jpg differ
diff --git a/static/logo.webp b/static/logo.webp
deleted file mode 100644
index 6e532c3..0000000
Binary files a/static/logo.webp and /dev/null differ
diff --git a/static/mbkb.webp b/static/mbkb.webp
deleted file mode 100644
index 4664914..0000000
Binary files a/static/mbkb.webp and /dev/null differ
diff --git a/static/pzbs.webp b/static/pzbs.webp
deleted file mode 100644
index 5cd100b..0000000
Binary files a/static/pzbs.webp and /dev/null differ
diff --git a/theme/static/css/dist/styles.css b/theme/static/css/dist/styles.css
index c20db76..b84440e 100644
--- a/theme/static/css/dist/styles.css
+++ b/theme/static/css/dist/styles.css
@@ -1304,10 +1304,18 @@ select {
margin-bottom: auto;
}
+.mt-4 {
+ margin-top: 1rem;
+}
+
.block {
display: block;
}
+.inline-block {
+ display: inline-block;
+}
+
.inline {
display: inline;
}
@@ -1500,6 +1508,10 @@ select {
padding: 0.5rem;
}
+.p-8 {
+ padding: 2rem;
+}
+
.px-4 {
padding-left: 1rem;
padding-right: 1rem;
@@ -1520,9 +1532,9 @@ select {
padding-bottom: 0.5rem;
}
-.px-16 {
- padding-left: 4rem;
- padding-right: 4rem;
+.px-12 {
+ padding-left: 3rem;
+ padding-right: 3rem;
}
.pb-1 {
@@ -1533,10 +1545,6 @@ select {
padding-bottom: 1rem;
}
-.pb-6 {
- padding-bottom: 1.5rem;
-}
-
.text-left {
text-align: left;
}
@@ -1590,14 +1598,14 @@ select {
font-weight: 300;
}
-.font-semibold {
- font-weight: 600;
-}
-
.font-normal {
font-weight: 400;
}
+.font-semibold {
+ font-weight: 600;
+}
+
.lowercase {
text-transform: lowercase;
}
@@ -1792,14 +1800,15 @@ h4 {
margin-bottom: 0.3em;
}
-.prose-a\:text-center :is(:where(a):not(:where([class~="not-prose"] *))) {
- text-align: center;
-}
-
.prose-img\:m-1 :is(:where(img):not(:where([class~="not-prose"] *))) {
margin: 0.25rem;
}
+.prose-img\:my-1 :is(:where(img):not(:where([class~="not-prose"] *))) {
+ margin-top: 0.25rem;
+ margin-bottom: 0.25rem;
+}
+
@media (min-width: 1024px) {
.lg\:w-screen {
width: 100vw;
diff --git a/theme/static_src/tailwind.config.js b/theme/static_src/tailwind.config.js
index 84505e8..bff3ebc 100644
--- a/theme/static_src/tailwind.config.js
+++ b/theme/static_src/tailwind.config.js
@@ -1,29 +1,9 @@
-/**
- * This is a minimal config.
- *
- * If you need the full config, get it from here:
- * https://unpkg.com/browse/tailwindcss@latest/stubs/defaultConfig.stub.js
- */
-
module.exports = {
content: [
- /**
- * HTML. Paths to Django template files that will contain Tailwind CSS classes.
- */
-
- /* Templates within theme app (/templates), e.g. base.html. */
"../templates/**/*.html",
- /*
- * Main templates directory of the project (BASE_DIR/templates).
- * Adjust the following line to match your project structure.
- */
"../../../templates/**/*.html",
- /*
- * Templates in other django apps (BASE_DIR//templates).
- * Adjust the following line to match your project structure.
- */
"../../../**/templates/**/*.html",
/**
@@ -39,7 +19,7 @@ module.exports = {
* Python: If you use Tailwind CSS classes in Python, uncomment the following line
* and make sure the pattern below matches your project structure.
*/
- // '../../**/*.py'
+ "../../../core/templatetags/*.py",
],
theme: {
extend: {},