Skip to content
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

Lecture: Fix Misaligned Unit Form Components in Edit Lecture #10178

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

laxerhd
Copy link
Contributor

@laxerhd laxerhd commented Jan 20, 2025

Checklist

General

Client

  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

There are some inconsistencies in the layout of creating different lecture units in Edit Lecture mode.
Closes #10171.

Description

  • online-unit-form: changed container to row and removed unnecessary space between obligatory field and star
  • video-unit-form: also changed container to row and added a div with col-12 class
  • create-exercise-unit: removed centering and added row

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Course with a lecture
  1. Go to a Course with lectures
  2. Click on Lectures
  3. Click on Manage
  4. Click on Edit
  5. Scroll down till you see Add a new Lecture Unit
  6. Take a look at Exercise, Video and Online

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Performance Tests

  • Test 1
  • Test 2

Screenshots

You can compare these screenshots with the ones in issue #10171

Exercise Unit:
image

Video Unit:
image

Online Unit:
image

Summary by CodeRabbit

  • Style

    • Restructured HTML layouts for exercise, online, and video unit forms
    • Simplified container and row structures in multiple component templates
    • Improved button and input field positioning
    • Minor formatting adjustments to form elements
  • Documentation

    • No significant documentation changes noted

The changes primarily focus on enhancing the visual organization and layout of form components within the lecture unit management section.

@laxerhd laxerhd requested a review from a team as a code owner January 20, 2025 18:54
@laxerhd laxerhd self-assigned this Jan 20, 2025
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Jan 20, 2025
Copy link

coderabbitai bot commented Jan 20, 2025

Walkthrough

The pull request focuses on restructuring the layout and alignment of various lecture unit form components in the Artemis application. The changes primarily involve modifying HTML templates for exercise, online, and video unit forms, aiming to create a more consistent and aligned user interface. The modifications include replacing container classes with row classes, repositioning buttons, and ensuring a more uniform layout across different unit creation forms.

Changes

File Change Summary
.../create-exercise-unit.component.html Replaced <div class="container"> with <div class="row">, repositioned create and cancel buttons to a new row
.../online-unit-form.component.html Changed form class from "container" to "row", minor label formatting adjustment
.../video-unit-form.component.html Removed nested container divs, consolidated input fields into a single row, preserved input and validation elements

Assessment against linked issues

Objective Addressed Explanation
Consistent form alignment
Button placement and order
Uniform layout across unit types

Possibly related PRs

Suggested labels

client, small, bugfix, ready to merge

Suggested reviewers

  • HawKhiem
  • Feras797
  • krusche
  • az108
  • coolchock

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 0

🧹 Nitpick comments (4)
src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html (2)

8-18: Consider simplifying nested row structure.

The nested row structure might cause unexpected spacing issues. Consider flattening the structure by combining the title and description into a single row with appropriate column classes.

-    <div class="row">
-        <div class="row">
-            <div class="col-12 mx-auto">
-                <h2 jhiTranslate="artemisApp.exerciseUnit.createExerciseUnit.headline"></h2>
-            </div>
-        </div>
-        <div class="row">
-            <div class="col-sm-6">
-                <p jhiTranslate="artemisApp.exerciseUnit.createExerciseUnit.description"></p>
-            </div>
-        </div>
+    <div class="row">
+        <div class="col-12">
+            <h2 jhiTranslate="artemisApp.exerciseUnit.createExerciseUnit.headline"></h2>
+        </div>
+        <div class="col-sm-6">
+            <p jhiTranslate="artemisApp.exerciseUnit.createExerciseUnit.description"></p>
+        </div>

76-92: Add spacing between action buttons.

While the button placement is correct, consider adding margin between the submit and cancel buttons for better visual separation.

-                    <button type="button" (click)="cancelForm()" class="btn btn-default">
+                    <button type="button" (click)="cancelForm()" class="btn btn-default ms-2">
src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/video-unit-form/video-unit-form.component.html (2)

53-62: Simplify form layout structure.

The current nested structure with an empty column for spacing is overly complex. Consider using Bootstrap's spacing utilities instead.

-                <div class="row" style="padding: 0">
-                    <div class="col-12">
-                        <div class="row">
-                            <div class="col-4">
-                                <label class="required" for="source">{{ 'artemisApp.videoUnit.createVideoUnit.source' | artemisTranslate }}*</label>
-                            </div>
-                            <div class="col-1"></div>
-                            <div class="col-7">
-                                <label for="urlHelper" jhiTranslate="artemisApp.videoUnit.createVideoUnit.urlVideoHelper"></label>
-                            </div>
-                        </div>
+                <div class="row">
+                    <div class="col-4">
+                        <label class="required" for="source">{{ 'artemisApp.videoUnit.createVideoUnit.source' | artemisTranslate }}*</label>
+                    </div>
+                    <div class="col-7 offset-1">
+                        <label for="urlHelper" jhiTranslate="artemisApp.videoUnit.createVideoUnit.urlVideoHelper"></label>
+                    </div>

