diff --git a/faerun_calendar/static/faerun_calendar/css/main.css b/faerun_calendar/static/faerun_calendar/css/main.css index e37c974..ad836ba 100644 --- a/faerun_calendar/static/faerun_calendar/css/main.css +++ b/faerun_calendar/static/faerun_calendar/css/main.css @@ -5,40 +5,21 @@ div.calendarpage { border-radius: 20px; } -a.previous_year, -a.next_year { - margin-top: 0px; - margin-bottom: 20px; - max-width: 300px; +div.current-year { + display: flex; + justify-content: space-between; } -a.previous_year:hover, -a.next_year:hover { - background: #00a0e0; - margin-top: 1px; - margin-bottom: 19px; +div.calendarpage hr { + border: 0; + border-top: 1px solid #000000; + opacity: 1; + margin: 30px 0px 10px; } -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; - border-bottom: 1px solid #000000; - margin-bottom: 20px; +hr { + border: 10px solid green; + border-radius: 5px; } table.month, table.month th, table.month td { diff --git a/faerun_calendar/templates/faerun_calendar/index.html b/faerun_calendar/templates/faerun_calendar/index.html index a81ce0d..2fade66 100644 --- a/faerun_calendar/templates/faerun_calendar/index.html +++ b/faerun_calendar/templates/faerun_calendar/index.html @@ -15,15 +15,24 @@ {% 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 %} +
+ {% if year_data.previous_year %} + + {% else %} + {% endif %} +

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

+ {% if year_data.next_year %} + + {% else %} + + {% endif %} +
+ +
+
{% for month in months %} {% include 'faerun_calendar/month.html' with month=month %} diff --git a/faerun_calendar/templates/faerun_calendar/month.html b/faerun_calendar/templates/faerun_calendar/month.html index 9729a58..363e34c 100644 --- a/faerun_calendar/templates/faerun_calendar/month.html +++ b/faerun_calendar/templates/faerun_calendar/month.html @@ -25,21 +25,9 @@ {% endif %} {% if day.number == calendar_data.current_day and month.id == calendar_data.current_month.id and year_data.id == calendar_data.current_year.id %} - {% if root == 'calendar' %} - {{day.number}} - {% elif root == 'year' %} - {{day.number}} - {% elif root == 'month' %} - {{day.number}} - {% endif %} + {{day.number}} {% else %} - {% if root == 'calendar' %} - {{day.number}} - {% elif root == 'year' %} - {{day.number}} - {% elif root == 'month' %} - {{day.number}} - {% endif %} + {{day.number}} {% endif %} diff --git a/faerun_calendar/views.py b/faerun_calendar/views.py index 3e243f7..cc311a5 100644 --- a/faerun_calendar/views.py +++ b/faerun_calendar/views.py @@ -1,5 +1,5 @@ from django.shortcuts import render -from django.http import HttpResponseNotFound +from django.http import HttpResponseRedirect from .models import YearData from .models import MonthData @@ -71,7 +71,7 @@ def day_page(request, year: int, month: int, day: int): if not params: params = { 'type': 'day', - 'root': 'calendar', + 'root': '', 'year_data': year_data, 'month_data': month_data, 'day': day, @@ -81,10 +81,7 @@ def day_page(request, year: int, month: int, day: int): return render(request, 'faerun_calendar/index.html', params) -def year_page(request, year: int, root: str = None): - if not root: - root = 'year' - +def year_page(request, year: int): params = None try: @@ -125,7 +122,7 @@ def year_page(request, year: int, root: str = None): params = { 'type': 'year', - 'root': root, + 'root': '../', 'calendar_data': calendar_data, 'year_data': year_data, 'months': months, @@ -142,5 +139,4 @@ def index(request): except AttributeError: current_year = 0 - return year_page(request, current_year, root='calendar') - + return HttpResponseRedirect(f'{current_year}') diff --git a/main/static/main/css/main.css b/main/static/main/css/main.css index 3516aec..3e79346 100644 --- a/main/static/main/css/main.css +++ b/main/static/main/css/main.css @@ -71,3 +71,78 @@ body > div > * { background: #fefefe; } +.arrow { + display: block; + position: relative; + color: #00bfff; + font-family: Arial sans-serif; + font-size: 2em; + text-decoration: none; + margin: 3px 0px; +} + +.arrow:before, .arrow:after { + content:""; + background: #00bfff; + -webkit-border-radius: 0.2em; + border-radius: 0.2em; + display: block; + height: 0.5em; + position: absolute; + right: 0; + width: 1em; +} + +.arrow.left:before, .arrow.left:after { + left: 0; +} + +.arrow.left:before, .arrow.right:after { + top: 1em; +} + +.arrow.left:after, .arrow.left:before,.arrow.right:before { + -webkit-transform: rotate(45deg); + transform: rotate(45deg); +} + +.arrow.right:before, .arrow.left:after { + top: 0.66em; +} + +.arrow.left:after, .arrow.right:after { + bottom: 0.66em; + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); +} + +.arrow:hover, #arrow:focus { + color: #00a0e0; + margin-top: 4px; + margin-bottom: 2px; +} +.arrow:hover:before, .arrow:hover:after, .arrow:focus:before, .arrow:focus:after { + background: #00a0e0; +} + +.arrow:active { + color: #0080c0; + margin-top: 6px; + margin-bottom: 0px; +} +.arrow:active:before, .arrow:active:after { + background: #0080c0; +} + +.arrow[disabled] { + color: #dcdcdc; +} + +.arrow[disabled]:before, .arrow[disabled]:after { + background: #dcdcdc; +} + + + + +