Skip to content

Commit

Permalink
Make it possible to mark a bar as temporarily closed
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort committed Sep 2, 2024
1 parent 533124c commit cf2fc59
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
18 changes: 18 additions & 0 deletions main/migrations/0011_bar_temporarily_closed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.6 on 2024-09-02 10:59

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('main', '0010_bar_facebook_bar_whatsapp'),
]

operations = [
migrations.AddField(
model_name='bar',
name='temporarily_closed',
field=models.BooleanField(default=False),
),
]
3 changes: 3 additions & 0 deletions main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class OpenModel(models.IntegerChoices):
end_time = models.TimeField(null=True, blank=True, help_text="Ungefähres Ende")
open = models.IntegerField(choices=OpenModel, help_text="Sowas wie jede Woche, 1./3./5. Mittwoch",
default=OpenModel.WEEKLY)
temporarily_closed = models.BooleanField(default=False)
image = models.ImageField(upload_to="bars/", blank=True, null=True)
city = models.CharField(max_length=50)
zip_code = models.CharField(max_length=6)
Expand Down Expand Up @@ -100,6 +101,8 @@ def tag_list(self):
return []

def open_text(self):
if self.temporarily_closed:
return "Temporär geschlossen"
text = "Jeden "
if self.open == self.OpenModel.OPEN_13:
text += f"{self.OpenModel.OPEN_13.label} "
Expand Down
9 changes: 7 additions & 2 deletions main/templates/main/bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ <h1>{{ bar.name }}</h1>
{% endif %}
<div class="container px-0 col-11 col-lg-8">
<div class="d-flex align-items-baseline mb-2">
<i class="bi bi-arrow-repeat me-2"></i> {{ bar.day_text }}
<i class="bi bi-arrow-repeat me-2"></i>
{% if bar.temporarily_closed %}
<span class="text-decoration-line-through pe-1">{{ bar.day_text }}</span> Temporär geschlossen
{% else %}
{{ bar.day_text }}
{% endif %}
</div>
<div class="d-flex align-items-baseline mb-2">
<div class="d-flex align-items-baseline mb-2 {% if bar.temporarily_closed %}text-decoration-line-through{% endif %}">
<i class="bi bi-clock me-2"></i> ab {{ bar.start_time }}
</div>
<div class="d-flex align-items-baseline mb-2">
Expand Down
4 changes: 2 additions & 2 deletions main/templates/main/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ <h5 class="card-title"><a class="text-decoration-none" style="color: unset"
href="{{ bar.url_path }}"
onclick="window.location.href = '{{ bar.url_path }}'">{{ bar.name }}</a>
</h5>
<h6 class="card-subtitle mb-2 text-body-secondary d-flex align-items-baseline">
<h6 class="card-subtitle mb-2 text-body-secondary d-flex align-items-baseline {% if bar.temporarily_closed %}text-decoration-line-through{% endif %}">
<i class="bi bi-arrow-repeat me-2"></i> {{ bar.day_text }}
</h6>
<h6 class="card-subtitle text-body-secondary d-flex align-items-baseline">
<h6 class="card-subtitle text-body-secondary d-flex align-items-baseline {% if bar.temporarily_closed %}text-decoration-line-through{% endif %}">
<i class="bi bi-clock me-2"></i> ab {{ bar.start_time }}
</h6>
</div>
Expand Down

0 comments on commit cf2fc59

Please sign in to comment.