feat: enhance UI styling, add date picker, and clean up inline CSS
This commit is contained in:
@@ -5,7 +5,7 @@ endblock %} {% block content %}
|
||||
{% if prev_day %}
|
||||
<a href="/day/{{ prev_day }}" class="date-nav-btn">← 前一天</a>
|
||||
{% endif %}
|
||||
<h1 class="date-title">{{ current_date }}</h1>
|
||||
<div class="date-title" id="date-picker-trigger">{{ current_date }}</div>
|
||||
{% if next_day <= today %}
|
||||
<a href="/day/{{ next_day }}" class="date-nav-btn">后一天 →</a>
|
||||
{% endif %}
|
||||
@@ -34,3 +34,24 @@ endblock %} {% block content %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="/static/js/date-picker.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
var trigger = document.getElementById('date-picker-trigger');
|
||||
if (!trigger) return;
|
||||
|
||||
var markedDates = {{ available_dates | tojson }};
|
||||
|
||||
new KamiDatePicker(trigger, {
|
||||
value: {{ current_date | tojson }},
|
||||
maxDate: {{ today | tojson }},
|
||||
markedDates: markedDates,
|
||||
onChange: function(dateStr) {
|
||||
if (dateStr) window.location.href = '/day/' + dateStr;
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user