mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
MDL-80259 theme_boost: Refactor badge helper classes for Bootstrap 5
This commit is contained in:
parent
810554ee83
commit
a198884333
93 changed files with 218 additions and 209 deletions
|
@ -53,7 +53,7 @@
|
|||
{{ if .Page.Params.tags }}
|
||||
{{ range .Page.Params.tags }}
|
||||
|
||||
<div class="badge badge-info">{{.}}</div>
|
||||
<div class="badge bg-info text-white">{{.}}</div>
|
||||
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -164,12 +164,12 @@ class data_request_exporter extends persistent_exporter {
|
|||
switch ($this->persistent->get('status')) {
|
||||
case api::DATAREQUEST_STATUS_PENDING:
|
||||
case api::DATAREQUEST_STATUS_PREPROCESSING:
|
||||
$values['statuslabelclass'] = 'badge-info';
|
||||
$values['statuslabelclass'] = 'bg-info text-white';
|
||||
// Request can be manually completed for general enquiry requests.
|
||||
$values['canmarkcomplete'] = $requesttype == api::DATAREQUEST_TYPE_OTHERS;
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_AWAITING_APPROVAL:
|
||||
$values['statuslabelclass'] = 'badge-info';
|
||||
$values['statuslabelclass'] = 'bg-info text-white';
|
||||
// DPO can review the request once it's ready.
|
||||
$values['canreview'] = true;
|
||||
// Whether the DPO can approve or deny the request.
|
||||
|
@ -180,24 +180,24 @@ class data_request_exporter extends persistent_exporter {
|
|||
}
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_APPROVED:
|
||||
$values['statuslabelclass'] = 'badge-info';
|
||||
$values['statuslabelclass'] = 'bg-info text-white';
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_PROCESSING:
|
||||
$values['statuslabelclass'] = 'badge-info';
|
||||
$values['statuslabelclass'] = 'bg-info text-white';
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_COMPLETE:
|
||||
case api::DATAREQUEST_STATUS_DOWNLOAD_READY:
|
||||
case api::DATAREQUEST_STATUS_DELETED:
|
||||
$values['statuslabelclass'] = 'badge-success';
|
||||
$values['statuslabelclass'] = 'bg-success text-white';
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_CANCELLED:
|
||||
$values['statuslabelclass'] = 'badge-warning';
|
||||
$values['statuslabelclass'] = 'bg-warning text-dark';
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_REJECTED:
|
||||
$values['statuslabelclass'] = 'badge-danger';
|
||||
$values['statuslabelclass'] = 'bg-danger text-white';
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_EXPIRED:
|
||||
$values['statuslabelclass'] = 'badge-secondary';
|
||||
$values['statuslabelclass'] = 'bg-secondary text-dark';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,12 +106,12 @@ class my_data_requests_page implements renderable, templatable {
|
|||
$cancancel = true;
|
||||
switch ($status) {
|
||||
case api::DATAREQUEST_STATUS_COMPLETE:
|
||||
$item->statuslabelclass = 'badge-success';
|
||||
$item->statuslabelclass = 'bg-success text-white';
|
||||
$item->statuslabel = get_string('statuscomplete', 'tool_dataprivacy');
|
||||
$cancancel = false;
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_DOWNLOAD_READY:
|
||||
$item->statuslabelclass = 'badge-success';
|
||||
$item->statuslabelclass = 'bg-success text-white';
|
||||
$item->statuslabel = get_string('statusready', 'tool_dataprivacy');
|
||||
$cancancel = false;
|
||||
$candownload = true;
|
||||
|
@ -122,12 +122,12 @@ class my_data_requests_page implements renderable, templatable {
|
|||
}
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_DELETED:
|
||||
$item->statuslabelclass = 'badge-success';
|
||||
$item->statuslabelclass = 'bg-success text-white';
|
||||
$item->statuslabel = get_string('statusdeleted', 'tool_dataprivacy');
|
||||
$cancancel = false;
|
||||
break;
|
||||
case api::DATAREQUEST_STATUS_EXPIRED:
|
||||
$item->statuslabelclass = 'badge-secondary';
|
||||
$item->statuslabelclass = 'bg-secondary text-dark';
|
||||
$item->statuslabel = get_string('statusexpired', 'tool_dataprivacy');
|
||||
$item->statuslabeltitle = get_string('downloadexpireduser', 'tool_dataprivacy');
|
||||
$cancancel = false;
|
||||
|
|
|
@ -59,13 +59,13 @@
|
|||
<span>{{#pix}}i/risk_xss, moodle, {{#str}}requiresattention, tool_dataprivacy{{/str}}{{/pix}}</span>
|
||||
{{/compliant}}
|
||||
{{#external}}
|
||||
<span class="badge badge-pill badge-notice">{{#str}}external, tool_dataprivacy{{/str}}</span>
|
||||
<span class="badge rounded-pill bg-info text-white">{{#str}}external, tool_dataprivacy{{/str}}</span>
|
||||
{{/external}}
|
||||
{{#deprecated}}
|
||||
<span class="badge badge-pill badge-warning">{{#str}}deprecated, tool_dataprivacy{{/str}}</span>
|
||||
<span class="badge rounded-pill bg-warning text-dark">{{#str}}deprecated, tool_dataprivacy{{/str}}</span>
|
||||
{{/deprecated}}
|
||||
{{#userlistnoncompliance}}
|
||||
<span class="badge badge-pill badge-warning">{{#str}}userlistnoncompliant, tool_dataprivacy{{/str}}</span>
|
||||
<span class="badge rounded-pill bg-warning text-dark">{{#str}}userlistnoncompliant, tool_dataprivacy{{/str}}</span>
|
||||
{{/userlistnoncompliance}}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -43,11 +43,11 @@
|
|||
<dl>
|
||||
<dt>{{#pix}}i/risk_xss, moodle, {{#str}}requiresattention, tool_dataprivacy{{/str}}{{/pix}}</dt>
|
||||
<dd>{{#str}}requiresattentionexplanation, tool_dataprivacy{{/str}}</dd>
|
||||
<dt><span class="badge badge-pill badge-notice">{{#str}}external, tool_dataprivacy{{/str}}</span></dt>
|
||||
<dt><span class="badge rounded-pill bg-info text-white">{{#str}}external, tool_dataprivacy{{/str}}</span></dt>
|
||||
<dd>{{#str}}externalexplanation, tool_dataprivacy{{/str}}</dd>
|
||||
<dt><span class="badge badge-pill badge-warning">{{#str}}deprecated, tool_dataprivacy{{/str}}</span></dt>
|
||||
<dt><span class="badge rounded-pill bg-warning text-dark">{{#str}}deprecated, tool_dataprivacy{{/str}}</span></dt>
|
||||
<dd>{{#str}}deprecatedexplanation, tool_dataprivacy{{/str}}</dd>
|
||||
<dt><span class="badge badge-pill badge-warning">{{#str}}userlistnoncompliant, tool_dataprivacy{{/str}}</span></dt>
|
||||
<dt><span class="badge rounded-pill bg-warning text-dark">{{#str}}userlistnoncompliant, tool_dataprivacy{{/str}}</span></dt>
|
||||
<dd>{{#str}}userlistexplanation, tool_dataprivacy{{/str}}</dd>
|
||||
</dl>
|
||||
<hr />
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"id": 1,
|
||||
"typename" : "Data export",
|
||||
"comments": "I would like to download all of my daughter's personal data",
|
||||
"statuslabelclass": "badge-secondary",
|
||||
"statuslabelclass": "bg-secondary text-dark",
|
||||
"statuslabel": "Pending",
|
||||
"timecreated" : 1517902087,
|
||||
"requestedbyuser" : {
|
||||
|
@ -47,7 +47,7 @@
|
|||
"id": 2,
|
||||
"typename" : "Data export",
|
||||
"comments": "Give me all of the information you have about me, or else...",
|
||||
"statuslabelclass": "badge-warning",
|
||||
"statuslabelclass": "bg-warning text-dark",
|
||||
"statuslabel": "Awaiting completion",
|
||||
"timecreated" : 1517902087,
|
||||
"requestedbyuser" : {
|
||||
|
@ -59,7 +59,7 @@
|
|||
"id": 3,
|
||||
"typename" : "Data deletion",
|
||||
"comments": "Please delete all of my son's personal data.",
|
||||
"statuslabelclass": "badge-success",
|
||||
"statuslabelclass": "bg-success text-white",
|
||||
"statuslabel": "Deleted",
|
||||
"timecreated" : 1517902087,
|
||||
"requestedbyuser" : {
|
||||
|
@ -83,7 +83,7 @@
|
|||
"id": 5,
|
||||
"typename" : "Data export",
|
||||
"comments": "Please let me download my data",
|
||||
"statuslabelclass": "badge-info",
|
||||
"statuslabelclass": "bg-info text-white",
|
||||
"statuslabel": "Processing",
|
||||
"timecreated" : 1517902087,
|
||||
"requestedbyuser" : {
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
"profileurl": "#"
|
||||
},
|
||||
"statuslabel": "Pending",
|
||||
"statuslabelclass": "badge-secondary",
|
||||
"statuslabelclass": "bg-secondary text-dark",
|
||||
"messagehtml": "<p>Hello,</p><p>I would like to download all of my personal data.</p><p>Thanks!</p>"
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
{{/comppath}}
|
||||
{{#usercompetencycourse}}
|
||||
{{#grade}}
|
||||
<span class="badge {{#proficiency}}badge-success{{/proficiency}}{{^proficiency}}badge-danger{{/proficiency}}">{{gradename}}</span>
|
||||
<span class="badge {{#proficiency}}bg-success{{/proficiency}}{{^proficiency}}bg-danger{{/proficiency}} text-white">{{gradename}}</span>
|
||||
{{/grade}}
|
||||
{{/usercompetencycourse}}
|
||||
{{#canmanagecoursecompetencies}}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
{{/actionuser}}
|
||||
<strong><time datetime="{{userdate}}">{{userdate}}</time></strong>
|
||||
{{#grade}}
|
||||
<p><span class="badge badge-info">{{gradename}}</span></p>
|
||||
<p><span class="badge bg-info text-white">{{gradename}}</span></p>
|
||||
{{/grade}}
|
||||
<p>{{description}}</p>
|
||||
{{#note}}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</td>
|
||||
<td>
|
||||
{{#isbasedontemplate}}
|
||||
<span class="badge badge-info">{{#str}}yes{{/str}}</span>
|
||||
<span class="badge bg-info text-white">{{#str}}yes{{/str}}</span>
|
||||
{{/isbasedontemplate}}
|
||||
{{^isbasedontemplate}}
|
||||
<span class="badge">{{#str}}no{{/str}}</span>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</ul>
|
||||
{{/hascourses}}
|
||||
{{^hascourses}}
|
||||
<span class="badge badge-info">{{#str}}nolinkedcourses, tool_lp{{/str}}</span>
|
||||
<span class="badge bg-info text-white">{{#str}}nolinkedcourses, tool_lp{{/str}}</span>
|
||||
{{/hascourses}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</dd>
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<span class="badge {{#proficiency}}badge-success{{/proficiency}}{{^proficiency}}badge-danger{{/proficiency}} float-left">
|
||||
<span class="badge {{#proficiency}}bg-success{{/proficiency}}{{^proficiency}}bg-danger{{/proficiency}} text-white float-left">
|
||||
{{proficiencyname}}
|
||||
</span>
|
||||
</dd>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
{{#usercompetencycourse}}
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<span class="badge {{#proficiency}}badge-success{{/proficiency}}{{^proficiency}}badge-danger{{/proficiency}} float-left">
|
||||
<span class="badge {{#proficiency}}bg-success{{/proficiency}}{{^proficiency}}bg-danger{{/proficiency}} text-white float-left">
|
||||
{{proficiencyname}}
|
||||
</span>
|
||||
</dd>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
</dd>
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<span class="badge {{#proficiency}}badge-success{{/proficiency}}{{^proficiency}}badge-danger{{/proficiency}} float-left">
|
||||
<span class="badge {{#proficiency}}bg-success{{/proficiency}}{{^proficiency}}bg-danger{{/proficiency}} text-white float-left">
|
||||
{{proficiencyname}}
|
||||
</span>
|
||||
</dd>
|
||||
|
@ -101,7 +101,7 @@
|
|||
<dd>{{gradename}} - {{#str}}plancompleted, tool_lp{{/str}}</dd>
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<span class="badge {{#proficiency}}badge-success{{/proficiency}}{{^proficiency}}badge-danger{{/proficiency}} float-left">
|
||||
<span class="badge {{#proficiency}}bg-success{{/proficiency}}{{^proficiency}}bg-danger{{/proficiency}} text-white float-left">
|
||||
{{proficiencyname}}
|
||||
</span>
|
||||
</dd>
|
||||
|
|
|
@ -41,23 +41,24 @@ class renderer extends \plugin_renderer_base {
|
|||
|
||||
switch ($state) {
|
||||
case factor::STATE_PASS:
|
||||
return html_writer::tag('span', get_string('state:pass', 'tool_mfa'), ['class' => 'badge badge-success']);
|
||||
return html_writer::tag('span', get_string('state:pass', 'tool_mfa'), ['class' => 'badge bg-success text-white']);
|
||||
|
||||
case factor::STATE_FAIL:
|
||||
return html_writer::tag('span', get_string('state:fail', 'tool_mfa'), ['class' => 'badge badge-danger']);
|
||||
return html_writer::tag('span', get_string('state:fail', 'tool_mfa'), ['class' => 'badge bg-danger text-white']);
|
||||
|
||||
case factor::STATE_NEUTRAL:
|
||||
return html_writer::tag('span', get_string('state:neutral', 'tool_mfa'), ['class' => 'badge badge-warning']);
|
||||
return html_writer::tag('span', get_string('state:neutral', 'tool_mfa'),
|
||||
['class' => 'badge bg-warning text-dark']);
|
||||
|
||||
case factor::STATE_UNKNOWN:
|
||||
return html_writer::tag('span', get_string('state:unknown', 'tool_mfa'),
|
||||
['class' => 'badge badge-secondary']);
|
||||
['class' => 'badge bg-secondary text-dark']);
|
||||
|
||||
case factor::STATE_LOCKED:
|
||||
return html_writer::tag('span', get_string('state:locked', 'tool_mfa'), ['class' => 'badge badge-error']);
|
||||
return html_writer::tag('span', get_string('state:locked', 'tool_mfa'), ['class' => 'badge bg-danger text-white']);
|
||||
|
||||
default:
|
||||
return html_writer::tag('span', get_string('pending', 'tool_mfa'), ['class' => 'badge badge-secondary']);
|
||||
return html_writer::tag('span', get_string('pending', 'tool_mfa'), ['class' => 'badge bg-secondary text-dark']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,9 +152,9 @@ class page_managedocs_list implements renderable, templatable {
|
|||
$version->statustext = get_string('status' . $status, 'tool_policy');
|
||||
|
||||
if ($status == policy_version::STATUS_ACTIVE) {
|
||||
$version->statustext = html_writer::span($version->statustext, 'badge badge-success');
|
||||
$version->statustext = html_writer::span($version->statustext, 'badge bg-success text-white');
|
||||
} else if ($status == policy_version::STATUS_DRAFT) {
|
||||
$version->statustext = html_writer::span($version->statustext, 'badge badge-warning');
|
||||
$version->statustext = html_writer::span($version->statustext, 'badge bg-warning text-dark');
|
||||
} else {
|
||||
$version->statustext = html_writer::span($version->statustext, 'label');
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@
|
|||
</td>
|
||||
<td>
|
||||
<a href="{{viewurl}}">{{{revision}}}</a>
|
||||
{{#iscurrent}}<span class="badge badge-success">{{#str}} status1, tool_policy {{/str}}</span>{{/iscurrent}}
|
||||
{{#isoptional}}<span class="badge badge-info">{{#str}} policydocoptionalyes, tool_policy {{/str}}</span>{{/isoptional}}
|
||||
{{#iscurrent}}<span class="badge bg-success text-white">{{#str}} status1, tool_policy {{/str}}</span>{{/iscurrent}}
|
||||
{{#isoptional}}<span class="badge bg-info text-white">{{#str}} policydocoptionalyes, tool_policy {{/str}}</span>{{/isoptional}}
|
||||
</td>
|
||||
<td>
|
||||
{{>tool_policy/user_agreement}}
|
||||
|
|
|
@ -110,9 +110,9 @@ class running_tasks_table extends \table_sql {
|
|||
*/
|
||||
public function col_type($row) : string {
|
||||
if ($row->type == 'scheduled') {
|
||||
$output = \html_writer::span(get_string('scheduled', 'tool_task'), 'badge badge-primary');
|
||||
$output = \html_writer::span(get_string('scheduled', 'tool_task'), 'badge bg-primary text-white');
|
||||
} else if ($row->type == 'adhoc') {
|
||||
$output = \html_writer::span(get_string('adhoc', 'tool_task'), 'badge badge-dark');
|
||||
$output = \html_writer::span(get_string('adhoc', 'tool_task'), 'badge bg-dark text-white');
|
||||
} else {
|
||||
// This shouldn't ever happen.
|
||||
$output = '';
|
||||
|
|
|
@ -468,7 +468,7 @@ class tool_task_renderer extends plugin_renderer_base {
|
|||
$componentname = $plugininfo->displayname;
|
||||
if ($plugininfo->is_enabled() === false) {
|
||||
$componentname .= ' ' . html_writer::span(
|
||||
get_string('disabled', 'tool_task'), 'badge badge-secondary');
|
||||
get_string('disabled', 'tool_task'), 'badge bg-secondary text-dark');
|
||||
}
|
||||
$componentname .= "\n" . html_writer::span($plugininfo->component, 'task-class text-ltr');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue