sensei icon indicating copy to clipboard operation
sensei copied to clipboard

Add Course Actions block

Open donnapep opened this issue 2 years ago • 7 comments

Implements #5396

Changes proposed in this Pull Request

  • Adds new Continue Course and Course Actions blocks for pages.
  • The Course Actions block nests the Course Signup, Continue Course and View Results blocks as inner blocks.
  • Only the Start Course button is visible in the editor.
  • Fixes the visibility of the View Results button such that it's only visible if the student has completed the course. (It doesn't make sense to enable navigating to the course completed page if they haven't completed the course.)

Testing instructions

  • Add a Course List block to a page and set its Post Type setting to "Course".
  • Add the Course Actions block inside it.
  • Confirm that the Start Course button is visible for each course.
  • Publish the page and view it.
  • For a new course that you are not enrolled in, ensure the Start Course button is visible. Clicking it should enrol you in the course and take you to the course page.
  • For a course that you are enrolled in but have not completed, ensure the Continue button is visible. Clicking it should go to the course page.
  • For a course that you have completed, ensure the Visit Results button is visible. Clicking it should go to the Course Completed Page as defined in Sensei's settings.

Screenshot / Video

Screen Shot 2022-08-09 at 1 43 32 PM

donnapep avatar Aug 09 '22 17:08 donnapep

Codecov Report

Merging #5430 (ecb5aad) into feature/courses-list (4bc979d) will increase coverage by 0.05%. The diff coverage is 54.54%.

Impacted file tree graph

@@                    Coverage Diff                     @@
##             feature/courses-list    #5430      +/-   ##
==========================================================
+ Coverage                   44.54%   44.60%   +0.05%     
- Complexity                   8729     8733       +4     
==========================================================
  Files                         412      413       +1     
  Lines                       31123    31152      +29     
  Branches                      234      234              
==========================================================
+ Hits                        13865    13894      +29     
  Misses                      17085    17085              
  Partials                      173      173              
Impacted Files Coverage Δ
includes/blocks/class-sensei-page-blocks.php 0.00% <0.00%> (ø)
...udes/blocks/class-sensei-continue-course-block.php 68.18% <68.18%> (ø)
...ncludes/blocks/class-sensei-block-view-results.php 58.33% <100.00%> (+58.33%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f1528f8...ecb5aad. Read the comment docs.

codecov[bot] avatar Aug 09 '22 17:08 codecov[bot]

@donnapep Could you please assign the card using the Development Field? it enables the github board to show a reference to the PR

gabrielcaires avatar Aug 10 '22 12:08 gabrielcaires

@gabrielcaires

Currently I can update the text on the Start Course button, but I can't update the other texts, it seems a bit frustrating from the user perspective Should we remove the edit label feature from the Start Course and add it as a feature in future cards?

Good question. I'm looping in @Luchadores in on this one. For additional context, currently only the Start Course button is visible in the editor. I've explicitly hidden the other buttons as per the designs, but a side effect of this is that the button text for the Continue and Visit Results buttons are not editable. I wonder if we should perhaps implement something closer to how the Lesson Actions block behaves in the editor?

Screen Shot 2022-08-10 at 9 53 49 AM

On our mockups we have the button able to cover the full available space and today is not possible to do that. Should we have a card to enable us to do it? (Attached image)

Fixed in https://github.com/Automattic/sensei/pull/5430/commits/8e8e5b4c8915784e0f53b7ac2e42124801cb4ad9.

Should we block the user to add the old Course Sign block inside a course list ?

I want to change it so that the course signup and view results blocks can't be added from the inserter at all for pages, but this is proving challenging as per https://a8c.slack.com/archives/C02NWDZBL0H/p1660136008867649. We'll probably need a new card for it. @Imran92

donnapep avatar Aug 10 '22 15:08 donnapep

I want to change it so that the course signup and view results blocks can't be added from the inserter at all for pages, but this is proving challenging as per https://a8c.slack.com/archives/C02NWDZBL0H/p1660136008867649. We'll probably need a new card for it. @Imran92

Thank you @donnapep ☺️ Added it here. Can you kindly review it? I hope I got the details right. Following the same idea, I was thinking should this behavior be the same for our other inner blocks too? For example our Course Progress, Course Categories, our new and improved Course Action Button blocks?

Imran92 avatar Aug 10 '22 17:08 Imran92

Following the same idea, I was thinking should this behavior be the same for our other inner blocks too? For example our Course Progress, Course Categories, our new and improved Course Action Button blocks?

Yup, I imagine it will be the same for any Sensei blocks where knowing the course ID is critical to the proper functioning of the block.

donnapep avatar Aug 10 '22 18:08 donnapep

Hey @donnapep 👋

I've sync with @burtrw yesterday about this as well. While we believe users would love to be able to edit the text on the buttons, we also agree with being consistent. We also have different states for the buttons, depending on the state the student is in regarding each of the courses. So we are good for now to not have the buttons editable. 😄

Here is the screenshot of the different button states that I'm referring to above. image

Luchadores avatar Aug 11 '22 09:08 Luchadores

@Automattic/nexus All the feedback has been addressed and this PR could use a final review. 🙇🏻‍♀️

donnapep avatar Aug 11 '22 13:08 donnapep