Skip to content

Commit

Permalink
Fix bulk editing tools.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Jun 15, 2023
1 parent 1838085 commit 870d4f1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
14 changes: 14 additions & 0 deletions classes/output/courseformat/content/section/cmlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,18 @@ class cmlist extends \core_courseformat\output\local\content\section\cmlist {
public function get_template_name(\renderer_base $renderer): string {
return 'format_vsf/local/content/section/cmlist';
}

/**
* Export this data so it can be used as the context for a mustache template.
*
* @param renderer_base $output typically, the renderer that's calling this function
* @return array data context for a mustache template
*/
public function export_for_template(\renderer_base $output): \stdClass {
global $PAGE;
$data = parent::export_for_template($output);
$data->editing = $PAGE->user_is_editing();

return $data;
}
}
16 changes: 15 additions & 1 deletion templates/local/content/cm.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,24 @@
Different from core only in respect of adding an 'indent'.
}}
{{#editing}}
<div class="divider divider-plus bulk-hidden" data-action="insert-before-{{activityname}}">
{{> core_course/activitychooserbuttonactivity}}
</div>
{{/editing}}
<div class="activity-item{{#modstealth}} hiddenactivity{{/modstealth}}{{!
}}{{#modhiddenfromstudents}} hiddenactivity{{/modhiddenfromstudents}}{{!
}}{{#indent}} indent-{{indent}}{{/indent}}{{#hugeindent}} indent-huge{{/hugeindent}}{{!
}}{{#modinline}} activityinline{{/modinline}}" data-activityname="{{activityname}}"{{!
}}>
{{> core_courseformat/local/content/cm/activity }}
{{$ core_courseformat/local/content/cm/bulkselect }}
{{> core_courseformat/local/content/cm/bulkselect }}
{{/ core_courseformat/local/content/cm/bulkselect }}
{{!
Place the actual content of the activity-item in a separate template to make it easier for other formats to add
additional content to the activity wrapper.
}}
{{$ core_courseformat/local/content/cm/activity }}
{{> core_courseformat/local/content/cm/activity }}
{{/ core_courseformat/local/content/cm/activity }}
</div>

0 comments on commit 870d4f1

Please sign in to comment.