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

Displaying if a lesson in the syllabus has a quiz, assignment, or both #2802

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelogs/syllabus-lesson-has-quiz-assignment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
significance: minor
type: added
entry: Showing 'Has Quiz' or 'Has Assignment' in the Course Syllabus.
9 changes: 9 additions & 0 deletions assets/scss/frontend/_syllabus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@

.llms-main {
flex-grow: 1;

span.llms-lesson-has-quiz,
span.llms-lesson-has-assignment {
font-size: 14px;
}

span.llms-lesson-has-quiz + span.llms-lesson-has-assignment {
margin-left: 10px;
}
}
.llms-extra {
min-width: 50px;
Expand Down
25 changes: 25 additions & 0 deletions templates/course/lesson-preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,31 @@
do_action( 'llms_lesson_preview_before_title', $lesson )
?>
<div class="llms-lesson-title"><?php echo esc_html( get_the_title( $lesson->get( 'id' ) ) ); ?></div>

<?php
$has_quiz = $lesson->is_quiz_enabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a huge deal but could we put this inline within the if rather than having a temp variable $has_quiz that we don't use again?

if ( $has_quiz ) {
?>
<span class="llms-lesson-has-quiz">
<i class="fa fa-question-circle"></i>
<?php esc_html_e( 'Has Quiz', 'lifterlms' ); ?>
</span>
<?php
}
?>

<?php
// Does the lesson have an assignment?
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 remove the "what" comment since the llms_lesson_has_assignment function shows this already? I've been cleaning up any what-type comments especially since the "what" can change and the comment doesn't get updated down the road.

if ( function_exists( 'llms_lesson_has_assignment' ) && llms_lesson_has_assignment( $lesson->get( 'id' ) ) ) {
?>
<span class="llms-lesson-has-assignment">
<i class="fa fa-pencil-square"></i>
<?php esc_html_e( 'Has Assignment', 'lifterlms' ); ?>
</span>
<?php
}
?>

<?php
/**
* Action fired before the lesson title in the lesson preview template.
Expand Down
Loading