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

[#4552] Increase course ID, course name, and session name max length #11277

Merged

Conversation

samuelfangjw
Copy link
Member

Fixes #4552

Outline of Solution

Increased max length as follows:

  • course id: 40 -> 64
  • course name: 64 -> 80
  • session name: 38 -> 64

Made changes to frontend to ensure that text does not overflow their containers. This was done mainly by allowing text to wrap if necessary and increasing the size of text containers. Screenshots of some of the UI below. Two test cases were used, names with words "very long..." and names with letters only "MMMMM", M chosen because it is the widest possible letter. This represents a typical case and the extreme case where the maximum possible length is reached. Both cases have the maximum number of characters. Screenshots below were taken on a 13 inch screen. There is slightly less wrapping on larger screens.

Screenshot 2021-07-16 at 5 44 52 PM

In the screenshot above, I was a little unsure where to put the timezone field that was originally on the right side beside the course id. I've placed it below the course id as this is the the current location when the window size is too small.

Screenshot 2021-07-16 at 6 13 51 PM

For the course name, in the common case the text fits over two lines. However in the extreme case the text may take up 3 lines.

Screenshot 2021-07-17 at 12 05 33 AM
Screenshot 2021-07-17 at 12 03 14 AM

For edit course details section, the course name overflows the input in the extreme case. This is similar to current behaviour when screen width is too small.

Notes
Couldn't seem to get text-break css class to work on <td> tags. I added a td-text-break class with the same css properties to workaround this issue.

@samuelfangjw samuelfangjw marked this pull request as draft July 16, 2021 16:20
@damithc
Copy link
Contributor

damithc commented Jul 17, 2021

Nice work @samuelfangjw I have no issues with the UI changes you have posted.

@samuelfangjw samuelfangjw marked this pull request as ready for review July 17, 2021 06:28
@halfwhole halfwhole added the s.ToReview The PR is waiting for review(s) label Jul 17, 2021
@@ -1,3 +1,8 @@
.margin-0 {
margin: 0;
}

.td-text-break {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use bootstrap's text-break instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

There's a bug with text-break in the current version of bootstrap css file used (4.5.0) that causes it to not work with certain tags, <td> being one of them.

v 4.5.0
Screenshot 2021-07-19 at 9 15 53 PM

v 4.4.1
Screenshot 2021-07-19 at 8 25 10 PM

I used the td-text-break class to work around this. If this is not suitable maybe I could wrap all the necessary tags with a span and apply the text-break class to the span instead.

edit: Actually would it be possible to look into changing the version of bootstrap stylesheet used?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the approach of using td-text-break is fine. Just put it in the global styles.scss to avoid repeating it everywhere, and leave a comment there to explain the rationale for this class.

Actually would it be possible to look into changing the version of bootstrap stylesheet used?

What version do you want to change to? Is this issue fixed in a later version of bootstrap? We could create a separate issue for it since there may be breaking changes in changing the version. For this PR, I think we best stick to the current bootstrap version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changing it is possible but unlikely within the context of one PR, but if many bugs require a change or we do a major patch we can make the change.

For now, what about moving .td-text-break to a common scss file (such as page.component). This way we can also centralize the class name so we can also file an issue/ add to wiki to remove it when we update bootstrap.

@@ -1,3 +1,8 @@
.margin-0 {
margin: 0;
}

.td-text-break {
Copy link
Contributor

Choose a reason for hiding this comment

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

Changing it is possible but unlikely within the context of one PR, but if many bugs require a change or we do a major patch we can make the change.

For now, what about moving .td-text-break to a common scss file (such as page.component). This way we can also centralize the class name so we can also file an issue/ add to wiki to remove it when we update bootstrap.

@samuelfangjw
Copy link
Member Author

@ccyccyccy @ChooJeremy Thanks for the review, I've taken your suggestions and moved the class to the global styles.scss file. I've renamed it text-break-class as I thought it would be neater if I was able to use this on all the tags that require it and not just td tags. I've also added a comment about the bug with link to the issue on bootstrap.

Copy link
Contributor

@ChooJeremy ChooJeremy left a comment

Choose a reason for hiding this comment

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

I did some testing on my end and it seems like the courses page hasn't been handled.
Screen Shot 2021-07-23 at 12 49 56 AM

// text-break class on current version of bootstrap (4.5.0) does not work on some tags.
// This class can be replaced with text-break once bootstrap version is upgraded.
// See https://github.com/twbs/bootstrap/issues/30803
.text-break-class {
Copy link
Contributor

Choose a reason for hiding this comment

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

The word class here seems useless, since this is marked as a css class with the dot in front of it. What do you think about just text-break?

Copy link
Member Author

Choose a reason for hiding this comment

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

My original intention here was to choose a different name from text-break as other classes may use the current broken implementation of text-break class and I was a bit afraid that changing the behaviour of text-break might lead to regressions.

However, after giving this some thought, maybe it might be better to override the text-break class with the correct implementation so that future contributors who use the text-break class get the expected implementation. I could also check the all current uses of text-break to ensure that there are no regressions.

I'll take a closer look at this and fix the issues above tonight!

Copy link
Member Author

Choose a reason for hiding this comment

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

I renamed text-break-class to text-break and replaced the implementation with the current bootstrap implementation of text-break. I think this will make it easier to remove in the future if we ever update bootstrap as well (can just remove the style in css file).

I couldn't seem to replicate the issue on the courses page, the text breaks nicely for me. I've updated the implementation though, so hopefully this fixes it!

Screenshot 2021-07-24 at 12 53 44 AM

Copy link
Contributor

@ChooJeremy ChooJeremy left a comment

Choose a reason for hiding this comment

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

Found further issues:
Within the admin search page, searching for the course:
Screen Shot 2021-07-25 at 11 54 25 PM
On trying to create a new feedback session, copying from previous feedback session.
Screen Shot 2021-07-26 at 12 00 23 AM
On trying to edit a feedback session, copying a question from another feedback question:
Screen Shot 2021-07-26 at 12 01 15 AM

There may be more. To be comprehensive, other than just manually checking pages, you can consider searching for (ctrl-shift-F in IntelliJ) cases of courseId, courseName and feedbackSessionName, with a .html filter.

@@ -283,3 +283,11 @@ h6,
background: white;
color: black;
}

// text-break class on current version of bootstrap (4.5.0) does not work on some tags.
// This class can be replaced with text-break once bootstrap version is upgraded.
Copy link
Contributor

Choose a reason for hiding this comment

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

Your solution seems to work. Do remember to update the comment as well.

@samuelfangjw samuelfangjw marked this pull request as draft July 26, 2021 08:20
# Conflicts:
#	src/web/app/pages-instructor/instructor-audit-logs-page/__snapshots__/instructor-audit-logs-page.component.spec.ts.snap
#	src/web/app/pages-instructor/instructor-audit-logs-page/instructor-audit-logs-page.component.html
@samuelfangjw samuelfangjw marked this pull request as ready for review July 28, 2021 10:29
@samuelfangjw
Copy link
Member Author

So sorry, i've taken a more thorough look and believe I have fixed all the text overflow issues.

Copy link
Contributor

@ChooJeremy ChooJeremy left a comment

Choose a reason for hiding this comment

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

LGTM; thanks for the help in searching through which pages to update and ensuring they all support this feature!

@ChooJeremy ChooJeremy added s.FinalReview The PR is ready for final review and removed s.ToReview The PR is waiting for review(s) labels Jul 29, 2021
Copy link
Contributor

@rrtheonlyone rrtheonlyone left a comment

Choose a reason for hiding this comment

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

LGTM 💯 Thanks for the work @samuelfangjw and thorough review @ChooJeremy

@ccyccyccy ccyccyccy added s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.FinalReview The PR is ready for final review labels Aug 6, 2021
@wkurniawan07
Copy link
Member

@samuelfangjw can you resolve the new test failures?

M chosen because it is the widest possible letter.

It's W, actually, although the difference is rather minor 😄

@wkurniawan07 wkurniawan07 added this to the V8.0.0 milestone Aug 7, 2021
@wkurniawan07 wkurniawan07 added the c.Feature User-facing feature; can be new feature or enhancement to existing feature label Aug 7, 2021
@samuelfangjw
Copy link
Member Author

@samuelfangjw can you resolve the new test failures?

M chosen because it is the widest possible letter.

It's W, actually, although the difference is rather minor 😄

@wkurniawan07 Test failures have been resolved!

@wkurniawan07 wkurniawan07 merged commit eb550ce into TEAMMATES:master Aug 7, 2021
@samuelfangjw samuelfangjw deleted the 4552-course-name-id-max-length branch August 17, 2021 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c.Feature User-facing feature; can be new feature or enhancement to existing feature s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase course ID, course name, and session name max length
7 participants