83-110: Align validation structure with form layout improvements.

While the validation messages correctly use the new @if directive, their structure should be simplified along with the form layout changes suggested above.

-                        <div class="row">
-                            <div class="col-4">
-                                @if (sourceControl?.invalid && (sourceControl?.dirty || sourceControl?.touched)) {
-                                    <div class="alert alert-danger">
-                                        @if (sourceControl?.errors?.required) {
-                                            <div jhiTranslate="artemisApp.videoUnit.createVideoUnit.sourceRequiredValidationError"></div>
-                                        }
-                                        @if (sourceControl?.errors?.invalidVideoUrl) {
-                                            <div jhiTranslate="artemisApp.videoUnit.createVideoUnit.sourceURLValidationError"></div>
-                                        }
-                                    </div>
-                                }
-                            </div>
-                            <div class="col-1"></div>
-                            <div class="col-7">
+                        <div class="row mt-2">
+                            <div class="col-4">
+                                @if (sourceControl?.invalid && (sourceControl?.dirty || sourceControl?.touched)) {
+                                    <div class="alert alert-danger mb-0">
+                                        @if (sourceControl?.errors?.required) {
+                                            <div jhiTranslate="artemisApp.videoUnit.createVideoUnit.sourceRequiredValidationError"></div>
+                                        }
+                                        @if (sourceControl?.errors?.invalidVideoUrl) {
+                                            <div jhiTranslate="artemisApp.videoUnit.createVideoUnit.sourceURLValidationError"></div>
+                                        }
+                                    </div>
+                                }
+                            </div>
+                            <div class="col-7 offset-1">
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acb1220 and 6c01bfd.

📒 Files selected for processing (3)
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html (2 hunks)
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/online-unit-form/online-unit-form.component.html (2 hunks)
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/video-unit-form/video-unit-form.component.html (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/online-unit-form/online-unit-form.component.html
🧰 Additional context used
📓 Path-based instructions (2)
src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/video-unit-form/video-unit-form.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: client-style
  • GitHub Check: server-style
  • GitHub Check: client-tests
  • GitHub Check: server-tests
  • GitHub Check: Build and Push Docker Image
  • GitHub Check: Analyse
  • GitHub Check: Build .war artifact
🔇 Additional comments (1)
src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html (1)

Line range hint 52-65: LGTM! Follows new Angular syntax guidelines.

The template correctly uses the new @for directive instead of *ngFor.

Copy link

@SindiBuklaji SindiBuklaji left a comment

Choose a reason for hiding this comment

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

Tested on Ts2. Works as described.
I would suggest that the item boxes stay there, even after you select one of them (for ease of switching)
image

image

@laxerhd
Copy link
Contributor Author

laxerhd commented Jan 22, 2025

Tested on Ts2. Works as described. I would suggest that the item boxes stay there, even after you select one of them (for ease of switching) image

image

@SindiBuklaji that sounds like a good idea.
I'm not sure if I should make these changes in this PR, since this one was just meant to fix the inconsistencies there.
I could open a new PR to add the item boxes back in, even if a unit is open. What do you think about that?

Copy link

@ItsaaaMeMario ItsaaaMeMario left a comment

Choose a reason for hiding this comment

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

Tested on TS4, works as described.
Bildschirmfoto 2025-01-22 um 19 14 39

Copy link

⚠️ Unable to deploy to test servers ⚠️

Testserver "artemis-test5.artemis.cit.tum.de" is already in use by PR #10174.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Jan 22, 2025
@vinceclifford vinceclifford added deploy:artemis-test5 and removed deployment-error Added by deployment workflows if an error occured labels Jan 22, 2025
@vinceclifford vinceclifford temporarily deployed to artemis-test5.artemis.cit.tum.de January 22, 2025 21:26 — with GitHub Actions Inactive
Copy link

@vinceclifford vinceclifford left a comment

Choose a reason for hiding this comment

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

Tested on TS5, works as expected.

Copy link

⚠️ Unable to deploy to test servers ⚠️

Testserver "artemis-test1.artemis.cit.tum.de" is already in use by PR #10183.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Jan 22, 2025
@github-actions github-actions bot removed the deployment-error Added by deployment workflows if an error occured label Jan 22, 2025
Copy link

@Feras797 Feras797 left a comment

Choose a reason for hiding this comment

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

Tested on TS3, edit, video and online works fine.
image

Copy link

@zagemello zagemello left a comment

Choose a reason for hiding this comment

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

Tested on TS3, all works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!)
Projects
Status: Work In Progress
Development

Successfully merging this pull request may close these issues.

Lecture: Misaligned unit form components in Edit Lecture
6 participants