Skip to content

Commit

Permalink
Bug fixes - DES-852
Browse files Browse the repository at this point in the history
  • Loading branch information
vasanthlmsace committed Mar 19, 2024
1 parent 6b9b6f8 commit be79518
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion amd/build/designer_section.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amd/build/designer_section.min.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions amd/src/designer_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@
* @param {bool} videoTime
* @param {bool} issubpanel
*/
let DesignerSection = function(courseId, contextId, popupActivities, videoTime, issubpanel) {
let DesignerSection = function(courseId, contextId, popupActivities, videoTime, issubpanel, sectionreturn) {
var self = this;
self.courseId = courseId;
self.contextId = contextId;
self.popupActivities = popupActivities;
self.videoTime = videoTime;
self.isSubpanel = issubpanel;
self.sectionReturn = sectionreturn;

$(".course-info-block .carousel .carousel-item:nth-child(1)").addClass('active');
$(".course-info-block #courseStaffinfoControls.carousel").addClass('active');
Expand Down Expand Up @@ -314,6 +315,7 @@
{
id: sectionid,
courseid: self.courseId,
sr: self.sectionReturn,
}
);
promise.then((html, js) => {
Expand All @@ -336,8 +338,8 @@
};

return {
init: function(courseId, contextId, popupActivities, videoTime, issubpanel) {
return new DesignerSection(courseId, contextId, popupActivities, videoTime, issubpanel);
init: function(courseId, contextId, popupActivities, videoTime, issubpanel, sectionreturn) {
return new DesignerSection(courseId, contextId, popupActivities, videoTime, issubpanel, sectionreturn);
}
};
});
19 changes: 15 additions & 4 deletions classes/output/courseformat/content/section/controlmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public function export_for_template(\renderer_base $output): stdClass {

$section = $this->section;

$hassectiontypes = true;
if (($this->course->coursedisplay == COURSE_DISPLAY_MULTIPAGE && !$this->format->get_section_number())
|| $this->course->coursetype == DESIGNER_TYPE_FLOW) {
$hassectiontypes = false;
}

$controls = $this->section_control_items();

if (empty($controls)) {
Expand Down Expand Up @@ -140,7 +146,7 @@ public function export_for_template(\renderer_base $output): stdClass {
'id' => $section->id,
'seciontypes' => $sectiontypes,
'is_subpanel' => format_designer_is_support_subpanel(),
'hassectiontypes' => ($this->course->coursetype != DESIGNER_TYPE_FLOW),
'hassectiontypes' => $hassectiontypes,
];

return $data;
Expand All @@ -153,7 +159,6 @@ public function export_for_template(\renderer_base $output): stdClass {
* method is almost a clone of the previous section_control_items from the course/renderer.php.
*
* This method must remain public until the final deprecation of section_edit_control_items.
*
* @return array of edit control items
*/
public function section_control_items() {
Expand Down Expand Up @@ -191,9 +196,15 @@ public function section_control_items() {
'attr' => ['class' => 'icon edit'],
];

if (format_designer_is_support_subpanel() && $course->coursetype != DESIGNER_TYPE_FLOW) {
$hassectiontypes = true;
if (($this->course->coursedisplay == COURSE_DISPLAY_MULTIPAGE && !$this->format->get_section_number())
|| $this->course->coursetype == DESIGNER_TYPE_FLOW) {
$hassectiontypes = false;
}

if (format_designer_is_support_subpanel() && $hassectiontypes) {
$controls['sectionlayout'] = new action_menu_subpanel(
'Section Layout',
get_string('strsectionlayout', 'format_designer'),
$this->get_choice_list($section),
['data-value' => 'section-designer-action'],
new pix_icon('t/hide', '', 'moodle', ['class' => 'iconsmall'])
Expand Down
3 changes: 1 addition & 2 deletions classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function render_content($widget) {
}
$data->startid = $startid;
$data->issectionpageclass = ($data->initialsection->sectionreturnid != 0) ? 'section-page-layout' : '';

if (!format_designer_has_pro()) {
$data->headermetadata = $this->course_header_metadata_details($course);
}
Expand Down Expand Up @@ -1419,7 +1419,6 @@ public function course_section_updated(
$output = $this->page->get_renderer('format_designer');
$sectionclass = $format->get_output_classname('content\\section');
$sectionobj = new $sectionclass($format, $section);
$format->set_section_number($section->section);
return $this->render_from_template('format_designer/section',
$sectionobj->export_for_template($output));
}
Expand Down
1 change: 1 addition & 0 deletions lang/en/format_designer.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,4 @@
$string['purposeclass'] = "Custom class for styling";
$string['sectionlink'] = 'Permalink';
$string['courseindicator'] = "Course status: ";
$string['strsectionlayout'] = "Section Layout";
1 change: 1 addition & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,7 @@ function format_designer_extend_navigation_course($navigation, $course, $context
'popupactivities' => $ispopupactivities,
'isvideotime' => $isvideotime,
'issubpanel' => format_designer_is_support_subpanel(),
'sectionreturn' => optional_param('section', 0, PARAM_INT),
];
$PAGE->requires->js_call_amd('format_designer/designer_section', 'init', $jsparams);

Expand Down
3 changes: 2 additions & 1 deletion tests/behat/behat_format_designer.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public function i_check_heroactivity_not_in_the_position($name, $pos): void {
*
* @Given /^I set the designer manual completion$/
* @throws DriverException The step is not available when Javascript is disabled
* @param string $selector
*/
public function i_set_the_manual_completion() {
global $CFG;
Expand All @@ -139,7 +140,7 @@ public function i_set_the_manual_completion() {
*
* @Given /^I set the designer completion expected "(?P<value>(?:[^"]|\\")*)"$/
* @throws DriverException The step is not available when Javascript is disabled
* @param string $value
* @param string $selector
*/
public function i_set_completion_expected($value) {
global $CFG;
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024022600; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024031900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version.
$plugin->component = 'format_designer'; // Full name of the plugin (used for diagnostics).
$plugin->release = 'Version 1.5';
Expand Down

0 comments on commit be79518

Please sign in to comment.