MDL-80259 theme_boost: Refactor badge helper classes for Bootstrap 5

This commit is contained in:
Mikel Martín 2023-12-01 10:54:22 +01:00
parent 810554ee83
commit a198884333
93 changed files with 218 additions and 209 deletions

View File

@ -273,7 +273,7 @@ class hook_list_table extends flexible_table {
if (is_array($tag)) {
return $this->get_tag(...$tag);
}
return $this->get_tag($tag, 'badge badge-info');
return $this->get_tag($tag, 'badge bg-info text-white');
}, $tags);
return implode("\n", $taglist);

View File

@ -1111,10 +1111,11 @@ class core_admin_renderer extends plugin_renderer_base {
if ($isstandard = $plugin->is_standard()) {
$row->attributes['class'] .= ' standard';
$sourcelabel = html_writer::span(get_string('sourcestd', 'core_plugin'), 'sourcetext badge badge-secondary');
$sourcelabel = html_writer::span(get_string('sourcestd', 'core_plugin'),
'sourcetext badge bg-secondary text-dark');
} else {
$row->attributes['class'] .= ' extension';
$sourcelabel = html_writer::span(get_string('sourceext', 'core_plugin'), 'sourcetext badge badge-info');
$sourcelabel = html_writer::span(get_string('sourceext', 'core_plugin'), 'sourcetext badge bg-info text-white');
}
$coredependency = $plugin->is_core_dependency_satisfied($version);
@ -1128,19 +1129,19 @@ class core_admin_renderer extends plugin_renderer_base {
$statusclass = 'statustext badge ';
switch ($statuscode) {
case core_plugin_manager::PLUGIN_STATUS_NEW:
$statusclass .= $dependenciesok ? 'badge-success' : 'badge-warning';
$statusclass .= $dependenciesok ? 'bg-success text-white' : 'bg-warning text-dark';
break;
case core_plugin_manager::PLUGIN_STATUS_UPGRADE:
$statusclass .= $dependenciesok ? 'badge-info' : 'badge-warning';
$statusclass .= $dependenciesok ? 'bg-info text-white' : 'bg-warning text-dark';
break;
case core_plugin_manager::PLUGIN_STATUS_MISSING:
case core_plugin_manager::PLUGIN_STATUS_DOWNGRADE:
case core_plugin_manager::PLUGIN_STATUS_DELETE:
$statusclass .= 'badge-danger';
$statusclass .= 'bg-danger text-white';
break;
case core_plugin_manager::PLUGIN_STATUS_NODB:
case core_plugin_manager::PLUGIN_STATUS_UPTODATE:
$statusclass .= $dependenciesok ? 'badge-light' : 'badge-warning';
$statusclass .= $dependenciesok ? 'bg-light text-dark' : 'bg-warning text-dark';
break;
}
$status = html_writer::span(get_string('status_' . $statuscode, 'core_plugin'), $statusclass);
@ -1263,11 +1264,11 @@ class core_admin_renderer extends plugin_renderer_base {
}
$out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 0)),
get_string('plugincheckattention', 'core_plugin')).' '.html_writer::span($sumattention, 'badge badge-light'),
get_string('plugincheckattention', 'core_plugin')).' '.html_writer::span($sumattention, 'badge bg-light text-dark'),
'btn btn-link mr-1');
$out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 1)),
get_string('plugincheckall', 'core_plugin')).' '.html_writer::span($sumtotal, 'badge badge-light'),
get_string('plugincheckall', 'core_plugin')).' '.html_writer::span($sumtotal, 'badge bg-light text-dark'),
'btn btn-link mr-1');
$out .= $this->output->container_end(); // End of .actions container.
@ -1420,9 +1421,9 @@ class core_admin_renderer extends plugin_renderer_base {
$supportedmoodles = array();
foreach ($plugin->version->supportedmoodles as $moodle) {
if ($CFG->branch == str_replace('.', '', $moodle->release)) {
$supportedmoodles[] = html_writer::span($moodle->release, 'badge badge-success');
$supportedmoodles[] = html_writer::span($moodle->release, 'badge bg-success text-white');
} else {
$supportedmoodles[] = html_writer::span($moodle->release, 'badge badge-light');
$supportedmoodles[] = html_writer::span($moodle->release, 'badge bg-light text-dark');
}
}
@ -1528,7 +1529,7 @@ class core_admin_renderer extends plugin_renderer_base {
$label = '';
} else {
$class = 'requires-failed';
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge badge-danger');
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge bg-danger text-white');
}
if ($branch != null && !$plugin->is_core_compatible_satisfied($branch)) {
@ -1557,8 +1558,10 @@ class core_admin_renderer extends plugin_renderer_base {
} else if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_MISSING) {
if ($reqinfo->availability == $pluginman::REQUIREMENT_AVAILABLE) {
$label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'badge badge-warning');
$label .= ' '.html_writer::span(get_string('dependencyavailable', 'core_plugin'), 'badge badge-warning');
$label = html_writer::span(get_string('dependencymissing', 'core_plugin'),
'badge bg-warning text-dark');
$label .= ' '.html_writer::span(get_string('dependencyavailable', 'core_plugin'),
'badge bg-warning text-dark');
$class = 'requires-failed requires-missing requires-available';
$actions[] = html_writer::link(
new moodle_url('https://moodle.org/plugins/view.php', array('plugin' => $reqname)),
@ -1566,24 +1569,25 @@ class core_admin_renderer extends plugin_renderer_base {
);
} else {
$label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'badge badge-danger');
$label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'badge bg-danger text-white');
$label .= ' '.html_writer::span(get_string('dependencyunavailable', 'core_plugin'),
'badge badge-danger');
'badge bg-danger text-white');
$class = 'requires-failed requires-missing requires-unavailable';
}
$displayuploadlink = true;
} else if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_OUTDATED) {
if ($reqinfo->availability == $pluginman::REQUIREMENT_AVAILABLE) {
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge badge-warning');
$label .= ' '.html_writer::span(get_string('dependencyavailable', 'core_plugin'), 'badge badge-warning');
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge bg-warning text-dark');
$label .= ' '.html_writer::span(get_string('dependencyavailable', 'core_plugin'),
'badge bg-warning text-dark');
$class = 'requires-failed requires-outdated requires-available';
$displayupdateslink = true;
} else {
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge badge-danger');
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge bg-danger text-white');
$label .= ' '.html_writer::span(get_string('dependencyunavailable', 'core_plugin'),
'badge badge-danger');
'badge bg-danger text-white');
$class = 'requires-failed requires-outdated requires-unavailable';
}
$displayuploadlink = true;
@ -1693,7 +1697,7 @@ class core_admin_renderer extends plugin_renderer_base {
new moodle_url($this->page->url, array('contribonly' => 0, 'updatesonly' => 1)),
get_string('overviewupdatable', 'core_plugin'),
array('title' => get_string('filterupdatesonly', 'core_plugin'))
).' '.html_writer::span($numupdatable, 'badge badge-info number number-updatable');
).' '.html_writer::span($numupdatable, 'badge bg-info text-white number number-updatable');
} else {
// No updates, or the notifications disabled.
$infoupdatable = '';
@ -1868,13 +1872,13 @@ class core_admin_renderer extends plugin_renderer_base {
$source = '';
} else {
$row->attributes['class'] .= ' extension';
$source = html_writer::div(get_string('sourceext', 'core_plugin'), 'source badge badge-info');
$source = html_writer::div(get_string('sourceext', 'core_plugin'), 'source badge bg-info text-white');
}
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
$msg = html_writer::div(get_string('status_missing', 'core_plugin'), 'statusmsg badge badge-danger');
$msg = html_writer::div(get_string('status_missing', 'core_plugin'), 'statusmsg badge bg-danger text-white');
} else if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
$msg = html_writer::div(get_string('status_new', 'core_plugin'), 'statusmsg badge badge-success');
$msg = html_writer::div(get_string('status_new', 'core_plugin'), 'statusmsg badge bg-success text-white');
} else {
$msg = '';
}
@ -2113,13 +2117,13 @@ class core_admin_renderer extends plugin_renderer_base {
// Format error or warning line
if ($errorline) {
$messagetype = 'error';
$statusclass = 'badge-danger';
$statusclass = 'bg-danger text-white';
} else if ($warningline) {
$messagetype = 'warn';
$statusclass = 'badge-warning';
$statusclass = 'bg-warning text-dark';
} else {
$messagetype = 'ok';
$statusclass = 'badge-success';
$statusclass = 'bg-success text-white';
}
$status = html_writer::span($status, 'badge ' . $statusclass);
// Here we'll store all the feedback found

View File

@ -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 }}

