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

Make the settings panel for the lesson appear when Add New Lesson clicked #2856

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
5 changes: 5 additions & 0 deletions .changelogs/fix_new-lesson-selected-course-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
significance: patch
type: fixed
links:
- "#2855"
entry: Open the lesson panel after adding a new lesson in the Course Builder.
17 changes: 13 additions & 4 deletions assets/js/builder/Views/Lesson.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ define( [
* @version 3.16.12
*/
events: _.defaults( {
'click .edit-lesson': 'open_lesson_editor',
'click .llms-headline': 'open_lesson_editor',
'click .edit-lesson': 'edit_lesson',
'click .llms-headline': 'edit_lesson',
'click .edit-quiz': 'open_quiz_editor',
'click .edit-assignment': 'open_assignment_editor',
'click .section-prev': 'section_prev',
Expand Down Expand Up @@ -88,7 +88,7 @@ define( [
this.listenTo( this.model, 'change', this.render );

Backbone.pubSub.on( 'lesson-selected', this.on_select, this );
Backbone.pubSub.on( 'new-lesson-added', this.on_select, this );
Backbone.pubSub.on( 'new-lesson-added', this.maybe_open_editor, this );

},

Expand Down Expand Up @@ -139,16 +139,25 @@ define( [
* @since 3.16.0
* @version 3.27.0
*/
open_lesson_editor: function( event ) {
edit_lesson: function( event ) {

if ( event ) {
event.preventDefault();
}

this.open_lesson_editor();
},

open_lesson_editor: function() {
Backbone.pubSub.trigger( 'lesson-selected', this.model, 'lesson' );
this.model.set( '_selected', true );
this.set_hash( false );
},

maybe_open_editor: function( model ) {
if ( this.model.id === model.id ) {
this.open_lesson_editor();
}
},

/**
Expand Down
2 changes: 2 additions & 0 deletions assets/js/builder/Views/LessonEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ define( [

this.render_points_percentage();

this.$('.llms-editable-title').focus();

return this;

},
Expand Down
Loading