-
Notifications
You must be signed in to change notification settings - Fork 350
Bugfix: Fix markdown in modeling exercises example solutions #11653
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,6 +116,12 @@ <h4 class="modal-title" jhiTranslate="artemisApp.modelingEditor.helpModal.title" | |
| } | ||
|
|
||
| @if (withExplanation) { | ||
| <jhi-modeling-explanation-editor [explanation]="explanation" (explanationChange)="onExplanationInput($event)" [readOnly]="readOnly" /> | ||
| <!-- <jhi-modeling-explanation-editor [explanation]="explanation" (explanationChange)="onExplanationInput($event)" [readOnly]="readOnly" /> --> | ||
|
|
||
| <!-- workaround until further investigation into example solution rendering --> | ||
| <label for="explanationText" jhiTranslate="artemisApp.modelingSubmission.explanationText"></label> | ||
| <div class="p-3 border markdown-preview"> | ||
| <p id="explanationText" [innerHTML]="explanation | htmlForMarkdown"></p> | ||
| </div> | ||
| } | ||
|
Comment on lines
118
to
126
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainCritical: Verify instructor/admin edit workflow is not broken. The new implementation shows the same read-only markdown display for all users when Unless instructors/admins have another interface for editing the explanation, or Consider wrapping the new display in a conditional check: @if (withExplanation) {
- <!-- <jhi-modeling-explanation-editor [explanation]="explanation" (explanationChange)="onExplanationInput($event)" [readOnly]="readOnly" /> -->
-
- <!-- workaround until further investigation into example solution rendering -->
- <label for="explanationText" jhiTranslate="artemisApp.modelingSubmission.explanationText"></label>
- <div class="p-3 border markdown-preview">
- <p id="explanationText" [innerHTML]="explanation | htmlForMarkdown"></p>
- </div>
+ @if (readOnly) {
+ <!-- Student view: read-only markdown display -->
+ <label for="explanationText" jhiTranslate="artemisApp.modelingSubmission.explanationText"></label>
+ <div class="p-3 border markdown-preview">
+ <p id="explanationText" [innerHTML]="explanation | htmlForMarkdown"></p>
+ </div>
+ } @else {
+ <!-- Instructor/admin view: editable interface -->
+ <jhi-modeling-explanation-editor [explanation]="explanation" (explanationChange)="onExplanationInput($event)" [readOnly]="false" />
+ }
}Alternatively, verify that one of the following is true:
Run this script to understand when 🏁 Script executed: #!/bin/bash
# Description: Find usages of the withExplanation input to understand when it's enabled
# Search for withExplanation property bindings
rg -n "withExplanation" --type=html --type=ts -C3Length of output: 9848 The web search returned generic results. I need to search the codebase directly for the 🏁 Script executed: #!/bin/bash
# Search for onExplanationInput method in modeling-editor component
rg -n "onExplanationInput" --type=ts --type=html -C5Length of output: 6659 🏁 Script executed: #!/bin/bash
# Search for onExplanationInput method in modeling-editor component
rg -n "onExplanationInput" --type=ts --type=html -C5Length of output: 6659 Critical: Editing capability broken for instructors and students in multiple contexts. Verification confirms the original concern. The
The Restore the conditional logic to handle both read-only and editable modes: @if (withExplanation) {
- <!-- <jhi-modeling-explanation-editor [explanation]="explanation" (explanationChange)="onExplanationInput($event)" [readOnly]="readOnly" /> -->
-
- <!-- workaround until further investigation into example solution rendering -->
- <label for="explanationText" jhiTranslate="artemisApp.modelingSubmission.explanationText"></label>
- <div class="p-3 border markdown-preview">
- <p id="explanationText" [innerHTML]="explanation | htmlForMarkdown"></p>
- </div>
+ @if (readOnly) {
+ <label for="explanationText" jhiTranslate="artemisApp.modelingSubmission.explanationText"></label>
+ <div class="p-3 border markdown-preview">
+ <p id="explanationText" [innerHTML]="explanation | htmlForMarkdown"></p>
+ </div>
+ } @else {
+ <jhi-modeling-explanation-editor [explanation]="explanation" (explanationChange)="onExplanationInput($event)" [readOnly]="false" />
+ }
} |
||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,15 +10,16 @@ import { Patch } from '@ls1intum/apollon'; | |
| import { TranslateDirective } from 'app/shared/language/translate.directive'; | ||
| import { FaIconComponent } from '@fortawesome/angular-fontawesome'; | ||
| import { NgClass, NgStyle } from '@angular/common'; | ||
| import { ModelingExplanationEditorComponent } from '../modeling-explanation-editor/modeling-explanation-editor.component'; | ||
| import { captureException } from '@sentry/angular'; | ||
| import { FormsModule } from '@angular/forms'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary FormsModule import. The Apply this diff to remove the unnecessary import: -import { FormsModule } from '@angular/forms';
import { HtmlForMarkdownPipe } from 'app/shared/pipes/html-for-markdown.pipe';- imports: [TranslateDirective, FaIconComponent, NgStyle, NgClass, FormsModule, HtmlForMarkdownPipe],
+ imports: [TranslateDirective, FaIconComponent, NgStyle, NgClass, HtmlForMarkdownPipe],Also applies to: 22-22 🤖 Prompt for AI Agents |
||
| import { HtmlForMarkdownPipe } from 'app/shared/pipes/html-for-markdown.pipe'; | ||
|
|
||
| @Component({ | ||
| selector: 'jhi-modeling-editor', | ||
| templateUrl: './modeling-editor.component.html', | ||
| styleUrls: ['./modeling-editor.component.scss'], | ||
| encapsulation: ViewEncapsulation.None, | ||
| imports: [TranslateDirective, FaIconComponent, NgStyle, NgClass, ModelingExplanationEditorComponent], | ||
| imports: [TranslateDirective, FaIconComponent, NgStyle, NgClass, FormsModule, HtmlForMarkdownPipe], | ||
| }) | ||
| export class ModelingEditorComponent extends ModelingComponent implements AfterViewInit, OnDestroy, OnChanges { | ||
| protected readonly faCheck = faCheck; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect semantic HTML: label pointing to non-form element.
The
<label for="explanationText">points to a<p>element, which is not a form control. Theforattribute should only reference form elements like<input>,<textarea>, or<select>. This creates invalid HTML and doesn't provide the expected accessibility benefits.Apply this diff to fix the semantic issue:
Alternatively, if you want to maintain label semantics for styling purposes, remove the
forattribute:📝 Committable suggestion
🤖 Prompt for AI Agents