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

Update Inplace editable docs with new events and template #1159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions docs/apis/subsystems/output/inplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class inplace_edit_select extends \core\output\inplace_editable {
$renderer = $PAGE->get_renderer('core');
$inplaceedit = new tool_mytest\local\inplace_edit_text($record);
$params = $inplaceedit->export_for_template($renderer);
echo $OUTPUT->render_from_template('core/inplace_edit', $params);
echo $OUTPUT->render_from_template('core/inplace_editable', $params);
```

</div>
Expand All @@ -284,7 +284,7 @@ $params = $inplaceedit->export_for_template($renderer);
```

```js title="The params are transferred via webservice and are then processed by JavaScript"
Templates.renderForPromise('core/inplace_edit', params)
Templates.renderForPromise('core/inplace_editable', params)
.then(({html, js}) => {
Templates.replaceNodeContents('nodeid', html, js);
return true;
Expand Down Expand Up @@ -325,7 +325,7 @@ Plugin page can listen to JQuery events that are triggered on successful update
```php
$PAGE->requires->js_amd_inline("
require(['jquery'], function(\$) {
$('body').on('updatefailed', '[data-inplaceeditable]', (e) => {
$('body').on('event:core/inplace_editable:updateFailed', '[data-inplaceeditable]', (e) => {
// The exception object returned by the callback.
const exception = e.exception;

Expand All @@ -337,7 +337,7 @@ require(['jquery'], function(\$) {

// Do your own error processing here.
});
$('body').on('updated', '[data-inplaceeditable]', (e) => {
$('body').on('core/inplace_editable:updated', '[data-inplaceeditable]', (e) => {
// Everything that web service returned.
const ajaxreturn = e.ajaxreturn;

Expand Down
Loading