summaryrefslogtreecommitdiffstats
path: root/app/templates/index.html
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken@claude>2026-05-25 01:14:43 +0000
committerKen D'Ambrosio <ken@claude>2026-05-25 01:14:43 +0000
commitab9b1465ec45570938dc7a3eaf3e4c44dc9be0d6 (patch)
tree2a4f40bfca6e207487bd4c8b6638609e40ecd1f3 /app/templates/index.html
parent468eb57acb02017d622e99d97dc79ab8d2737cc0 (diff)
Add week navigation and calendar picker to dashboard
Dashboard now accepts ?week= param like meal-plan and shopping-list. Header shows prev/next arrows, an <input type="week"> picker, and a "Today" button when browsing a past/future week. Edit Plan and Shopping List links carry the current week so they open in sync. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app/templates/index.html')
-rw-r--r--app/templates/index.html24
1 files changed, 21 insertions, 3 deletions
diff --git a/app/templates/index.html b/app/templates/index.html
index 55b5ef0..c690525 100644
--- a/app/templates/index.html
+++ b/app/templates/index.html
@@ -7,9 +7,16 @@
<h1 class="h3 mb-0 fw-bold">This Week's Plan</h1>
<p class="text-muted mb-0">{{ week_start.strftime('%B %d') }} – {{ (dates[-1]).strftime('%B %d, %Y') }}</p>
</div>
- <div class="d-flex gap-2">
- <a href="/meal-plan" class="btn btn-primary"><i class="bi bi-pencil-square me-1"></i>Edit Plan</a>
- <a href="/shopping-list" class="btn btn-outline-secondary"><i class="bi bi-cart me-1"></i>Shopping List</a>
+ <div class="d-flex gap-2 align-items-center">
+ <a href="/?week={{ prev_week }}" class="btn btn-outline-secondary btn-sm"><i class="bi bi-chevron-left"></i></a>
+ <input type="week" id="weekPicker" class="form-control form-control-sm" style="width:160px"
+ value="{{ week_start.strftime('%G-W%V') }}">
+ {% if not is_current_week %}
+ <a href="/" class="btn btn-outline-secondary btn-sm">Today</a>
+ {% endif %}
+ <a href="/?week={{ next_week }}" class="btn btn-outline-secondary btn-sm"><i class="bi bi-chevron-right"></i></a>
+ <a href="/meal-plan?week={{ week_start.isoformat() }}" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square me-1"></i>Edit Plan</a>
+ <a href="/shopping-list?week={{ week_start.isoformat() }}" class="btn btn-outline-secondary btn-sm"><i class="bi bi-cart me-1"></i>Shopping List</a>
</div>
</div>
@@ -114,5 +121,16 @@
{% block scripts %}
<script>
const todayStr = '{{ today_str }}';
+ document.getElementById('weekPicker').addEventListener('change', function() {
+ if (!this.value) return;
+ // value is "YYYY-Www" — convert to Mon of that ISO week
+ const [year, week] = this.value.split('-W').map(Number);
+ const jan4 = new Date(year, 0, 4); // Jan 4 is always in week 1
+ const dayOfWeek = jan4.getDay() || 7; // Mon=1..Sun=7
+ const mon = new Date(jan4);
+ mon.setDate(jan4.getDate() - (dayOfWeek - 1) + (week - 1) * 7);
+ const iso = mon.toISOString().split('T')[0];
+ window.location.href = '/?week=' + iso;
+ });
</script>
{% endblock %}