From 6e44346c77ce4c817e24269f0150b4118bc12f50 Mon Sep 17 00:00:00 2001 From: Jonathan Ostertag Date: Sat, 2 Mar 2024 21:24:31 +0100 Subject: [PATCH] General: Disable readonly input elements (#8114) --- .../edit-lti-configuration.component.html | 4 ---- .../organization-management-update.component.html | 4 ---- ...m-notification-management-update.component.html | 4 ---- .../user-management-update.component.html | 4 ---- .../unreferenced-feedback-detail.component.html | 4 ++-- .../app/course/manage/course-update.component.html | 4 ---- .../app/course/manage/course-update.component.ts | 11 +++++++---- .../exam/manage/exams/exam-update.component.html | 14 +------------- .../text/text-exam-submission.component.html | 4 ++-- .../file-upload-exercise-update.component.html | 4 ---- .../manage/modeling-exercise-update.component.html | 4 ---- .../modeling-explanation-editor.component.html | 1 + ...programming-exercise-information.component.html | 7 ++----- .../programming-exercise-information.component.ts | 2 +- .../manage/quiz-exercise-update.component.html | 4 ---- .../manage/exercise-hint-update.component.html | 4 ---- .../team-update-dialog.component.html | 3 ++- .../textblock-feedback-editor.component.html | 2 ++ .../text-exercise-update.component.html | 4 ---- .../text/participate/text-editor.component.html | 4 ++-- .../attachment-unit-form.component.html | 2 +- .../attachment-unit-form.component.ts | 2 +- .../app/lecture/lecture-update.component.html | 4 ---- .../conversation-info.component.html | 3 +++ 24 files changed, 27 insertions(+), 76 deletions(-) diff --git a/src/main/webapp/app/admin/lti-configuration/edit-lti-configuration.component.html b/src/main/webapp/app/admin/lti-configuration/edit-lti-configuration.component.html index fa03b09a77c5..3741321a2ce0 100644 --- a/src/main/webapp/app/admin/lti-configuration/edit-lti-configuration.component.html +++ b/src/main/webapp/app/admin/lti-configuration/edit-lti-configuration.component.html @@ -9,10 +9,6 @@

-
- - -
diff --git a/src/main/webapp/app/admin/organization-management/organization-management-update.component.html b/src/main/webapp/app/admin/organization-management/organization-management-update.component.html index 23c6a89c0208..a775fa5f54e3 100644 --- a/src/main/webapp/app/admin/organization-management/organization-management-update.component.html +++ b/src/main/webapp/app/admin/organization-management/organization-management-update.component.html @@ -3,10 +3,6 @@

Add or edit a Organization

-
- - -
diff --git a/src/main/webapp/app/admin/system-notification-management/system-notification-management-update.component.html b/src/main/webapp/app/admin/system-notification-management/system-notification-management-update.component.html index c3253e664b65..04b03fd62207 100644 --- a/src/main/webapp/app/admin/system-notification-management/system-notification-management-update.component.html +++ b/src/main/webapp/app/admin/system-notification-management/system-notification-management-update.component.html @@ -3,10 +3,6 @@

Create or edit a system notification

-
- - -
diff --git a/src/main/webapp/app/admin/user-management/user-management-update.component.html b/src/main/webapp/app/admin/user-management/user-management-update.component.html index 08c4d853d014..a0009c7b3e2b 100644 --- a/src/main/webapp/app/admin/user-management/user-management-update.component.html +++ b/src/main/webapp/app/admin/user-management/user-management-update.component.html @@ -3,10 +3,6 @@

Create or edit a User

-
- - -
diff --git a/src/main/webapp/app/course/manage/course-update.component.html b/src/main/webapp/app/course/manage/course-update.component.html index d071a4607e4f..cd328f02efa0 100644 --- a/src/main/webapp/app/course/manage/course-update.component.html +++ b/src/main/webapp/app/course/manage/course-update.component.html @@ -17,10 +17,6 @@


-
- - -
diff --git a/src/main/webapp/app/course/manage/course-update.component.ts b/src/main/webapp/app/course/manage/course-update.component.ts index 71e2c681213f..327b07b51e8e 100644 --- a/src/main/webapp/app/course/manage/course-update.component.ts +++ b/src/main/webapp/app/course/manage/course-update.component.ts @@ -160,10 +160,13 @@ export class CourseUpdateComponent implements OnInit { { id: new FormControl(this.course.id), title: new FormControl(this.course.title, [Validators.required]), - shortName: new FormControl(this.course.shortName, { - validators: [Validators.required, Validators.minLength(3), regexValidator(SHORT_NAME_PATTERN)], - updateOn: 'blur', - }), + shortName: new FormControl( + { value: this.course.shortName, disabled: !!this.course.id }, + { + validators: [Validators.required, Validators.minLength(3), regexValidator(SHORT_NAME_PATTERN)], + updateOn: 'blur', + }, + ), // note: we still reference them here so that they are used in the update method when the course is retrieved from the course form customizeGroupNames: new FormControl(this.customizeGroupNames), studentGroupName: new FormControl(this.course.studentGroupName), diff --git a/src/main/webapp/app/exam/manage/exams/exam-update.component.html b/src/main/webapp/app/exam/manage/exams/exam-update.component.html index d3172573a6f9..b14999a7dd72 100644 --- a/src/main/webapp/app/exam/manage/exams/exam-update.component.html +++ b/src/main/webapp/app/exam/manage/exams/exam-update.component.html @@ -18,18 +18,6 @@

{{ 'artemisApp.examManagement.editExam' | artemisTranslate }}


Exam Configuration
- @if (exam.course) { -
- - -
- } - @if (exam.id) { -
- - -
- } Ex @if (!exam.testExam) { - + } @if (exam.testExam) { diff --git a/src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.html b/src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.html index d4e424bc5dbd..b72aaf4aa706 100644 --- a/src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.html +++ b/src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.html @@ -12,10 +12,6 @@

General Information

-
- - -

General Information

-
- - -
@if (!isExamMode) {
diff --git a/src/main/webapp/app/exercises/modeling/shared/modeling-explanation-editor.component.html b/src/main/webapp/app/exercises/modeling/shared/modeling-explanation-editor.component.html index e404f0798685..bdad6f5752d9 100644 --- a/src/main/webapp/app/exercises/modeling/shared/modeling-explanation-editor.component.html +++ b/src/main/webapp/app/exercises/modeling/shared/modeling-explanation-editor.component.html @@ -8,4 +8,5 @@ (keydown.tab)="onTextEditorTab(textEditor, $event)" (ngModelChange)="onExplanationInput($event)" [readOnly]="readOnly" + [disabled]="readOnly" > diff --git a/src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-information.component.html b/src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-information.component.html index 9a9996a6d256..d2284c707206 100644 --- a/src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-information.component.html +++ b/src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-information.component.html @@ -6,10 +6,6 @@ General Information

Add some general information about the new exercise

-
- - -
@@ -39,7 +35,8 @@ minlength="3" [pattern]="programmingExerciseCreationConfig.shortNamePattern" [(ngModel)]="programmingExercise.shortName" - [readonly]="!programmingExerciseCreationConfig.isImportFromExistingExercise && programmingExercise.id" + [readOnly]="!programmingExerciseCreationConfig.isImportFromExistingExercise && !!programmingExercise.id" + [disabled]="!programmingExerciseCreationConfig.isImportFromExistingExercise && !!programmingExercise.id" #shortName="ngModel" /> @for (error of shortName.errors! | keyvalue | removekeys: ['required']; track error) { diff --git a/src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-information.component.ts b/src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-information.component.ts index 1233dfc9a5b2..6ff615ce6451 100644 --- a/src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-information.component.ts +++ b/src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-information.component.ts @@ -58,7 +58,7 @@ export class ProgrammingExerciseInformationComponent implements AfterViewInit, O const areAuxiliaryRepositoriesValid = this.areAuxiliaryRepositoriesValid(); this.formValid = Boolean( this.exerciseTitleChannelComponent.titleChannelNameComponent?.formValid && - this.shortNameField.valid && + !this.shortNameField.invalid && isCheckoutSolutionRepositoryValid && isRecreateBuildPlansValid && isUpdateTemplateFilesValid && diff --git a/src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.html b/src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.html index e8dca2c004dd..2cadec30cd0c 100644 --- a/src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.html +++ b/src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.html @@ -30,10 +30,6 @@

} -
- - -
- - -
diff --git a/src/main/webapp/app/exercises/shared/team/team-update-dialog/team-update-dialog.component.html b/src/main/webapp/app/exercises/shared/team/team-update-dialog/team-update-dialog.component.html index 5c3892ce0f81..8d76dbd6febb 100644 --- a/src/main/webapp/app/exercises/shared/team/team-update-dialog/team-update-dialog.component.html +++ b/src/main/webapp/app/exercises/shared/team/team-update-dialog/team-update-dialog.component.html @@ -45,7 +45,8 @@
@@ -98,6 +99,7 @@ (focus)="inFocus()" (ngModelChange)="didChange()" [readOnly]="feedback.gradingInstruction || readOnly" + [disabled]="!!feedback.gradingInstruction || readOnly" />
diff --git a/src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.html b/src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.html index 835cd841091d..fc83b64e64df 100644 --- a/src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.html +++ b/src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.html @@ -12,10 +12,6 @@

General Information

-
- - -
@if (!isExamMode) {
diff --git a/src/main/webapp/app/exercises/text/participate/text-editor.component.html b/src/main/webapp/app/exercises/text/participate/text-editor.component.html index c34cdcad4903..cf2d33432a6b 100644 --- a/src/main/webapp/app/exercises/text/participate/text-editor.component.html +++ b/src/main/webapp/app/exercises/text/participate/text-editor.component.html @@ -46,8 +46,8 @@ class="text-editor-textarea" [maxLength]="maxCharacterCount" [(ngModel)]="answer" - [readonly]="!isActive || !submission || !isOwnerOfParticipation" - [disabled]="!isActive || !submission" + [readOnly]="!isActive || !submission || !isOwnerOfParticipation" + [disabled]="!isActive || !submission || !isOwnerOfParticipation" (keydown.tab)="onTextEditorTab(textEditor, $event)" (input)="onTextEditorInput($event)" > diff --git a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.html b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.html index 393914dd260d..20d012c8a60d 100644 --- a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.html +++ b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.html @@ -111,7 +111,7 @@
- +
diff --git a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.ts b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.ts index 85e21070abfa..bfa4d64ea9a2 100644 --- a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.ts +++ b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.ts @@ -88,7 +88,7 @@ export class AttachmentUnitFormComponent implements OnInit, OnChanges { name: [undefined as string | undefined, [Validators.required, Validators.maxLength(255)]], description: [undefined as string | undefined, [Validators.maxLength(1000)]], releaseDate: [undefined as dayjs.Dayjs | undefined], - version: [1], + version: [{ value: 1, disabled: true, readOnly: true }], updateNotificationText: [undefined as string | undefined, [Validators.maxLength(1000)]], competencies: [undefined as Competency[] | undefined], }); diff --git a/src/main/webapp/app/lecture/lecture-update.component.html b/src/main/webapp/app/lecture/lecture-update.component.html index 25e794d24783..92e6d5001b5b 100644 --- a/src/main/webapp/app/lecture/lecture-update.component.html +++ b/src/main/webapp/app/lecture/lecture-update.component.html @@ -27,10 +27,6 @@

- - -

diff --git a/src/main/webapp/app/overview/course-conversations/dialogs/conversation-detail-dialog/tabs/conversation-info/conversation-info.component.html b/src/main/webapp/app/overview/course-conversations/dialogs/conversation-detail-dialog/tabs/conversation-info/conversation-info.component.html index 31e330490f9b..bc11bb78838f 100644 --- a/src/main/webapp/app/overview/course-conversations/dialogs/conversation-detail-dialog/tabs/conversation-info/conversation-info.component.html +++ b/src/main/webapp/app/overview/course-conversations/dialogs/conversation-detail-dialog/tabs/conversation-info/conversation-info.component.html @@ -8,6 +8,7 @@