Fix the bottom tab bar never actually highlighting the active screen
active_tab/screen_title were set as class attributes on every screen view, but only ever threaded into the template context by _PlaceholderScreen's own get_context_data -- which no real M1-M7 screen has inherited from since each one got its own concrete implementation. Every screen's own get_context_data override skipped them, so `active_tab` was always undefined in the template and the tab bar never lit up. Defaulted both from the class attributes in PersonScopeMixin (every screen's shared base) via kwargs.setdefault, so a screen with its own dynamic screen_title (EventDetailView's event.title) still wins. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECGMEwrc2k4D8VQuwjstj9
This commit is contained in:
@@ -73,6 +73,16 @@ class PersonScopeMixin(ClubScopedPublicMixin):
|
||||
if self.managed_people:
|
||||
unread_notification_count = Notification.objects.filter(club=self.request.club, member__in=self.managed_people, read_at__isnull=True).count()
|
||||
|
||||
# Every screen sets these as class attributes (see e.g. HomeView.active_tab),
|
||||
# but only a subclass that explicitly forwards them into its own
|
||||
# get_context_data actually gets them into the template -- easy to forget
|
||||
# (most screens' own get_context_data never touch either one), so default
|
||||
# them here instead. setdefault, not an outright override: a screen with a
|
||||
# dynamic title (EventDetailView's event.title) already passes its own
|
||||
# screen_title through kwargs, and that must win.
|
||||
kwargs.setdefault("active_tab", getattr(self, "active_tab", ""))
|
||||
kwargs.setdefault("screen_title", getattr(self, "screen_title", ""))
|
||||
|
||||
return super().get_context_data(
|
||||
me=self.me,
|
||||
managed_people=self.managed_people,
|
||||
|
||||
Reference in New Issue
Block a user