[func] anchors on steroids
parent
e0a02a34a3
commit
a94c612af7
|
|
@ -1,6 +1,10 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from admin_ordering.models import OrderableModel
|
from admin_ordering.models import OrderableModel
|
||||||
from filebrowser.fields import FileBrowseField
|
from filebrowser.fields import FileBrowseField
|
||||||
|
from django.urls.base import reverse_lazy
|
||||||
|
|
||||||
|
from db.calendar.models import Calendar
|
||||||
|
from db.membership.models import Membership
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
|
@ -13,6 +17,18 @@ class Button(OrderableModel):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.title or '-'
|
return self.title or '-'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def link(self):
|
||||||
|
h = self.href
|
||||||
|
c = None
|
||||||
|
|
||||||
|
if h == reverse_lazy('calendar'):
|
||||||
|
c = Calendar.get_current()
|
||||||
|
elif h in reverse_lazy('membership'):
|
||||||
|
c = Membership.get_current()
|
||||||
|
|
||||||
|
return h + (('#' + str(c.year)) if c is not None else '')
|
||||||
|
|
||||||
class Meta(OrderableModel.Meta):
|
class Meta(OrderableModel.Meta):
|
||||||
verbose_name = 'Przycisk nawigacji (zielony)'
|
verbose_name = 'Przycisk nawigacji (zielony)'
|
||||||
verbose_name_plural = 'Przyciski nawigacji (zielone)'
|
verbose_name_plural = 'Przyciski nawigacji (zielone)'
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="nbutton home {% if button.href == '/' %}{{ home }}{% elif button.href in request.path %}active{% endif %}"
|
class="nbutton home {% if button.href == '/' %}{{ home }}{% elif button.href in request.path %}active{% endif %}"
|
||||||
href="{{ button.href }}"
|
href="{{ button.link }}"
|
||||||
target="{% if button.blank %}_blank{% else %}_self{% endif %}"
|
target="{% if button.blank %}_blank{% else %}_self{% endif %}"
|
||||||
>{{ button.title }}</a
|
>{{ button.title }}</a
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
<!---->
|
<!---->
|
||||||
|
|
||||||
{% if calendars %}
|
{% if calendars %}
|
||||||
|
|
||||||
<ul class="flex justify-center gap-4">
|
<ul class="flex justify-center gap-4">
|
||||||
{% for calendar in calendars %}
|
{% for calendar in calendars %}
|
||||||
<li>
|
<li>
|
||||||
|
|
@ -18,14 +19,20 @@
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="flex flex-col items-center gap-4">
|
<div class="flex flex-col items-center">
|
||||||
{% for calendar in calendars %}
|
{% for calendar in calendars %}
|
||||||
<article class="w-full py-4 hidden target:block" id="{{ calendar.year }}">
|
<div class="w-full">
|
||||||
{% content calendar %}
|
<span
|
||||||
<div class="flex flex-wrap gap-4 items-center justify-center">
|
class="peer absolute top-0 inset-x-0 float-right"
|
||||||
{% buttons calendar.buttons %}
|
id="{{ calendar.year }}"
|
||||||
</div>
|
></span>
|
||||||
</article>
|
<article class="w-full py-4 hidden peer-target:block">
|
||||||
|
{% content calendar %}
|
||||||
|
<div class="flex flex-wrap gap-4 items-center justify-center">
|
||||||
|
{% buttons calendar.buttons %}
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<span class="py-4 text-xl">Brak kalendarzy</span>
|
<span class="py-4 text-xl">Brak kalendarzy</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,20 @@
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="flex flex-col items-center gap-4">
|
<div class="flex flex-col items-center">
|
||||||
{% for membership in memberships %}
|
{% for membership in memberships %}
|
||||||
<article class="w-full py-4 hidden target:block" id="{{ membership.year }}">
|
<div class="w-full">
|
||||||
{% content membership %}
|
<span
|
||||||
<div class="flex flex-wrap gap-4 items-center justify-center">
|
class="peer absolute top-0 inset-x-0 float-right"
|
||||||
{% buttons membership.buttons %}
|
id="{{ membership.year }}"
|
||||||
</div>
|
></span>
|
||||||
</article>
|
<article class="w-full py-4 hidden peer-target:block">
|
||||||
|
{% content membership %}
|
||||||
|
<div class="flex flex-wrap gap-4 items-center justify-center">
|
||||||
|
{% buttons membership.buttons %}
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<span class="py-4 text-xl">Brak dokumentów</span>
|
<span class="py-4 text-xl">Brak dokumentów</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 4.0.5 on 2022-09-28 20:47
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('calendar', '0004_calendar_buttons'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='calendar',
|
||||||
|
name='current',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='Aktualny kalendarz (pokazywany przy przekierowaniu na stronę)'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -32,10 +32,20 @@ class Calendar(models.Model):
|
||||||
published = models.BooleanField('Kalendarz opublikowany', default=True)
|
published = models.BooleanField('Kalendarz opublikowany', default=True)
|
||||||
year = models.IntegerField('Rok', primary_key=True)
|
year = models.IntegerField('Rok', primary_key=True)
|
||||||
content = HTMLField('Kalendarz', default='', blank=True)
|
content = HTMLField('Kalendarz', default='', blank=True)
|
||||||
|
|
||||||
buttons = models.TextField(
|
buttons = models.TextField(
|
||||||
'Przyciski', default='', blank=True, help_text=buttons_help_text)
|
'Przyciski', default='', blank=True, help_text=buttons_help_text)
|
||||||
|
|
||||||
|
current = models.BooleanField(
|
||||||
|
'Aktualny kalendarz (pokazywany przy przekierowaniu na stronę)', default=False)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_current():
|
||||||
|
return Calendar.objects.filter(current=True).first()
|
||||||
|
|
||||||
|
def update(self, *args, **kwargs):
|
||||||
|
if self.current is True:
|
||||||
|
Calendar.objects.exclude(year=self.year).update(current=False)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'Kalendarz {self.year}'
|
return f'Kalendarz {self.year}'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 4.0.5 on 2022-09-28 20:47
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('membership', '0004_membership_buttons'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='membership',
|
||||||
|
name='current',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='Aktualne składki (pokazywane przy przekierowaniu na stronę)'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -36,6 +36,19 @@ class Membership(models.Model):
|
||||||
buttons = models.TextField(
|
buttons = models.TextField(
|
||||||
'Przyciski', default='', blank=True, help_text=buttons_help_text)
|
'Przyciski', default='', blank=True, help_text=buttons_help_text)
|
||||||
|
|
||||||
|
current = models.BooleanField(
|
||||||
|
'Aktualne składki (pokazywane przy przekierowaniu na stronę)', default=False)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_current():
|
||||||
|
return Membership.objects.filter(current=True).first()
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if self.current is True:
|
||||||
|
Membership.objects.exclude(year=self.year).update(current=False)
|
||||||
|
|
||||||
|
super(Membership, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'Składki członkowskie {self.year}'
|
return f'Składki członkowskie {self.year}'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1262,6 +1262,19 @@ select {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inset-x-0 {
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-0 {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.float-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
.m-4 {
|
.m-4 {
|
||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
}
|
}
|
||||||
|
|
@ -1305,22 +1318,6 @@ select {
|
||||||
margin-bottom: auto;
|
margin-bottom: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt-8 {
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-12 {
|
|
||||||
margin-top: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-16 {
|
|
||||||
margin-top: 4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-20 {
|
|
||||||
margin-top: 5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block {
|
.block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
@ -1483,16 +1480,16 @@ select {
|
||||||
border-color: rgb(148 163 184 / var(--tw-border-opacity));
|
border-color: rgb(148 163 184 / var(--tw-border-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.border-stone-200 {
|
|
||||||
--tw-border-opacity: 1;
|
|
||||||
border-color: rgb(231 229 228 / var(--tw-border-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-stone-300 {
|
.border-stone-300 {
|
||||||
--tw-border-opacity: 1;
|
--tw-border-opacity: 1;
|
||||||
border-color: rgb(214 211 209 / var(--tw-border-opacity));
|
border-color: rgb(214 211 209 / var(--tw-border-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.border-stone-200 {
|
||||||
|
--tw-border-opacity: 1;
|
||||||
|
border-color: rgb(231 229 228 / var(--tw-border-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-white {
|
.bg-white {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
||||||
|
|
@ -1535,16 +1532,16 @@ select {
|
||||||
padding-bottom: 0.75rem;
|
padding-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.py-4 {
|
|
||||||
padding-top: 1rem;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.py-2 {
|
.py-2 {
|
||||||
padding-top: 0.5rem;
|
padding-top: 0.5rem;
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.py-4 {
|
||||||
|
padding-top: 1rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.pb-1 {
|
.pb-1 {
|
||||||
padding-bottom: 0.25rem;
|
padding-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
@ -1807,10 +1804,6 @@ h4 {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.last\:hidden:last-child {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.target\:block:target {
|
.target\:block:target {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
@ -1821,6 +1814,10 @@ h4 {
|
||||||
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.peer:target ~ .peer-target\:block {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.prose-h2\:mb-2 :is(:where(h2):not(:where([class~="not-prose"] *))) {
|
.prose-h2\:mb-2 :is(:where(h2):not(:where([class~="not-prose"] *))) {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1262,6 +1262,19 @@ select {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inset-x-0 {
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-0 {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.float-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
.m-4 {
|
.m-4 {
|
||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
}
|
}
|
||||||
|
|
@ -1305,22 +1318,6 @@ select {
|
||||||
margin-bottom: auto;
|
margin-bottom: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt-8 {
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-12 {
|
|
||||||
margin-top: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-16 {
|
|
||||||
margin-top: 4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-20 {
|
|
||||||
margin-top: 5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block {
|
.block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
@ -1483,16 +1480,16 @@ select {
|
||||||
border-color: rgb(148 163 184 / var(--tw-border-opacity));
|
border-color: rgb(148 163 184 / var(--tw-border-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.border-stone-200 {
|
|
||||||
--tw-border-opacity: 1;
|
|
||||||
border-color: rgb(231 229 228 / var(--tw-border-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-stone-300 {
|
.border-stone-300 {
|
||||||
--tw-border-opacity: 1;
|
--tw-border-opacity: 1;
|
||||||
border-color: rgb(214 211 209 / var(--tw-border-opacity));
|
border-color: rgb(214 211 209 / var(--tw-border-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.border-stone-200 {
|
||||||
|
--tw-border-opacity: 1;
|
||||||
|
border-color: rgb(231 229 228 / var(--tw-border-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-white {
|
.bg-white {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
||||||
|
|
@ -1535,16 +1532,16 @@ select {
|
||||||
padding-bottom: 0.75rem;
|
padding-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.py-4 {
|
|
||||||
padding-top: 1rem;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.py-2 {
|
.py-2 {
|
||||||
padding-top: 0.5rem;
|
padding-top: 0.5rem;
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.py-4 {
|
||||||
|
padding-top: 1rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.pb-1 {
|
.pb-1 {
|
||||||
padding-bottom: 0.25rem;
|
padding-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
@ -1807,10 +1804,6 @@ h4 {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.last\:hidden:last-child {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.target\:block:target {
|
.target\:block:target {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
@ -1821,6 +1814,10 @@ h4 {
|
||||||
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.peer:target ~ .peer-target\:block {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.prose-h2\:mb-2 :is(:where(h2):not(:where([class~="not-prose"] *))) {
|
.prose-h2\:mb-2 :is(:where(h2):not(:where([class~="not-prose"] *))) {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue