diff --git a/faerun_calendar/models.py b/faerun_calendar/models.py index 1136c0f..e104bbc 100644 --- a/faerun_calendar/models.py +++ b/faerun_calendar/models.py @@ -10,7 +10,7 @@ class YearData(models.Model): ]) @property - def is_leap(self): + def is_leap(self) -> bool: if self.number == 0: return False elif self.number % 400 == 0: @@ -21,7 +21,15 @@ class YearData(models.Model): return True return False - def __str__(self): + @property + def next_year(self): + return YearData.objects.filter(number__gt=self.number).order_by('number').first() + + @property + def previous_year(self): + return YearData.objects.filter(number__lt=self.number).order_by('number').last() + + def __str__(self) -> str: return f'({self.number}, {self.is_leap})' @@ -35,7 +43,7 @@ class MonthData(models.Model): is_oneday = models.BooleanField('IsOneday') is_leap_month = models.BooleanField('IsLeapMonth') - def __str__(self): + def __str__(self) -> str: return f'({self.number}, {self.name}, {self.folkname}, {self.is_oneday}, {self.is_leap_month})' @@ -47,7 +55,7 @@ class CalendarData(models.Model): current_month = models.ForeignKey(MonthData, on_delete=models.CASCADE) current_year = models.ForeignKey(YearData, on_delete=models.CASCADE) - def __str__(self): + def __str__(self) -> str: return f'({self.current_day}, {self.current_month}, {self.current_year})' @@ -64,6 +72,6 @@ class Event(models.Model): is_suggested = models.BooleanField('IsSuggested') is_only_for_gm = models.BooleanField('IsOnlyForGm') - def __str__(self): + def __str__(self) -> str: return f'({self.day}, {self.time}, {self.title})' diff --git a/faerun_calendar/static/faerun_calendar/css/main.css b/faerun_calendar/static/faerun_calendar/css/main.css index f70cea2..e37c974 100644 --- a/faerun_calendar/static/faerun_calendar/css/main.css +++ b/faerun_calendar/static/faerun_calendar/css/main.css @@ -5,6 +5,35 @@ div.calendarpage { border-radius: 20px; } +a.previous_year, +a.next_year { + margin-top: 0px; + margin-bottom: 20px; + max-width: 300px; +} + +a.previous_year:hover, +a.next_year:hover { + background: #00a0e0; + margin-top: 1px; + margin-bottom: 19px; +} + +a.previous_year:active, +a.next_year:active { + background: #0080c0; + margin-top: 3px; + margin-bottom: 17px; +} + +a.previous_year { + float: left; +} + +a.next_year { + float: right; +} + h2.year { text-align: center; padding-bottom: 10px; diff --git a/faerun_calendar/templates/faerun_calendar/index.html b/faerun_calendar/templates/faerun_calendar/index.html index c6ab5f0..a81ce0d 100644 --- a/faerun_calendar/templates/faerun_calendar/index.html +++ b/faerun_calendar/templates/faerun_calendar/index.html @@ -14,6 +14,14 @@
{% if type == 'year' %}

Календарь

+ + {% if root == 'calendar' %} + {% if year_data.previous_year %} Предыдущий год ({{year_data.previous_year.number}}-й) {% endif %} + {% if year_data.next_year %} Следующий год ({{year_data.next_year.number}}-й) {% endif %} + {% elif root == 'year' %} + {% if year_data.previous_year %} Предыдущий год ({{year_data.previous_year.number}}-й) {% endif %} + {% if year_data.next_year %} Следующий год ({{year_data.next_year.number}}-й) {% endif %} + {% endif %}

Год {{year_data.number}}-й

@@ -23,6 +31,7 @@
{% elif type == 'day' %}

Календарь — События

+

Год {{year_data.number}}-й, {{month_data.name}}{% if not month_data.is_oneday %}, день {{day}}-й{% endif %}

diff --git a/main/static/main/css/main.css b/main/static/main/css/main.css index 188d0b9..3516aec 100644 --- a/main/static/main/css/main.css +++ b/main/static/main/css/main.css @@ -19,7 +19,7 @@ div.menu { flex-flow: row wrap; } -aside.menu a { +a.button { border-radius: 10px; text-decoration: none; color: #000000; @@ -28,7 +28,6 @@ aside.menu a { padding: 10px; margin: 10px; - max-width: 100px; max-width: 200px; display: flex; @@ -47,13 +46,13 @@ aside.menu a { supported by Chrome, Edge, Opera and Firefox */ } -aside.menu a:hover { +a.button:hover { background: #00a0e0; margin-top: 11px; margin-bottom: 9px; } -aside.menu a:active { +a.button:active { background: #0080c0; margin-top: 13px; margin-bottom: 7px; diff --git a/main/templates/main/pagetemplate.html b/main/templates/main/pagetemplate.html index dc2af5e..3b115b6 100644 --- a/main/templates/main/pagetemplate.html +++ b/main/templates/main/pagetemplate.html @@ -21,13 +21,13 @@