Skip to content

fix: close the LTI gaps from the built-in block - #360

Open
irfanuddinahmad wants to merge 1 commit into
openedx:mainfrom
irfanuddinahmad:irfanuddinahmad/lti-leftovers-359
Open

irfanuddinahmad wants to merge 1 commit into
openedx:mainfrom
irfanuddinahmad:irfanuddinahmad/lti-leftovers-359

Conversation

@irfanuddinahmad

Copy link
Copy Markdown
Contributor

Summary

  • Fixes every item in LTI: leftover changes from the built-in LTI block #359: two platform changes that never reached xblock_lti, and five places where the extracted LTI block behaves worse than the built-in one.
  • After this, the extracted block shows learners the same text the built-in block did, and its CSS no longer restyles other blocks.

Why it's needed: openedx/openedx-platform#38747 removes the built-in LTI block, which is the only fallback for these issues today, so it merges after this is released.

Changes

#359 item Fix
Docs link (platform #36461) Studio help text links to docs.openedx.org
pytz → zoneinfo (platform #37562) block.py and the LTI tests use zoneinfo; pytz is no longer a direct dependency (two lines removed from uv.lock)
1. Grader feedback label shows ${_("...")} {% trans %} in lti.html
2. "(1.0 total_points possible)" The block renders {points} / {total_points} points and {total_points} points possible with its own catalog, as the built-in block did
3. confirm() prompts are English-only Wrapped in gettext(), using the block's JS catalog (window.XBlockLTII18N) when the runtime provides one, else the page's global gettext
4. _() inside template variables reads Django's global catalog The new-window link text and the missing-launch_url message use {% trans %}
5. Unscoped CSS restyles other blocks Every rule in lti.css is scoped to the block's .lti-wrapper root

Translations: "View resource in a new window" and "{points} / {total_points} points" are already translated in openedx-translations. "{total_points} points possible", the feedback label, the missing-launch_url message and the three prompts are new to this catalog, so they show in English until the next translation cycle.

Test plan

  • New src/xblock_lti/tests/test_lti_student_view.py (11 tests) renders student_view and checks each item, including translations through a stub block catalog. 10 of them fail on main; the 11th checks English score text, which main already got right.

  • pytest src/xblock_lti/tests/: 55 passed. ruff check, ruff format --check and pylint src/xblock_lti are clean.

  • uv lock --check passes with uv 0.12.6 and 0.13.12.

  • Live in a local Tutor (platform master, xblocks-core 4.0.0 with this PR's four LTI files on top; LTI is unchanged between 4.0.0 and main), as a learner, in a unit with two scored LTIs, an LTI without launch_url and a Problem:

    Stock This PR
    Feedback label ${_("Feedback on your work from the grader:")} "Feedback on your work from the grader:"
    Score, no result yet "(1.0 total_points possible)" "(1.0 points possible)"
    Score with a result "(0.5 / 1.0 points)" Same
    Problem's .problem-progress next to the LTI padding-left: 5px, font-weight: 100 (LTI's rules) 0px, 400
    confirm() on the new-window link English prompt Same prompt, now through gettext()
Stock This PR
stock this PR

Closes #359. Part of the Slash-n-Burn Built-In XBlocks epic.

🤖 Generated with Claude Code

Port the two platform changes that never reached xblock_lti, and fix five
places where the extracted block behaves worse than the built-in one:

- Docs link in the Studio help text: edx.readthedocs.io -> docs.openedx.org
  (openedx/openedx-platform#36461).
- pytz -> zoneinfo in block.py and the LTI tests, and drop the direct pytz
  dependency (openedx/openedx-platform#37562).
- lti.html: the grader feedback label used Mako syntax in a Django template,
  so learners saw the literal ${_("...")}. Use {% trans %}.
- Score text: render "{points} / {total_points} points" and
  "{total_points} points possible" with the block's catalog, as the
  built-in block did, instead of "(1.0 total_points possible)".
- The "View resource in a new window" default and the missing launch_url
  message used _() inside template variables, which reads Django's global
  catalog. Use {% trans %} so they come from the block's catalog.
- lti.js: wrap the three confirm() prompts in gettext() again, using the
  block's JS catalog (window.XBlockLTII18N) when the runtime provides one.
- lti.css: scope every rule to the block's .lti-wrapper root, so LTI styles
  no longer restyle other blocks' .problem-progress / .problem-header.

Closes openedx#359.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Dec 4, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @irfanuddinahmad!

This repository is currently maintained by @openedx/axim-engineering.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

LTI: leftover changes from the built-in LTI block

2 participants