Skip to content

Normale Validation-Attribute benutzen #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Normale Validation-Attribute benutzen #185

wants to merge 2 commits into from

Conversation

MHajoha
Copy link
Member

@MHajoha MHajoha commented May 23, 2025

Anders als im Plugin verwendet das Attempt-Ui im SDK noch kein Bootstrap. Das wollte ich nicht mal eben so ändern, ohne mit @tumidi zu sprechen, daher ist die "Implementierung" hier erstmal trivial, invalide Elemente werden einfach rot umrandet. Die validation message zeigt der Browser ohnehin beim drüberhovern an.

Wir sollten der Frage mittelfristig noch irgendeine Art von Styling verpassen, das können wir dann ja in 2 Wochen besprechen ;)

Closes: #184

MHajoha added 2 commits May 23, 2025 19:39
Since the attempt ui lives in an iframe now, the normal validation attributes won't prevent submission.

See: questionpy-org/moodle-qtype_questionpy@ebaed00
Since it tests the legacy renderer.
@MHajoha MHajoha requested review from MartinGauk, tumidi and janbritz May 23, 2025 18:03
Copy link
Contributor

Choose a reason for hiding this comment

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

Ohh... das war ein Fehler meinerseits. tests/questionpy_sdk/webserver/controllers/attempt/test_question_ui.py darf nicht von webserver_legacy importieren, sondern von webserver:

test_question_ui.py, sowie auch test_data verbleiben wo sie sind, nur die Imports in test_question_ui.py müssten angepasst werden:

from questionpy_sdk.webserver.controllers.attempt.errors import (
    ConversionError,
    DuplicateNameError,
    ExpectedAncestorError,
    InvalidAttributeValueError,
    InvalidCleanOptionError,
    InvalidContentError,
    PlaceholderReferenceError,
    RenderError,
    UnknownAttributeError,
    UnknownElementError,
    XMLSyntaxError,
)
from questionpy_sdk.webserver.controllers.attempt.question_ui import (
    DisplayRole,
    QuestionDisplayOptions,
    QuestionFormulationUIRenderer,
    QuestionMetadata,
    QuestionUIRenderer,
)

Aktuell ist der QuestionUIRenderer-Code dupliziert in

  • questionpy_sdk.webserver.controllers.attempt.question_ui (neu), sowie
  • questionpy_sdk.webserver_legacy.question_ui (alt, fliegt bald raus)

--text-color: black;

:is(input, select, textarea):invalid {
border-color: var(--invalid-input-color);
Copy link
Contributor

Choose a reason for hiding this comment

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

Anders als im questionpy-org/moodle-qtype_questionpy#184 verwendet das Attempt-Ui im SDK noch kein Bootstrap.

Ja, richtig, hier könnten wir zukünftig auch Bootstrap importieren oder so. Aktuell propagiere ich nur color theme ins iframe für eine zukünftige Bootstrap-Unterstützung.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Normale Validation-Attribute benutzen
3 participants