Skip to content

fix: session calendar month navigation not working on course detail page#903

Merged
A1L13N merged 1 commit intoalphaonelabs:mainfrom
abdulateeb:fix/session-calendar-month-navigation
Feb 22, 2026
Merged

fix: session calendar month navigation not working on course detail page#903
A1L13N merged 1 commit intoalphaonelabs:mainfrom
abdulateeb:fix/session-calendar-month-navigation

Conversation

@abdulateeb
Copy link
Contributor

@abdulateeb abdulateeb commented Feb 21, 2026

Related issues

Fixes #902

Checklist

  • Did you run the pre-commit? (If not, your PR will most likely not pass — please ensure it passes pre-commit)
  • Did you test the change? (Ensure you didn't just prompt the AI and blindly commit — test the code and confirm it works)
  • Added screenshots to the PR description (if applicable)

Problem

The session calendar's previous/next month navigation buttons on the course detail page did not work. Clicking the left or right arrows had no visible effect - the calendar remained stuck on the current month.

Solution

  • Added onclick handlers: The previous/next month buttons now have initial onclick handlers using Django template variables, so they work on first page load
  • Fixed fetch URL: Changed from a hardcoded path (/courses/.../calendar/) to Django's {% url %} template tag, which correctly includes the /en/ language prefix and prevents silent 404 errors

Screenshots

view attached screen recording as it shows before and after

calendar_issue_fix.mp4

Summary by CodeRabbit

  • Refactor
    • Improved the calendar navigation system to use more robust URL handling, ensuring calendar views load correctly when navigating between months.

Copilot AI review requested due to automatic review settings February 21, 2026 05:14
@github-actions github-actions bot added the files-changed: 1 PR changes 1 file label Feb 21, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Walkthrough

The changes add inline onclick event handlers to calendar navigation buttons and update the calendar data fetch URL to use Django's URL reversal instead of a hard-coded path in the courses detail template.

Changes

Cohort / File(s) Summary
Calendar Navigation and URL Updates
web/templates/courses/detail.html
Added onclick handlers to prev-month-btn and next-month-btn to call loadCalendar() with appropriate month/year parameters. Updated calendar fetch URL from hard-coded path to Django URL reversal using {% url 'course_calendar' course.slug %}.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • Issue #902: Calendar navigation behavior changes directly address the onclick handler integration and Django URL reversal described in this issue.

Possibly related PRs

  • PR #302: Both PRs modify calendar-related JavaScript implementation and invocation in web/templates/courses/detail.html.

Suggested labels

d4

Suggested reviewers

  • A1L13N
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: restoring month navigation functionality for the session calendar on the course detail page.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where the session calendar's previous/next month navigation buttons on the course detail page were non-functional. The issue was caused by missing initial onclick handlers and an incorrect hardcoded fetch URL that didn't include the language prefix.

Changes:

  • Added initial onclick handlers to prev/next month buttons using Django template variables for the year and month values
  • Fixed the fetch URL in loadCalendar() function to use Django's {% url %} template tag instead of a hardcoded path, ensuring the language prefix is included

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/templates/courses/detail.html`:
- Around line 444-454: Replace the inline onclick attributes on the prev/next
buttons in the template (elements with ids prev-month-btn and next-month-btn)
with data-year and data-month attributes initialized from {{ prev_month }} / {{
next_month }}, remove any code that calls setAttribute to update onclick, and
instead add a one-time DOM event listener that calls the existing
loadCalendar(year, month) using parseInt(this.dataset.year) and
parseInt(this.dataset.month); update the part of the JS that currently updates
onclick (in loadCalendar's response handling) to set dataset.year/dataset.month
on the two buttons (or reconstruct them from response.prev_month/next_month)
rather than changing onclick strings.

@A1L13N A1L13N merged commit 5749221 into alphaonelabs:main Feb 22, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 1 PR changes 1 file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session calendar month navigation not working on course detail page

3 participants