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
[#4552] Increase course ID, course name, and session name max length #11277
Conversation
Nice work @samuelfangjw I have no issues with the UI changes you have posted. |
@@ -1,3 +1,8 @@ | |||
.margin-0 { | |||
margin: 0; | |||
} | |||
|
|||
.td-text-break { |
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.
Could we use bootstrap's text-break
instead?
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.
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.
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?
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.
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.
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.
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.
src/web/app/pages-session/session-submission-page/session-submission-page.component.scss
Show resolved
Hide resolved
@@ -1,3 +1,8 @@ | |||
.margin-0 { | |||
margin: 0; | |||
} | |||
|
|||
.td-text-break { |
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.
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.
@ccyccyccy @ChooJeremy Thanks for the review, I've taken your suggestions and moved the class to the global |
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.
src/web/styles.scss
Outdated
// 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 { |
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.
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
?
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.
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!
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.
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!
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.
Found further issues:
Within the admin search page, searching for the course:
On trying to create a new feedback session, copying from previous feedback session.
On trying to edit a feedback session, copying a question from another feedback question:
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.
src/web/styles.scss
Outdated
@@ -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. |
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.
Your solution seems to work. Do remember to update the comment as well.
# 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
So sorry, i've taken a more thorough look and believe I have fixed all the text overflow issues. |
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.
LGTM; thanks for the help in searching through which pages to update and ensuring they all support this feature!
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.
LGTM 💯 Thanks for the work @samuelfangjw and thorough review @ChooJeremy
@samuelfangjw can you resolve the new test failures?
It's W, actually, although the difference is rather minor 😄 |
@wkurniawan07 Test failures have been resolved! |
Fixes #4552
Outline of Solution
Increased max length as follows:
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.
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.
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.
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 atd-text-break
class with the same css properties to workaround this issue.