1441 |
ariadna |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
4 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
it under the terms of the GNU General Public License as published by
|
|
|
6 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
(at your option) any later version.
|
|
|
8 |
|
|
|
9 |
Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
GNU General Public License for more details.
|
|
|
13 |
|
|
|
14 |
You should have received a copy of the GNU General Public License
|
|
|
15 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
}}
|
|
|
17 |
{{!
|
|
|
18 |
@template core/task_indicator
|
|
|
19 |
|
|
|
20 |
Display the stored progress of a background task and optionally redirect when it is complete.
|
|
|
21 |
|
|
|
22 |
Example context (json):
|
|
|
23 |
{
|
|
|
24 |
"heading": "Regrade in progress",
|
|
|
25 |
"icon": {
|
|
|
26 |
"attributes": [
|
|
|
27 |
{"name": "src", "value": "/pix/i/timer.svg"},
|
|
|
28 |
{"name": "alt", "value": ""}
|
|
|
29 |
]
|
|
|
30 |
},
|
|
|
31 |
"message": "Grades are being recalculated due to recent changes.",
|
|
|
32 |
"progress": {
|
|
|
33 |
"id": "progressbar_test",
|
|
|
34 |
"message": "Recalculating grades",
|
|
|
35 |
"idnumber": "progressbar_test",
|
|
|
36 |
"class": "stored-progress-bar",
|
|
|
37 |
"width": "500",
|
|
|
38 |
"value": "50"
|
|
|
39 |
}
|
|
|
40 |
}
|
|
|
41 |
}}
|
|
|
42 |
<div class="task-indicator {{extraclasses}}">
|
|
|
43 |
<div class="text-center">
|
|
|
44 |
{{#icon}}
|
|
|
45 |
<div>
|
|
|
46 |
{{>core/pix_icon}}
|
|
|
47 |
</div>
|
|
|
48 |
{{/icon}}
|
|
|
49 |
<h2>{{heading}}</h2>
|
|
|
50 |
<p>{{message}}</p>
|
|
|
51 |
</div>
|
|
|
52 |
{{#runurl}}
|
|
|
53 |
<p class="text-center">
|
|
|
54 |
<a class="runlink btn btn-primary" href="{{runurl}}" data-idnumber="{{progress.idnumber}}">{{runlabel}}</a>
|
|
|
55 |
</p>
|
|
|
56 |
{{/runurl}}
|
|
|
57 |
{{#progress}}
|
|
|
58 |
{{>core/progress_bar}}
|
|
|
59 |
{{/progress}}
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
</div>
|
|
|
63 |
|
|
|
64 |
{{#js}}
|
|
|
65 |
require(['core/task_indicator'], function(TaskIndicator) {
|
|
|
66 |
TaskIndicator.init('{{progress.idnumber}}', '{{redirecturl}}');
|
|
|
67 |
});
|
|
|
68 |
{{/js}}
|