mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 23:20:09 +01:00
Merge branch 'MDL-79623-MOODLE_401_STABLE' of https://github.com/PhMemmel/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
7ff2d18b93
@ -16,7 +16,7 @@ to the element that will trigger the confirmation modal.
|
||||
|
||||
## Source files
|
||||
|
||||
* `lib/amd/src/confirm.js` ({{< jsdoc module="core/confirm" >}})
|
||||
* `lib/amd/src/utility.js` ({{< jsdoc module="core/utility" >}})
|
||||
* `lib/templates/modal.mustache`
|
||||
|
||||
## Usage
|
||||
@ -24,7 +24,7 @@ The confirmation AMD module is loaded automatically, so the only thing you need
|
||||
to the target element:
|
||||
{{< highlight html >}}
|
||||
<button type="button" class="btn btn-primary" data-confirmation="modal" data-confirmation-title-str='["delete", "core"]'
|
||||
data-confirmation-question-str='["areyousure"]' data-confirmation-yes-button-str='["delete", "core"]'>Show confirmation modal</button>
|
||||
data-confirmation-content-str='["areyousure"]' data-confirmation-yes-button-str='["delete", "core"]'>Show confirmation modal</button>
|
||||
{{< /highlight >}}
|
||||
|
||||
You can also use it on PHP, you just need to set the attributes parameter to any moodle output component that takes attributes:
|
||||
@ -32,7 +32,7 @@ You can also use it on PHP, you just need to set the attributes parameter to any
|
||||
echo $OUTPUT->single_button('#', get_string('delete'), 'get', [
|
||||
'data-confirmation' => 'modal',
|
||||
'data-confirmation-title-str' => json_encode(['delete', 'core']),
|
||||
'data-confirmation-question-str' => json_encode(['areyousure']),
|
||||
'data-confirmation-content-str' => json_encode(['areyousure']),
|
||||
'data-confirmation-yes-button-str' => json_encode(['delete', 'core'])
|
||||
]);
|
||||
{{< / php >}}
|
||||
@ -56,8 +56,8 @@ echo $OUTPUT->single_button('#', get_string('delete'), 'get', [
|
||||
<td>The modal title language string identifier, must be provided in JSON encoded format.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>data-confirmation-question-str</td>
|
||||
<td>The confirmation question language string identifier, must be provided in JSON encoded format.</td>
|
||||
<td>data-confirmation-content-str</td>
|
||||
<td>The confirmation modal main content language string identifier, must be provided in JSON encoded format.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>data-confirmation-yes-button-str</td>
|
||||
@ -84,14 +84,14 @@ echo $OUTPUT->single_button('#', get_string('delete'), 'get', [
|
||||
|
||||
{{< example >}}
|
||||
<button type="button" class="btn btn-primary" data-confirmation="modal" data-confirmation-title-str='["delete", "core"]'
|
||||
data-confirmation-question-str='["areyousure"]' data-confirmation-yes-button-str='["delete", "core"]'>Show confirmation modal</button>
|
||||
data-confirmation-content-str='["areyousure"]' data-confirmation-yes-button-str='["delete", "core"]'>Show confirmation modal</button>
|
||||
{{< /example >}}
|
||||
|
||||
### Confirmation modal with a toast
|
||||
|
||||
{{< example >}}
|
||||
<button type="button" class="btn btn-primary" data-confirmation="modal" data-confirmation-title-str='["delete", "core"]'
|
||||
data-confirmation-question-str='["areyousure"]' data-confirmation-yes-button-str='["delete", "core"]' data-confirmation-toast="true"
|
||||
data-confirmation-content-str='["areyousure"]' data-confirmation-yes-button-str='["delete", "core"]' data-confirmation-toast="true"
|
||||
data-confirmation-toast-confirmation-str='["deleteblockinprogress", "block", "Online users"]'>Show confirmation modal</button>
|
||||
{{< /example >}}
|
||||
|
||||
@ -99,6 +99,6 @@ data-confirmation-toast-confirmation-str='["deleteblockinprogress", "block", "On
|
||||
|
||||
{{< example >}}
|
||||
<button type="button" class="btn btn-primary" data-confirmation="modal" data-confirmation-title-str='["delete", "core"]'
|
||||
data-confirmation-question-str='["areyousure"]' data-confirmation-yes-button-str='["delete", "core"]'
|
||||
data-confirmation-content-str='["areyousure"]' data-confirmation-yes-button-str='["delete", "core"]'
|
||||
data-confirmation-destination="http://moodle.com">Show confirmation modal</button>
|
||||
{{< /example >}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user