-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update notice tips icon image * Add sensei-quiz-notices pattern * Fix success message on lesson without module * Using server-side rendering with the `render_block_` hook to replace the text on the lesson quiz notice. * Remove Awaiting grade text element * Update grade style on the lesson page * Using server-side rendering to customize the quiz actions.
- Loading branch information
Showing
6 changed files
with
202 additions
and
12 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
wp-content/themes/pub/wporg-learn-2024/patterns/sensei-quiz-notices.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* Title: Sensei Quiz Notices | ||
* Slug: wporg-learn-2024/sensei-quiz-notices | ||
* Inserter: no | ||
* | ||
* @package wporg-learn-2024 | ||
*/ | ||
|
||
$lesson_id = Sensei()->quiz->get_lesson_id(); | ||
$course_id = Sensei()->lesson->get_course_id( $lesson_id ); | ||
$is_learning_mode = Sensei_Course_Theme_Option::has_learning_mode_enabled( $course_id ); | ||
$is_awaiting_grade = Sensei_Quiz::is_quiz_awaiting_grade_for_user( $lesson_id, get_current_user_id() ); | ||
$is_pending_grade = $is_learning_mode && $is_awaiting_grade; | ||
$is_from_lesson = strpos( $_SERVER['HTTP_REFERER'], '/lesson/' ) !== false; | ||
|
||
?> | ||
|
||
<?php if ( $is_pending_grade && $is_from_lesson ) : ?> | ||
<!-- wp:wporg/notice {"type":"info","style":{"spacing":{"margin":{"top":0,"bottom":"var:preset|spacing|40"}}}} --> | ||
<div class="wp-block-wporg-notice is-info-notice" style="margin-top:-10px;margin-bottom:var(--wp--preset--spacing--40)"> | ||
<div class="wp-block-wporg-notice__icon"></div> | ||
<div class="wp-block-wporg-notice__content"> | ||
<p><?php esc_html_e( 'This quiz won’t be graded. If you found the questions easy, you likely understand the lesson well.', 'wporg-learn' ); ?></p> | ||
</div> | ||
</div> | ||
<!-- /wp:wporg/notice --> | ||
<?php elseif ( $is_pending_grade ) : ?> | ||
<!-- wp:wporg/notice {"style":{"spacing":{"margin":{"top":0,"bottom":"var:preset|spacing|40"}}}} --> | ||
<div class="wp-block-wporg-notice is-tip-notice" style="margin-top:-10px;margin-bottom:var(--wp--preset--spacing--40)"> | ||
<div class="wp-block-wporg-notice__icon"></div> | ||
<div class="wp-block-wporg-notice__content"> | ||
<p><?php esc_html_e( 'Well done! You completed the quiz.', 'wporg-learn' ); ?></p> | ||
</div> | ||
</div> | ||
<!-- /wp:wporg/notice --> | ||
<?php else : ?> | ||
<!-- wp:sensei-lms/course-theme-notices /--> | ||
<?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters