-
Notifications
You must be signed in to change notification settings - Fork 9
Feature/CSL-2007/CSL-2040 group 1 and 2 enhanced tooltips #328
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
Feature/CSL-2007/CSL-2040 group 1 and 2 enhanced tooltips #328
Conversation
- add content for 'view' and 'readaloud' popovers - switch to popover styles and classes
Converted tooltips to popovers for settings, wordbank, switch, context, book_actions, and activity.
… start of chainable tour
The `kind` field denotes whether the tip is a popup tooltip or a dialog popover. The latter are associated with "robust tooltips" and tours.
- the `kind` of tip -- tooltip vs dialog -- is not used anywhere; remove for now. - fix the name of the settings teacher resource to link to in the `popover_tour.html` template.
The migrations cancel each other. The first adds a `kind` field to the `TipType` model while the second removes it.
… if only one in chain
…S. Stopgap for refocus of control
…e/CSL-2040-group-2-enhanced-tooltips
Added: - reading_details (Active Reading time and Details), - reading_data (Student reading data), - cluey, but only partially (Cluey), - thoughts (Your thoughts). With respect to Cluey, the popover dialog is ready, but there is no target element to attach the popover to. See comment in CSL-2040: https://castudl.atlassian.net/browse/CSL-2040?focusedCommentId=36759
Also, remove debugging `pdb` statements.
|
@bgoldowsky , while I've marked this as "ready for review", there are changes to both the kind of tip for Cluey, and its content. It looks like it will revert to an actual tooltip that is shown on mouse hover, and not a spontaneous display that depends on the history of when it was last shown. See Kristen's comment in the JIRA. Given that change, I need to at least change the logic for showing Cluey's popover, likely remove it from that logic. |
|
Based on a conversation with Kristen in the JIRA for CSL-2007, the group 2 Active Reading time and Details is a duplicate of the group 1 Tooltip_student activity. The latter is a replacement for an existing tooltip and implemented in PR #323. The former was implemented in this PR as a new popover. I will remove the new popover from here. This entails removing a The conversation in the JIRA starts with a note that the group 1 popover is missing from the Dashboard tour. |
…ned" and "Popular" tabs on the teacher Dashboard
…the `student_reactions` tip type
|
@bgoldowsky @mbrambilla This is ready for review. All the group 1 and group 2 "enhanced tooltips" are in place, including the recent two for the student Dashboard. The last code I added was a couple of unit tests for changes I made to As we discussed at the technical meeting, this PR is ready to merge @mbrambilla's code from PR #333 into it. Alternatively, this could be reviewed and merged for Q/A while the tour work continues on its branch. Let me know how you think we should proceed. |
…tamp When `register_show()` is called with a timestamp that is earlier than the current history's `last_show`, the value of `last_show` should not change.
The relevance of a tip history's `last_show` time's seconds and microseconds are minor. and are excluded from one test.
src/library/views.py
Outdated
| context = super().get_context_data(**kwargs) | ||
| context['search_form'] = self.search_form | ||
| context['tip_name'] = self.tip_shown.name if self.tip_shown else None | ||
| # BEGIN: Sample Tour |
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.
Is this a sample, as opposed to something that should remain for production use?
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.
This is kind of a hybrid mode between the tooltips (tip_name) and the popovers (tours). This has been cleaned up in PR #336. I was originally planning on add the tour chains into the original PR, but things forked in two different directions into this PR and then the tour PR.
src/pages/views.py
Outdated
| context['tip_name'] = self.tip_shown.name if self.tip_shown else None | ||
| context['clusive_user'] = self.clusive_user | ||
| # BEGIN: Sample Tour | ||
| # Sample tour with single item list |
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.
sample?
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.
Transitional hybrid mode resulting from trying to do too much in one PR, cleaned up in PR #336.
src/pages/views.py
Outdated
| 'cuelist': json.dumps(cuelist), | ||
| 'hide_cues': hide_cues, | ||
| 'tip_name': self.tip_shown.name if self.tip_shown else None, | ||
| # BEGIN: Sample Tour |
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.
sample?
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.
Transitional hybrid mode resulting from trying to do too much in one PR, cleaned up in PR #336.
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.
What are the implications for this PR, then? Is it simply a matter of removing the "sample tour" comments? It goes back to the issue of whether the singleton popovers can be merged vs. combining this branch with the tour branch.
src/tips/models.py
Outdated
| """Test whether this tip can be shown on a particular page""" | ||
| # Teacher/parent-only tips | ||
| if user.role == Roles.STUDENT and self.name in ['book_actions', 'activity']: | ||
| if user.role == Roles.STUDENT and self.name in TEACHER_ONLY_TIPS: |
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.
Also Roles.GUEST or use something like "not user.can_manage_periods". Currently guests are being assigned teacher-only tips.
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 should have included a GUEST user in the tests. When GUEST is tested, the TipType.can_show() fails for the activity tip on the Dashboard.
By implication, teacher tips should also show for guests using the current version in production where only book_actions and activity tips are checked in TipType.can_show(). Do book_actions or activity tooltip pop-up for guests? I suspect not because the Dashboard for guests does no include the relevant activity panel nor the book_actions menu. As such, there is nothing for the tooltip to point to.
But, in the current situation, there are more TEACHER_ONLY_TIPS some of whose targets appear for guest users. So, I'll check for guest users.
src/tips/models.py
Outdated
| if self.name == 'switch': | ||
| return page == 'Reading' and version_count > 1 | ||
| # Thoughts TipType is only for students | ||
| if self.name == 'thoughts' and user.role != Roles.STUDENT: |
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.
Also GUEST, see above.
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.
Right.
| </div> | ||
| {% elif tour_name == "book_actions" %} | ||
| <!-- book_actions --> | ||
| {% if clusive_user.role == 'TE' %} |
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.
This file with all of its 'if' statements feels extremely fragile, it would be great to do some refactoring. Why is this one just TE, while most are TE or PA? Is there some reason that parents should not get to see the video?
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.
Yeah, I'll see if I can refactor and simplify the template. As for the missing "or PA", that's something like a copy-paste error.
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.
@mbrambilla what kind of grief am I going to cause you due to a refactoring of the popover_tour.html template?
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.
@klown Most of my refactoring in popover_tour.html was around the 'footer' section, as seen here - you will need to click the 'load diff' link to see the changes: #336 - popover_tour.html
The goal was to create a re-usable template for the footer section to reduce redundant template markup.
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.
Thanks @mbrambilla. I thought about merging just your footer change into this PR, but it has features that don't apply here or might break things. I'll work on making a suitable version. Since that is where most of your refactoring was done, it should make merge conflicts smaller.
🤞
| <p>Click “More actions” (three dots) to assign or customize any book, and for books you uploaded to Clusive, to edit information or delete a book.</p> | ||
| <div class="row gx-0_5 flex-items-center"> | ||
| <div class="col"> | ||
| {% if has_teacher_resource %} |
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.
What is the purpose of passing in the 'has_teacher_resource' variable, given that this template has hard-coded the URL of any teacher resource that exists already? In this case, has_teacher_resource is passed in as false by LibraryView. Clearly there is one, but the link is not displayed.
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 general rationale of has_teacher_resource was flexibility in showing the link. It should have been named has_teacher_resource_link or, even better, show_teacher_resource_link.
Admittedly it's somewhat muddled in that the link is not shown for student and guest users, somthing that could be handled by show_teacher_resource_link. But the template covers that situation by the check for a TE or PA role*.
Still, there are cases where the user is a teacher or a parent and the link should not be shown. For example, if the user has navigated to the Manage page and the Manage popover shows, the link in the popover is odd since it just navigates to the page the user is viewing. It should not be shown in this case.
As for the Library case, that's a bug; it should not be false.
*Perhaps this is part of the refactoring: Move the role check logic to views.py to set show_teacher_resource_link and then use only that boolean in the template. It would remove some clutter.
|
The PR is a little confusing because it contains things related to the tour, but doesn't actually implement the tour. So I think things like the 'tour samples' passed in context variables are harmless, but hope they will be cleaned up in the next PR. There are defintely some logic errors, mostly due to checking for STUDENT or TEACHER but forgetting about GUEST and PARENT. |
Some of the logic for showing the "Learn more" link is in the popover dialog footer template -- if the page requested and the "Learn more" link are the same, do not show the link.
|
@boris, @mbrambrilla, I have made changes in response to the review comments, mainly to refactor and reorganize the In addition, I noticed another page that was not included in the show-tip logic. The page is the |
|
Regarding more refactoring, I think there is a structure for each popover along the following lines: It's a lookup-table where each tip type (e.g., In that case, I think the template's |
|
I wrote:
I pushed a version of this approach to another branch based on this one. This shows the markup for all but one of the popover dialogs. The |
Allow the test to pass if the actual time is within a minute of the expected time since, in reality, the actual time is later than the time passed in when set.
Create the "group 2" popover dialogs and define their targets such that they show when the relevant page is loaded, and the criteria for showing them is met.
Note that since this PR is an extension of the group 1 popovers, it is based on and includes the changes in PR #323. Going forward this PR will track changes for both group 1 and group 2 enhanced tooltips.
JIRAs: