Skip to content

Commit

Permalink
Merge pull request #1159 from vuvanhieu143/patch-1
Browse files Browse the repository at this point in the history
Update Inplace editable docs with new events and template
  • Loading branch information
andrewnicols authored Nov 12, 2024
2 parents 65c719f + d9c8abe commit 1a2561b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 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 @@ -324,8 +324,8 @@ 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) => {
require(['jquery', 'core/local/inplace_editable/events'], function(\$, Events) {
$('body').on(Events.eventTypes.elementUpdateFailed, '[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(Events.eventTypes.elementUpdated, '[data-inplaceeditable]', (e) => {
// Everything that web service returned.
const ajaxreturn = e.ajaxreturn;

Expand Down
10 changes: 5 additions & 5 deletions versioned_docs/version-4.3/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 @@ -324,8 +324,8 @@ 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) => {
require(['jquery', 'core/local/inplace_editable/events'], function(\$, Events) {
$('body').on(Events.eventTypes.elementUpdateFailed, '[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(Events.eventTypes.elementUpdated, '[data-inplaceeditable]', (e) => {
// Everything that web service returned.
const ajaxreturn = e.ajaxreturn;

Expand Down
10 changes: 5 additions & 5 deletions versioned_docs/version-4.4/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 @@ -324,8 +324,8 @@ 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) => {
require(['jquery', 'core/local/inplace_editable/events'], function(\$, Events) {
$('body').on(Events.eventTypes.elementUpdateFailed, '[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(Events.eventTypes.elementUpdated, '[data-inplaceeditable]', (e) => {
// Everything that web service returned.
const ajaxreturn = e.ajaxreturn;

Expand Down
10 changes: 5 additions & 5 deletions versioned_docs/version-4.5/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 @@ -324,8 +324,8 @@ 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) => {
require(['jquery', 'core/local/inplace_editable/events'], function(\$, Events) {
$('body').on(Events.eventTypes.elementUpdateFailed, '[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(Events.eventTypes.elementUpdated, '[data-inplaceeditable]', (e) => {
// Everything that web service returned.
const ajaxreturn = e.ajaxreturn;

Expand Down

0 comments on commit 1a2561b

Please sign in to comment.