View File

@ -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;
}

View File

@ -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;

View File

@ -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>

View File

@ -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 />

View File

@ -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" : {

View File

@ -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>"
}
}}

View File

@ -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}}

View File

@ -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}}

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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']);
}
}

View File

@ -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');
}

View File

@ -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}}

View File

@ -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 = '';

View File

@ -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');

View File

@ -436,7 +436,7 @@ M.core_availability.List = function(json, root, parentRoot) {
noneNode.appendChild(deleteIcon.span);
// Also if it's not the root, none is actually invalid, so add a label.
noneNode.appendChild(Y.Node.create('<span class="mt-1 badge badge-warning">' +
noneNode.appendChild(Y.Node.create('<span class="mt-1 badge bg-warning text-dark">' +
M.util.get_string('invalid', 'availability') + '</span>'));
}
@ -1002,7 +1002,7 @@ M.core_availability.Item = function(json, root) {
// Add the invalid marker (empty).
this.node.appendChild(document.createTextNode(' '));
this.node.appendChild(Y.Node.create('<span class="badge badge-warning"/>'));
this.node.appendChild(Y.Node.create('<span class="badge bg-warning text-dark"/>'));
};
Y.augment(M.core_availability.Item, Y.EventTarget, true, null, {emitFacade: true});
@ -1039,7 +1039,7 @@ M.core_availability.Item.prototype.fillErrors = function(errors) {
errors.push('core_availability:item_unknowntype');
}
// If any errors were added, add the marker to this item.
var errorLabel = this.node.one('> .badge-warning');
var errorLabel = this.node.one('> .bg-warning');
if (errors.length !== before && !errorLabel.get('firstChild')) {
var errorString = '';
// Fetch the last error code from the array of errors and split using the ':' delimiter.

File diff suppressed because one or more lines are too long

View File

@ -436,7 +436,7 @@ M.core_availability.List = function(json, root, parentRoot) {
noneNode.appendChild(deleteIcon.span);
// Also if it's not the root, none is actually invalid, so add a label.
noneNode.appendChild(Y.Node.create('<span class="mt-1 badge badge-warning">' +
noneNode.appendChild(Y.Node.create('<span class="mt-1 badge bg-warning text-dark">' +
M.util.get_string('invalid', 'availability') + '</span>'));
}
@ -1002,7 +1002,7 @@ M.core_availability.Item = function(json, root) {
// Add the invalid marker (empty).
this.node.appendChild(document.createTextNode(' '));
this.node.appendChild(Y.Node.create('<span class="badge badge-warning"/>'));
this.node.appendChild(Y.Node.create('<span class="badge bg-warning text-dark"/>'));
};
Y.augment(M.core_availability.Item, Y.EventTarget, true, null, {emitFacade: true});
@ -1039,7 +1039,7 @@ M.core_availability.Item.prototype.fillErrors = function(errors) {
errors.push('core_availability:item_unknowntype');
}
// If any errors were added, add the marker to this item.
var errorLabel = this.node.one('> .badge-warning');
var errorLabel = this.node.one('> .bg-warning');
if (errors.length !== before && !errorLabel.get('firstChild')) {
var errorString = '';
// Fetch the last error code from the array of errors and split using the ':' delimiter.

View File

@ -434,7 +434,7 @@ M.core_availability.List = function(json, root, parentRoot) {
noneNode.appendChild(deleteIcon.span);
// Also if it's not the root, none is actually invalid, so add a label.
noneNode.appendChild(Y.Node.create('<span class="mt-1 badge badge-warning">' +
noneNode.appendChild(Y.Node.create('<span class="mt-1 badge bg-warning text-dark">' +
M.util.get_string('invalid', 'availability') + '</span>'));
}
@ -1000,7 +1000,7 @@ M.core_availability.Item = function(json, root) {
// Add the invalid marker (empty).
this.node.appendChild(document.createTextNode(' '));
this.node.appendChild(Y.Node.create('<span class="badge badge-warning"/>'));
this.node.appendChild(Y.Node.create('<span class="badge bg-warning text-dark"/>'));
};
Y.augment(M.core_availability.Item, Y.EventTarget, true, null, {emitFacade: true});
@ -1037,7 +1037,7 @@ M.core_availability.Item.prototype.fillErrors = function(errors) {
errors.push('core_availability:item_unknowntype');
}
// If any errors were added, add the marker to this item.
var errorLabel = this.node.one('> .badge-warning');
var errorLabel = this.node.one('> .bg-warning');
if (errors.length !== before && !errorLabel.get('firstChild')) {
var errorString = '';
// Fetch the last error code from the array of errors and split using the ':' delimiter.

View File

@ -80,7 +80,7 @@
{{/showcoursecategory}}
{{^visible}}
<div class="d-flex flex-wrap">
<span class="badge badge-info">{{#str}} hiddenfromstudents {{/str}}</span>
<span class="badge bg-info text-white">{{#str}} hiddenfromstudents {{/str}}</span>
</div>
{{/visible}}
{{#hasprogress}}

View File

@ -82,7 +82,7 @@
{{/coursecategory}}
{{^visible}}
<div class="d-flex flex-wrap">
<span class="badge badge-info">{{#str}} hiddenfromstudents {{/str}}</span>
<span class="badge bg-info text-white">{{#str}} hiddenfromstudents {{/str}}</span>
</div>
{{/visible}}
<div class="summary">

View File

@ -61,7 +61,7 @@ class block_site_main_menu extends block_list {
$controlmenuclass = $format->get_output_classname('content\\cm\\controlmenu');
$badgeattributes = [
'class' => 'badge badge-pill badge-warning mt-2',
'class' => 'badge rounded-pill bg-warning text-dark mt-2',
'data-region' => 'visibility'
];

View File

@ -62,7 +62,7 @@ class block_social_activities extends block_list {
$controlmenuclass = $format->get_output_classname('content\\cm\\controlmenu');
$badgeattributes = [
'class' => 'badge badge-pill badge-warning mt-2',
'class' => 'badge rounded-pill bg-warning text-dark mt-2',
'data-region' => 'visibility'
];

View File

@ -67,7 +67,7 @@
<div class="event-name-container flex-grow-1 line-height-3 nowrap text-truncate">
<div class="d-flex">
<h6 class="event-name mb-0 pb-1 text-truncate">
{{#overdue}}<span class="badge badge-pill badge-danger ml-1 float-right">{{#str}} overdue, block_timeline {{/str}}</span>{{/overdue}}
{{#overdue}}<span class="badge rounded-pill bg-danger text-white ml-1 float-right">{{#str}} overdue, block_timeline {{/str}}</span>{{/overdue}}
<a href="{{url}}"
title="{{name}}"
aria-label='{{#cleanstr}} ariaeventlistitem, block_timeline, { "name": {{#quote}}{{{activityname}}}{{/quote}}, "course": {{#quote}}{{{course.fullnamedisplay}}}{{/quote}}, "date": "{{#userdate}} {{timesort}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}" } {{/cleanstr}}'>
@ -93,7 +93,7 @@
title="{{action.name}}">
{{{action.name}}}
{{#action.showitemcount}}
<span class="badge badge-secondary">{{action.itemcount}}</span>
<span class="badge bg-secondary text-dark">{{action.itemcount}}</span>
{{/action.showitemcount}}
</a>
</h6>

View File

@ -37,10 +37,10 @@ abstract class activitybadge implements named_templatable, \renderable {
/** @var array Badge defined styles. */
public const STYLES = [
'none' => 'badge-none',
'dark' => 'badge-dark',
'danger' => 'badge-danger',
'warning' => 'badge-warning',
'info' => 'badge-info',
'dark' => 'bg-dark text-white',
'danger' => 'bg-danger text-white',
'warning' => 'bg-warning text-dark',
'info' => 'bg-info text-white',
];
/** @var cm_info The course module information. */

View File

@ -25,9 +25,9 @@
"displayvalue" : "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Activity example</span></a>"
},
"hasname": "true",
"afterlink": "<span class=\"badge badge-primary\">30 unread messages</span>",
"afterlink": "<span class=\"badge bg-primary\">30 unread messages</span>",
"hasextras": true,
"extras": ["<span class=\"badge badge-secondary\">[extras]</span>"],
"extras": ["<span class=\"badge bg-secondary\">[extras]</span>"],
"activityinfo": {
"hasmodavailability": true,
"activityname": "Activity example",

View File

@ -43,7 +43,7 @@
]
},
"hasextras": true,
"extras": ["<span class=\"badge badge-secondary\">[extras]</span>"],
"extras": ["<span class=\"badge bg-secondary\">[extras]</span>"],
"activityinfo": {
"hasmodavailability": true,
"activityname": "Activity example",

View File

@ -44,7 +44,7 @@
class="ml-1"
{{#badgeextraattributes}} {{name}}="{{value}}" {{/badgeextraattributes}}
>
<span class="activitybadge badge badge-pill {{badgestyle}}">
<span class="activitybadge badge rounded-pill {{badgestyle}}">
{{#badgeurl}}
<a href="{{.}}">{{badgecontent}}</a>
{{/badgeurl}}

View File

@ -38,7 +38,7 @@
{{#info}}
<div class="activity-availability availabilityinfo {{classes}}" data-region="availabilityinfo">
{{^isrestricted}}
<span class="badge badge-pill badge-warning">{{{text}}}</span>
<span class="badge rounded-pill bg-warning text-dark">{{{text}}}</span>
{{/isrestricted}}
{{#isrestricted}}
{{> core_courseformat/local/content/availability }}

View File

@ -67,7 +67,7 @@
<div class="activity-badges my-1" data-region="visibility">
{{#dropwdown}}
{{< core/local/dropdown/status}}
{{$ buttonclasses }} badge badge-pill badge-secondary dropdown-toggle border-0 {{/ buttonclasses }}
{{$ buttonclasses }} badge rounded-pill bg-secondary text-dark dropdown-toggle border-0 {{/ buttonclasses }}
{{/ core/local/dropdown/status}}
{{/dropwdown}}
</div>
@ -75,12 +75,12 @@
{{^isInteractive}}
{{#modhiddenfromstudents}}
<div class="activity-badges my-1 d-flex align-self-start align-items-center" data-region="visibility">
<span class="badge badge-pill badge-secondary">{{#pix}}i/show, core{{/pix}}{{#str}}hiddenfromstudents{{/str}}</span>
<span class="badge rounded-pill bg-secondary text-dark">{{#pix}}i/show, core{{/pix}}{{#str}}hiddenfromstudents{{/str}}</span>
</div>
{{/modhiddenfromstudents}}
{{#modstealth}}
<div class="activity-badges my-1 d-flex align-self-start align-items-center" data-region="visibility">
<span class="badge badge-pill badge-secondary">{{#pix}}t/stealth, core{{/pix}}{{#str}}hiddenoncoursepage{{/str}}</span>
<span class="badge rounded-pill bg-secondary text-dark">{{#pix}}t/stealth, core{{/pix}}{{#str}}hiddenoncoursepage{{/str}}</span>
</div>
{{/modstealth}}
{{/isInteractive}}

View File

@ -66,7 +66,7 @@
"iscurrent": true,
"currentlink": "<span class=\"accesshide\">This topic</span>",
"availability": {
"info": "<span class=\"badge badge-info\">Hidden from students</span>",
"info": "<span class=\"badge bg-info\">Hidden from students</span>",
"hasavailability": true
},
"summary": {

View File

@ -38,7 +38,7 @@
{{#info}}
<div class="availabilityinfo {{classes}}" data-region="availabilityinfo">
{{^isrestricted}}
<span class="badge badge-pill badge-warning">{{{text}}}</span>
<span class="badge rounded-pill bg-warning text-dark">{{{text}}}</span>
{{/isrestricted}}
{{#isrestricted}}
{{> core_courseformat/local/content/availability }}

View File

@ -30,24 +30,24 @@
}
}}
{{#editing}}
<span class="badge badge-pill badge-primary order-1 {{^iscurrent}}d-none{{/iscurrent}}" data-type="iscurrent">
<span class="badge rounded-pill bg-primary text-white order-1 {{^iscurrent}}d-none{{/iscurrent}}" data-type="iscurrent">
{{ highlightedlabel }}
</span>
<span class="badge badge-pill badge-warning order-2 {{^hiddenfromstudents}}d-none{{/hiddenfromstudents}}" data-type="hiddenfromstudents">
<span class="badge rounded-pill bg-warning text-dark order-2 {{^hiddenfromstudents}}d-none{{/hiddenfromstudents}}" data-type="hiddenfromstudents">
{{#str}}hiddenfromstudents{{/str}}
</span>
<span class="badge badge-pill badge-secondary order-3 {{^notavailable}}d-none{{/notavailable}}">
<span class="badge rounded-pill bg-secondary text-dark order-3 {{^notavailable}}d-none{{/notavailable}}">
{{#str}}notavailable{{/str}}
</span>
{{/editing}}
{{^editing}}
{{#iscurrent}}
<span class="badge badge-pill badge-primary order-1">{{ highlightedlabel }}</span>
<span class="badge rounded-pill bg-primary text-white order-1">{{ highlightedlabel }}</span>
{{/iscurrent}}
{{#hiddenfromstudents}}
<span class="badge badge-pill badge-warning order-2">{{#str}}hiddenfromstudents{{/str}}</span>
<span class="badge rounded-pill bg-warning text-dark order-2">{{#str}}hiddenfromstudents{{/str}}</span>
{{/hiddenfromstudents}}
{{#notavailable}}
<span class="badge badge-pill badge-secondary order-3">{{#str}}notavailable{{/str}}</span>
<span class="badge rounded-pill bg-secondary text-dark order-3">{{#str}}notavailable{{/str}}</span>
{{/notavailable}}
{{/editing}}

View File

@ -26,10 +26,10 @@
"hasname": "true",
"moveicon": "<i>[Move]</i>",
"indent": 2,
"afterlink": "<span class=\"badge badge-primary\">30 unread messages</span>",
"afterlink": "<span class=\"badge bg-primary\">30 unread messages</span>",
"hasextras": true,
"extras": ["<span class=\"badge badge-secondary\">[extras]</span>"],
"completion": "<span class=\"badge badge-success\">Completed!</span>"
"extras": ["<span class=\"badge bg-secondary\">[extras]</span>"],
"completion": "<span class=\"badge bg-success\">Completed!</span>"
},
"id": 3,
"anchor": "module-3",

View File

@ -65,7 +65,7 @@
"iscurrent": true,
"currentlink": "<span class=\"accesshide\">This topic</span>",
"availability": {
"info": "<span class=\"badge badge-info\">Hidden from students</span>",
"info": "<span class=\"badge bg-info\">Hidden from students</span>",
"hasavailability": true
},
"summary": {

View File

@ -98,7 +98,7 @@
>
{{{title}}}
</a>
<span class="current-badge badge badge-primary ml-2 px-2 rounded-pill">
<span class="current-badge badge bg-primary text-white ml-2 px-2 rounded-pill">
{{highlighted}}
</span>
<span class="courseindex-locked ml-1" data-for="cm_name">

View File

@ -64,7 +64,7 @@ class activitybadge_test extends \advanced_testcase {
// The activitybadge for a forum with unread messages shouldn't be empty.
$class = activitybadge::create_instance($data->forumunread);
$result = $class->export_for_template($renderer);
$this->check_activitybadge($result, '1 unread post', 'badge-dark');
$this->check_activitybadge($result, '1 unread post', 'bg-dark text-white');
// The activitybadge for a forum without unread messages should be empty.
$class = activitybadge::create_instance($data->forumread);

View File

@ -29,7 +29,7 @@
}}
{{#istrackeduser}}
{{#statuscomplete}}
<div class="badge badge-pill alert-success icon-no-margin" role="listitem" {{!
<div class="badge rounded-pill alert-success icon-no-margin" role="listitem" {{!
}}{{#accessibledescription}}{{!
}}title="{{.}}" {{!
}}aria-label="{{.}}" {{!
@ -39,7 +39,7 @@
</div>
{{/statuscomplete}}
{{#statuscompletefail}}
<div class="badge badge-pill alert-danger icon-no-margin" role="listitem" {{!
<div class="badge rounded-pill alert-danger icon-no-margin" role="listitem" {{!
}}{{#accessibledescription}}{{!
}}title="{{.}}" {{!
}}aria-label="{{.}}" {{!
@ -49,7 +49,7 @@
</div>
{{/statuscompletefail}}
{{#statusincomplete}}
<div class="badge badge-pill badge-light" role="listitem" {{!
<div class="badge rounded-pill bg-light text-dark" role="listitem" {{!
}}{{#accessibledescription}}{{!
}}title="{{.}}" {{!
}}aria-label="{{.}}" {{!
@ -59,7 +59,7 @@
{{/statusincomplete}}
{{/istrackeduser}}
{{^istrackeduser}}
<div class="badge badge-pill badge-light" role="listitem">
<div class="badge rounded-pill bg-light text-dark" role="listitem">
<span class="font-weight-normal">{{description}}</span>
</div>
{{/istrackeduser}}

View File

@ -67,7 +67,7 @@
</div>
{{^visible}}
<div class="d-flex flex-wrap">
<span class="badge badge-info">{{#str}} hiddenfromstudents {{/str}}</span>
<span class="badge bg-info text-white">{{#str}} hiddenfromstudents {{/str}}</span>
</div>
{{/visible}}
</div>

View File

@ -1178,7 +1178,7 @@ class externallib_test extends externallib_advanced_testcase {
// Afterlink for forums has been removed; it has been moved to the new activity badge content.
$this->assertEmpty($module['afterlink']);
$this->assertEquals('1 unread post', $module['activitybadge']['badgecontent']);
$this->assertEquals('badge-dark', $module['activitybadge']['badgestyle']);
$this->assertEquals('bg-dark text-white', $module['activitybadge']['badgestyle']);
$this->assertEquals(
plugin_supports(
'mod',

View File

@ -81,10 +81,10 @@
</td>
<td>
{{#isactive}}
<span class="badge badge-success">{{{statusstring}}}</span>
<span class="badge bg-success text-white">{{{statusstring}}}</span>
{{/isactive}}
{{^isactive}}
<span class="badge badge-info">{{{statusstring}}}</span>
<span class="badge bg-info text-white">{{{statusstring}}}</span>
{{/isactive}}
</td>
<td>

View File

@ -26,7 +26,7 @@
$string['aria:dropdowncolumns'] = 'Collapsed columns found';
$string['clearall'] = 'Clear all';
$string['clearsearch'] = 'Clear searched users';
$string['collapsedcolumns'] = 'Collapsed columns <span class="badge badge-pill badge-primary ml-1" data-collapse="count">{$a}</span>';
$string['collapsedcolumns'] = 'Collapsed columns <span class="badge rounded-pill bg-primary text-white ml-1" data-collapse="count">{$a}</span>';
$string['editingmode_title'] = 'Editing the grader report';
$string['eventgradereportviewed'] = 'Grader report viewed';
$string['grader:manage'] = 'Manage the grader report';

View File

@ -30,32 +30,32 @@
}}
<div class="card-deck" role="list">
{{#calculatedgrade}}
<span class="badge badge-pill badge-light" role="listitem">
<span class="badge rounded-pill bg-light text-dark" role="listitem">
<strong>{{calculatedgrade}}</strong>
</span>
{{/calculatedgrade}}
{{#aggregation}}
<span class="badge badge-pill badge-light" role="listitem">
<span class="badge rounded-pill bg-light text-dark" role="listitem">
<strong>{{aggregation}}</strong>
</span>
{{/aggregation}}
{{#aggregateonlygraded}}
<span class="badge badge-pill badge-light" role="listitem">
<span class="badge rounded-pill bg-light text-dark" role="listitem">
<strong>{{#str}}aggregateonlygraded, grades{{/str}}</strong>
</span>
{{/aggregateonlygraded}}
{{#aggregateoutcomes}}
<span class="badge badge-pill badge-light" role="listitem">
<span class="badge rounded-pill bg-light text-dark" role="listitem">
<strong>{{#str}}aggregateoutcomes, grades{{/str}}</strong>
</span>
{{/aggregateoutcomes}}
{{#droplow}}
<span class="badge badge-pill badge-light" role="listitem">
<span class="badge rounded-pill bg-light text-dark" role="listitem">
<strong>{{#str}}droplowestvalues, grades, {{droplow}}{{/str}}</strong>
</span>
{{/droplow}}
{{#keephigh}}
<span class="badge badge-pill badge-light" role="listitem">
<span class="badge rounded-pill bg-light text-dark" role="listitem">
<strong>{{#str}}keephigh, grades{{/str}}</strong>
</span>
{{/keephigh}}

View File

@ -302,10 +302,10 @@ class helper {
string $statusaction = ''): array {
$statusclasses = array(
TEXTFILTER_DISABLED => 'badge badge-danger',
TEXTFILTER_OFF => 'badge badge-warning',
0 => 'badge badge-danger',
TEXTFILTER_ON => 'badge badge-success',
TEXTFILTER_DISABLED => 'badge bg-danger text-white',
TEXTFILTER_OFF => 'badge bg-warning text-dark',
0 => 'badge bg-danger text-white',
TEXTFILTER_ON => 'badge bg-success text-white',
);
$statuschoices = array(

View File

@ -25,7 +25,7 @@
"tool_description": "h5ptasks_description",
"link": "https://example.com/admin/tool/task/scheduledtasks.php",
"status": "On",
"status_class": "bade badge-success",
"status_class": "bade bg-success text-white",
"status_action": "<a href=\"admin/tool/task/schedule_task.php?task=core_task_h5p_get_content_types_task\">Run now</a>"
},
{
@ -33,7 +33,7 @@
"tool_description": "h5ptasks_description",
"link": "https://example.com/admin/filters.php",
"status": "Off",
"status_class": "bade badge-danger"
"status_class": "bade bg-danger text-white"
}
]
}

View File

@ -10034,7 +10034,7 @@ class admin_setting_webservicesoverview extends admin_setting {
$url = new moodle_url("/admin/search.php?query=enablewebservices");
$row[0] = "1. " . html_writer::tag('a', get_string('enablews', 'webservice'),
array('href' => $url));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge bg-danger text-white'));
if ($CFG->enablewebservices) {
$status = get_string('yes');
}
@ -10047,7 +10047,7 @@ class admin_setting_webservicesoverview extends admin_setting {
$url = new moodle_url("/admin/settings.php?section=webserviceprotocols");
$row[0] = "2. " . html_writer::tag('a', get_string('enableprotocols', 'webservice'),
array('href' => $url));
$status = html_writer::tag('span', get_string('none'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('none'), array('class' => 'badge bg-danger text-white'));
//retrieve activated protocol
$active_protocols = empty($CFG->webserviceprotocols) ?
array() : explode(',', $CFG->webserviceprotocols);
@ -10158,7 +10158,7 @@ class admin_setting_webservicesoverview extends admin_setting {
$url = new moodle_url("/admin/search.php?query=enablewebservices");
$row[0] = "1. " . html_writer::tag('a', get_string('enablews', 'webservice'),
array('href' => $url));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge bg-danger text-white'));
if ($CFG->enablewebservices) {
$status = get_string('yes');
}
@ -10171,7 +10171,7 @@ class admin_setting_webservicesoverview extends admin_setting {
$url = new moodle_url("/admin/settings.php?section=webserviceprotocols");
$row[0] = "2. " . html_writer::tag('a', get_string('enableprotocols', 'webservice'),
array('href' => $url));
$status = html_writer::tag('span', get_string('none'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('none'), array('class' => 'badge bg-danger text-white'));
//retrieve activated protocol
$active_protocols = empty($CFG->webserviceprotocols) ?
array() : explode(',', $CFG->webserviceprotocols);
@ -11201,10 +11201,10 @@ class admin_setting_searchsetupinfo extends admin_setting {
$row[0] = '1. ' . html_writer::tag('a', get_string('selectsearchengine', 'admin'),
array('href' => $url));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge bg-danger text-white'));
if (!empty($CFG->searchengine)) {
$status = html_writer::tag('span', get_string('pluginname', 'search_' . $CFG->searchengine),
array('class' => 'badge badge-success'));
array('class' => 'badge bg-success text-white'));
}
$row[1] = $status;
@ -11216,9 +11216,9 @@ class admin_setting_searchsetupinfo extends admin_setting {
$row[0] = '2. ' . html_writer::tag('a', get_string('enablesearchareas', 'admin'),
array('href' => $url));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge bg-danger text-white'));
if ($anyenabled) {
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge badge-success'));
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge bg-success text-white'));
}
$row[1] = $status;
@ -11228,7 +11228,7 @@ class admin_setting_searchsetupinfo extends admin_setting {
$row = array();
if (empty($CFG->searchengine)) {
$row[0] = '3. ' . get_string('setupsearchengine', 'admin');
$row[1] = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
$row[1] = html_writer::tag('span', get_string('no'), array('class' => 'badge bg-danger text-white'));
} else {
if ($ADMIN->locate('search' . $CFG->searchengine)) {
$url = new moodle_url('/admin/settings.php?section=search' . $CFG->searchengine);
@ -11245,9 +11245,9 @@ class admin_setting_searchsetupinfo extends admin_setting {
$serverstatus = $e->getMessage();
}
if ($serverstatus === true) {
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge badge-success'));
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge bg-success text-white'));
} else {
$status = html_writer::tag('span', $serverstatus, array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', $serverstatus, array('class' => 'badge bg-danger text-white'));
}
$row[1] = $status;
}
@ -11258,9 +11258,9 @@ class admin_setting_searchsetupinfo extends admin_setting {
$url = new moodle_url('/admin/searchareas.php');
$row[0] = '4. ' . html_writer::tag('a', get_string('indexdata', 'admin'), array('href' => $url));
if ($anyindexed) {
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge badge-success'));
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge bg-success text-white'));
} else {
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge bg-danger text-white'));
}
$row[1] = $status;
$table->data[] = $row;
@ -11270,9 +11270,9 @@ class admin_setting_searchsetupinfo extends admin_setting {
$url = new moodle_url("/admin/search.php?query=enableglobalsearch");
$row[0] = '5. ' . html_writer::tag('a', get_string('enableglobalsearch', 'admin'),
array('href' => $url));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge bg-danger text-white'));
if (\core_search\manager::is_global_search_enabled()) {
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge badge-success'));
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge bg-success text-white'));
}
$row[1] = $status;
$table->data[] = $row;
@ -11282,9 +11282,9 @@ class admin_setting_searchsetupinfo extends admin_setting {
$url = new moodle_url("/admin/search.php?query=searchincludeallcourses");
$row[0] = '6. ' . html_writer::tag('a', get_string('replacefrontsearch', 'admin'),
array('href' => $url));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
$status = html_writer::tag('span', get_string('no'), array('class' => 'badge bg-danger text-white'));
if (\core_search\manager::can_replace_course_search()) {
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge badge-success'));
$status = html_writer::tag('span', get_string('yes'), array('class' => 'badge bg-success text-white'));
}
$row[1] = $status;
$table->data[] = $row;

View File

@ -180,11 +180,11 @@ class share_progress_table extends table_sql {
protected function col_status(stdClass $row): string {
// Display a badge indicating the status of the share.
if ($row->status == share_recorder::STATUS_IN_PROGRESS) {
$status = html_writer::span(get_string('inprogress'), 'badge badge-warning');
$status = html_writer::span(get_string('inprogress'), 'badge bg-warning text-dark');
} else if ($row->status == share_recorder::STATUS_SENT) {
$status = html_writer::span(get_string('sent'), 'badge badge-success');
$status = html_writer::span(get_string('sent'), 'badge bg-success text-white');
} else if ($row->status == share_recorder::STATUS_ERROR) {
$status = html_writer::span(get_string('error'), 'badge badge-danger');
$status = html_writer::span(get_string('error'), 'badge bg-danger text-white');
}
return $status;

View File

@ -1815,7 +1815,7 @@ function print_object($item, array $expandclasses = ['/./'], bool $textonly = fa
$out .= '[' . get_class($item) . ']';
} else {
// Objects display the class name as a badge. Content goes within a <dl>.
$badge = html_writer::span(get_class($item), 'badge badge-primary');
$badge = html_writer::span(get_class($item), 'badge bg-primary text-white');
$out .= html_writer::tag('h5', $badge);
$out .= html_writer::start_tag('dl', ['class' => 'row']);
$dl = true;
@ -1832,7 +1832,7 @@ function print_object($item, array $expandclasses = ['/./'], bool $textonly = fa
$out .= $arrayinfo;
} else {
// Arrays show the same as objects but the badge is grey.
$badge = html_writer::span($arrayinfo, 'badge badge-secondary');
$badge = html_writer::span($arrayinfo, 'badge bg-secondary text-dark');
// Decide if there will be a <dl> tag - only if there is some content.
$dl = count($item) > 0;
$attributes = [];

View File

@ -16,7 +16,7 @@
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}<span class="badge badge-info">{{{text}}}</span>{{/selected}}
{{#selected}}<span class="badge bg-info text-white">{{{text}}}</span>{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{#element.managestandardtagsurl}}

View File

@ -16,7 +16,7 @@
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}<span class="badge badge-info">{{{text}}}</span>{{/selected}}
{{#selected}}<span class="badge bg-info text-white">{{{text}}}</span>{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{#element.managestandardtagsurl}}

View File

@ -33,4 +33,4 @@
Example context (json):
{ "status": "OK"}
}}
<span class="badge badge-danger">{{status}}</span>
<span class="badge bg-danger text-white">{{status}}</span>

View File

@ -33,4 +33,4 @@
Example context (json):
{ "status": "OK"}
}}
<span class="badge badge-danger">{{status}}</span>
<span class="badge bg-danger text-white">{{status}}</span>

View File

@ -33,4 +33,4 @@
Example context (json):
{ "status": "OK"}
}}
<span class="badge badge-info">{{status}}</span>
<span class="badge bg-info text-white">{{status}}</span>

View File

@ -33,4 +33,4 @@
Example context (json):
{ "status": "OK"}
}}
<span class="badge badge-secondary">{{status}}</span>
<span class="badge bg-secondary text-dark">{{status}}</span>

View File

@ -33,4 +33,4 @@
Example context (json):
{ "status": "OK"}
}}
<span class="badge badge-success">{{status}}</span>
<span class="badge bg-success text-white">{{status}}</span>

View File

@ -33,4 +33,4 @@
Example context (json):
{ "status": "OK"}
}}
<span class="badge badge-success">{{status}}</span>
<span class="badge bg-success text-white">{{status}}</span>

View File

@ -33,4 +33,4 @@
Example context (json):
{ "status": "OK"}
}}
<span class="badge badge-warning">{{status}}</span>
<span class="badge bg-warning text-dark">{{status}}</span>

View File

@ -34,7 +34,7 @@
"classes": "p-1",
"selectall": "Select all",
"deselectall": "Deselect all",
"labelclasses": "badge badge-info"
"labelclasses": "badge bg-info text-white"
}
}}
<div class="form-check">

View File

@ -32,7 +32,7 @@
"label": "Select me!",
"checked": true,
"classes": "p-1",
"labelclasses": "badge badge-info"
"labelclasses": "badge bg-info text-white"
}
}}
<input id="{{id}}" name="{{name}}" type="checkbox" {{#classes}}class="{{.}}"{{/classes}} value="{{value}}"

View File

@ -42,7 +42,7 @@
}}
{{#items}}
<span role="option" data-value="{{value}}" aria-selected="true"
class="badge badge-secondary clickable text-wrap text-break line-height-4 m-1">
class="badge bg-secondary text-dark clickable text-wrap text-break line-height-4 m-1">
{{{label}}}<i class="icon fa fa-times pl-2 mr-0"></i>
</span>
{{/items}}

View File

@ -38,7 +38,7 @@
], "noSelectionString": "No selection" }
}}
{{#items}}
<span role="option" data-value="{{value}}" aria-selected="true" class="badge badge-secondary m-1" style="font-size: 100%">
<span role="option" data-value="{{value}}" aria-selected="true" class="badge bg-secondary text-dark m-1" style="font-size: 100%">
<span aria-hidden="true">× </span>{{{label}}}
</span>
{{/items}}

View File

@ -69,7 +69,7 @@
</p>
</div>
<div class="unread-count-container">
<span data-region="unread-count" class="badge badge-danger">{{unreadcount}}</span>
<span data-region="unread-count" class="badge bg-danger text-white">{{unreadcount}}</span>
</div>
</div>
</a>

View File

@ -98,7 +98,7 @@
</div>
<div class="d-flex align-self-center align-items-center">
<span
class="badge badge-pill badge-primary {{^unreadcount}}hidden{{/unreadcount}}"
class="badge rounded-pill bg-primary text-white {{^unreadcount}}hidden{{/unreadcount}}"
data-region="unread-count"
>
<span aria-hidden="true">{{unreadcount}}</span>

View File

@ -91,7 +91,7 @@
</div>
<span
class="badge badge-pill badge-primary {{^unreadcount}}hidden{{/unreadcount}}"
class="badge rounded-pill bg-primary text-white {{^unreadcount}}hidden{{/unreadcount}}"
data-region="unread-count"
>
{{unreadcount}}

View File

@ -64,7 +64,7 @@
aria-selected="false"
>
{{#str}} requests {{/str}}
<span class="badge badge-primary bg-primary ml-2 {{^contactrequestcount}}hidden{{/contactrequestcount}}"
<span class="badge bg-primary text-white ml-2 {{^contactrequestcount}}hidden{{/contactrequestcount}}"
data-region="contact-request-count"
>
<span aria-hidden="true">{{contactrequestcount}}</span>

View File

@ -68,7 +68,7 @@
{{#pix}} i/user, core {{/pix}}
{{#str}} contacts, core_message {{/str}}
<span
class="badge badge-primary bg-primary ml-2 {{^contactrequestcount}}hidden{{/contactrequestcount}}"
class="badge bg-primary text-white ml-2 {{^contactrequestcount}}hidden{{/contactrequestcount}}"
data-region="contact-request-count"
>
<span aria-hidden="true">{{contactrequestcount}}</span>

View File

@ -62,7 +62,7 @@
{{> core/loading }}
</span>
<span
class="{{^count.unread}}hidden{{/count.unread}} badge badge-pill badge-primary ml-auto bg-primary"
class="{{^count.unread}}hidden{{/count.unread}} badge rounded-pill bg-primary text-white ml-auto"
data-region="section-unread-count"
>
<span aria-hidden="true">{{count.unread}}</span>

View File

@ -215,12 +215,12 @@
</a>
</div>
<div>
<span class="badge badge-danger rounded" data-region="locked-label" {{^discussion.locked}}hidden{{/discussion.locked}}>
<span class="badge bg-danger text-white rounded" data-region="locked-label" {{^discussion.locked}}hidden{{/discussion.locked}}>
{{#str}}locked, forum{{/str}}
</span>
{{#discussion.timed.istimed}}
<span>
<button class="btn badge badge-primary rounded border-0" data-region="timed-label"
<button class="btn badge bg-primary text-white rounded border-0" data-region="timed-label"
data-toggle="popover" data-container="body" data-placement="right" data-html="true"
data-content="{{#discussion.timed}}{{#discussion.times}}{{> mod_forum/discussion_times}}{{/discussion.times}}{{/discussion.timed}}"
data-trigger="click" aria-label="{{#str}}timeddiscussion, forum{{/str}}" title="{{#str}}timeddiscussion, forum{{/str}}">
@ -304,7 +304,7 @@
{{#unread}}
{{! TODO Rewrite as AJAX}}
<span class="lead">
<a href="{{{discussion.urls.viewfirstunread}}}" class="badge badge-primary rounded-pill font-weight-normal"
<a href="{{{discussion.urls.viewfirstunread}}}" class="badge bg-primary text-white rounded-pill font-weight-normal"
title="{{#str}}unreadpostsnumber, mod_forum, {{unread}}{{/str}}" aria-label="{{#str}}unreadpostsnumber, mod_forum, {{unread}}{{/str}}">
{{unread}}
</a>

View File

@ -309,7 +309,7 @@
{{/readonly}}
<div class="ml-auto d-flex flex-column">
{{#haswordcount}}
<span class="ml-auto badge badge-light">
<span class="ml-auto badge bg-light text-dark">
{{#str}} numwords, core, {{wordcount}} {{/str}}
</span>
{{/haswordcount}}
@ -346,7 +346,7 @@
{{/readonly}}
{{/isdeleted}}
{{#discussionlocked}}
<div><span class="badge badge-danger mt-2">{{#str}} locked, mod_forum {{/str}}</span></div>
<div><span class="badge bg-danger text-white mt-2">{{#str}} locked, mod_forum {{/str}}</span></div>
{{/discussionlocked}}
{{/footer}}
</div>

View File

@ -752,7 +752,7 @@ function mod_glossary_get_tagged_entries($tag, $exclusivemode = false, $fromctx
$approved = "";
if (!$item->approved) {
$approved = '<br>'. html_writer::span(get_string('entrynotapproved', 'mod_glossary'), 'badge badge-warning');
$approved = '<br>'. html_writer::span(get_string('entrynotapproved', 'mod_glossary'), 'badge bg-warning text-dark');
}
$tagfeed->add($icon, $pagename, $cmname.'<br>'.$coursename.$approved);
}

View File

@ -421,13 +421,13 @@ switch ($mode) {
// Different colors for all the states of an essay (graded, if sent, not graded)
if (!$essayinfo->graded) {
$class = "badge badge-warning";
$class = "badge bg-warning text-dark";
$status = get_string('notgraded', 'lesson');
} elseif (!$essayinfo->sent) {
$class = "badge badge-success";
$class = "badge bg-success text-white";
$status = get_string('graded', 'lesson');
} else {
$class = "badge badge-success";
$class = "badge bg-success text-white";
$status = get_string('sent', 'lesson');
}
$attributes = array('tabindex' => 0);

View File

@ -344,7 +344,7 @@ class lesson_page_type_multichoice extends lesson_page {
foreach ($answers as $answer) {
$answertext = format_text($answer->answer,$answer->answerformat,$formattextdefoptions);
$correctresponsetext = html_writer::div(get_string('correctresponse', 'lesson'), 'badge badge-success');
$correctresponsetext = html_writer::div(get_string('correctresponse', 'lesson'), 'badge bg-success text-white');
if ($this->properties->qoption) {
if ($useranswer == null) {
$userresponse = array();

View File

@ -260,7 +260,7 @@ class lesson_page_type_truefalse extends lesson_page {
foreach ($answers as $answer) {
$answer = parent::rewrite_answers_urls($answer);
$answertext = format_text($answer->answer, $answer->answerformat, $formattextdefoptions);
$correctresponsetext = html_writer::div(get_string('correctresponse', 'lesson'), 'badge badge-success');
$correctresponsetext = html_writer::div(get_string('correctresponse', 'lesson'), 'badge bg-success text-white');
if ($this->properties->qoption) {
if ($useranswer == null) {
$userresponse = array();

View File

@ -100,10 +100,10 @@
<div class="tool-card-header">
<div class="tool-card-subheader">
<div class="badge
{{#state.pending}}badge-info{{/state.pending}}
{{#state.configured}}badge-success{{/state.configured}}
{{#state.rejected}}badge-danger{{/state.rejected}}
{{#state.unknown}}badge-warning{{/state.unknown}}">
{{#state.pending}}bg-info text-white{{/state.pending}}
{{#state.configured}}bg-success text-white{{/state.configured}}
{{#state.rejected}}bg-danger text-white{{/state.rejected}}
{{#state.unknown}}bg-warning text-dark{{/state.unknown}}">
{{state.text}}
</div>
<div class="tool-card-actions float-sm-right">

View File

@ -72,10 +72,10 @@
<div class="tool-card-header">
<div class="tool-card-subheader">
<div class="badge
{{#state.pending}}badge-info{{/state.pending}}
{{#state.configured}}badge-success{{/state.configured}}
{{#state.rejected}}badge-danger{{/state.rejected}}
{{#state.unknown}}badge-warning{{/state.unknown}}">
{{#state.pending}}bg-info text-white{{/state.pending}}
{{#state.configured}}bg-success text-white{{/state.configured}}
{{#state.rejected}}bg-danger text-white{{/state.rejected}}
{{#state.unknown}}bg-warning text-dark{{/state.unknown}}">
{{state.text}}
</div>
<div class="tool-card-actions float-sm-right">

View File

@ -1660,7 +1660,7 @@ function quiz_question_tostring($question, $showicon = false, $showquestiontext
if ($showidnumber && $question->idnumber !== null && $question->idnumber !== '') {
$result .= ' ' . html_writer::span(
html_writer::span(get_string('idnumber', 'question'), 'accesshide') .
' ' . s($question->idnumber), 'badge badge-primary');
' ' . s($question->idnumber), 'badge bg-primary text-white');
}
// Question tags.

View File

@ -52,10 +52,10 @@ foreach ($accounts as $account) {
}
$name = $account->get_formatted_name();
if (!$account->is_available()) {
$name .= ' ' . html_writer::span(get_string('accountnotavailable', 'payment'), 'badge badge-warning');
$name .= ' ' . html_writer::span(get_string('accountnotavailable', 'payment'), 'badge bg-warning text-dark');
}
if ($account->get('archived')) {
$name .= ' ' . html_writer::span(get_string('accountarchived', 'payment'), 'badge badge-secondary');
$name .= ' ' . html_writer::span(get_string('accountarchived', 'payment'), 'badge bg-secondary text-dark');
}
$menu = new action_menu();

View File

@ -38,7 +38,7 @@
<a title="{{#str}}editquestions, question{{/str}}" href="{{{questionbankurl}}}">
{{{categoryname}}}
{{#idnumber}}
<span class="badge badge-primary">
<span class="badge bg-primary text-white">
<span class="accesshide">
{{#str}}idnumber, question{{/str}}
</span>

View File

@ -71,7 +71,7 @@
</div>
{{/newerversion}}
<div class="d-flex">
<div class="badge-primary h-50 px-2 mt-n2">
<div class="bg-primary text-white h-50 px-2 mt-n2">
<span class="accesshide">ID number</span>
{{questionidumber}}
</div>

View File

@ -51,7 +51,7 @@ class question_name_idnumber_tags_column extends viewquestionname_column_helper
if ($question->idnumber !== null && $question->idnumber !== '') {
echo ' ' . \html_writer::span(
\html_writer::span(get_string('idnumber', 'question') . '&nbsp;', 'accesshide')
. \html_writer::span(s($question->idnumber), 'badge badge-primary'), 'ml-1');
. \html_writer::span(s($question->idnumber), 'badge bg-primary text-white'), 'ml-1');
}
// Question tags.

View File

@ -151,7 +151,7 @@ class reports_list extends system_report {
->add_callback(function(string $value, stdClass $row) {
if (!$this->report_source_valid($value)) {
// Add danger badge if report source is not valid (either it's missing, or has errors).
return html_writer::span(get_string('errorsourceinvalid', 'core_reportbuilder'), 'badge badge-danger');
return html_writer::span(get_string('errorsourceinvalid', 'core_reportbuilder'), 'badge bg-danger text-white');
}
return call_user_func([$value, 'get_name']);

View File

@ -53,7 +53,7 @@
<ul class="inline-list">
{{#tags}}
<li {{#overlimit}}class="overlimit"{{/overlimit}}>
<a href="{{viewurl}}" class="badge badge-info {{#isstandard}}standardtag{{/isstandard}}" >
<a href="{{viewurl}}" class="badge bg-info text-white {{#isstandard}}standardtag{{/isstandard}}" >
{{#flag}}
<span class="flagged-tag">{{name}}</span></a>
{{/flag}}

View File

@ -1,6 +1,10 @@
This file describes API changes in /theme/boost
information provided here is intended especially for theme designers.
=== 4.4 ===
* Bootstrap badge color helper clases (badge-[primary|secondary|...]) are no longer used, use bg-[primary|secondary|...] instead.
* Bootstrap badge-pill is no longer used, use rounded-pill instead.
=== 4.3 ===
* The $activity-iconcontainer-height and $activity-iconcontainer-width variables have been changed from 50px to 52px.
* New SCSS mixin optional_animate to animate an element unless if the user has reduced motion in their preferences.

View File

@ -35,7 +35,7 @@
"coursename": "TC 1",
"enrolinstancename": "Manual enrolment",
"status": "Active",
"statusclass": "badge badge-success",
"statusclass": "badge bg-success text-white",
"timestart": "1 January 2017",
"timeend": "31 January 2018",
"timeenrolled": "31 December 2016"

View File

@ -61,7 +61,7 @@
}}
<div data-fullname="{{fullname}}" data-coursename="{{coursename}}" data-enrolinstancename="{{enrolinstancename}}"
data-status="{{status}}" data-timestart="{{timestart}}" data-timeend="{{timeend}}" data-timeenrolled="{{timeenrolled}}">
<span class="badge {{#active}}badge-success{{/active}}{{#suspended}}badge-warning{{/suspended}}{{#notcurrent}}badge-secondary{{/notcurrent}}">{{status}}</span>
<span class="badge {{#active}}bg-success text-white{{/active}}{{#suspended}}bg-warning text-dark{{/suspended}}{{#notcurrent}}bg-secondary text-dark{{/notcurrent}}">{{status}}</span>
<a data-action="showdetails" href="#" role="button" tabindex="0">{{!
}}{{#pix}}docs, core, {{enrolinstancename}}{{/pix}}{{!
}}</a>

View File

@ -182,7 +182,7 @@ class token_table extends \table_sql {
if ($data->serviceshortname <> MOODLE_OFFICIAL_MOBILE_SERVICE && !is_siteadmin($data->userid)
&& array_key_exists($data->userid, $usermissingcaps)) {
$count = \html_writer::span(count($usermissingcaps[$data->userid]), 'badge badge-danger');
$count = \html_writer::span(count($usermissingcaps[$data->userid]), 'badge bg-danger text-white');
$links = array_map(function($capname) {
return get_capability_docs_link((object)['name' => $capname]) . \html_writer::div($capname, 'text-muted');
}, $usermissingcaps[$data->userid]);

View File

@ -126,7 +126,7 @@ class core_webservice_renderer extends plugin_renderer_base {
$link = html_writer::link($settingsurl, fullname($user));
if (!empty($user->missingcapabilities)) {
$count = html_writer::span(count($user->missingcapabilities), 'badge badge-danger');
$count = html_writer::span(count($user->missingcapabilities), 'badge bg-danger text-white');
$links = array_map(function($capname) {
return get_capability_docs_link((object)['name' => $capname]) . html_writer::div($capname, 'text-muted');
}, $user->missingcapabilities);
@ -674,7 +674,7 @@ EOF;
$tags = '';
if (!empty($description->deprecated)) {
$tags .= ' ' . html_writer::span(get_string('deprecated', 'core_webservice'), 'badge badge-warning');
$tags .= ' ' . html_writer::span(get_string('deprecated', 'core_webservice'), 'badge bg-warning text-dark');
}
if (empty($printableformat)) {