Merge branch 'MDL-87444-main' of https://github.com/roland04/moodle

This commit is contained in:
Huong Nguyen
2026-01-16 15:14:30 +08:00
committed by Jake Dallimore
13 changed files with 153 additions and 124 deletions
@@ -212,10 +212,19 @@ class edit_table extends XMLDBAction {
$row = 0;
foreach ($fields as $field) {
// Drag element up/down.
$move = (count($fields) > 1) ? html_writer::span($OUTPUT->render_from_template('core/drag_handle',
['movetitle' => get_string('movecontent', 'moodle', $field->getName())]), '',
['data-action' => 'move_updown_field', 'data-dir' => str_replace($CFG->dirroot, '', $dirpath),
'data-table' => $table->getName(), 'data-field' => $field->getName()]) : '';
$draghandle = html_writer::span(
content: $OUTPUT->render_from_template(
'core/drag_handle',
['movetitle' => get_string('movecontent', 'moodle', $field->getName()), 'extraclasses' => 'me-2']
),
attributes: [
'data-action' => 'move_updown_field',
'data-dir' => str_replace($CFG->dirroot, '', $dirpath),
'data-table' => $table->getName(),
'data-field' => $field->getName(),
]
);
$move = (count($fields) > 1) ? $draghandle : '';
// The field name (link to edit - if the field has no uses)
if (!$structure->getFieldUses($table->getName(), $field->getName())) {
$f = '<a href="index.php?action=edit_field&amp;field=' .$field->getName() . '&amp;table=' . $table->getName() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">' . $field->getName() . '</a>';
@@ -263,10 +272,19 @@ class edit_table extends XMLDBAction {
$row = 0;
foreach ($keys as $key) {
// Drag element up/down.
$move = (count($keys) > 1) ? html_writer::span($OUTPUT->render_from_template('core/drag_handle',
['movetitle' => get_string('movecontent', 'moodle', $key->getName())]), '',
['data-action' => 'move_updown_key', 'data-dir' => str_replace($CFG->dirroot, '', $dirpath),
'data-table' => $table->getName(), 'data-key' => $key->getName()]) : '';
$draghandle = html_writer::span(
content: $OUTPUT->render_from_template(
'core/drag_handle',
['movetitle' => get_string('movecontent', 'moodle', $field->getName()), 'extraclasses' => 'me-2']
),
attributes: [
'data-action' => 'move_updown_key',
'data-dir' => str_replace($CFG->dirroot, '', $dirpath),
'data-table' => $table->getName(),
'data-key' => $key->getName(),
]
);
$move = (count($keys) > 1) ? $draghandle : '';
// The key name (link to edit - if the key has no uses)
if (!$structure->getKeyUses($table->getName(), $key->getName())) {
$k = '<a href="index.php?action=edit_key&amp;key=' .$key->getName() . '&amp;table=' . $table->getName() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">' . $key->getName() . '</a>';
@@ -309,10 +327,19 @@ class edit_table extends XMLDBAction {
$row = 0;
foreach ($indexes as $index) {
// Drag element up/down.
$move = (count($indexes) > 1) ? html_writer::span($OUTPUT->render_from_template('core/drag_handle',
['movetitle' => get_string('movecontent', 'moodle', $index->getName())]), '',
['data-action' => 'move_updown_index', 'data-dir' => str_replace($CFG->dirroot, '', $dirpath),
'data-table' => $table->getName(), 'data-index' => $index->getName()]) : '';
$draghandle = html_writer::span(
content: $OUTPUT->render_from_template(
'core/drag_handle',
['movetitle' => get_string('movecontent', 'moodle', $field->getName()), 'extraclasses' => 'me-2']
),
attributes: [
'data-action' => 'move_updown_index',
'data-dir' => str_replace($CFG->dirroot, '', $dirpath),
'data-table' => $table->getName(),
'data-index' => $index->getName(),
]
);
$move = (count($indexes) > 1) ? $draghandle : '';
// The index name (link to edit)
$i = '<a href="index.php?action=edit_index&amp;index=' .$index->getName() . '&amp;table=' . $table->getName() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">' . $index->getName() . '</a>';
// Calculate buttons
@@ -183,10 +183,17 @@ class edit_xml_file extends XMLDBAction {
$row = 0;
foreach ($tables as $table) {
// Drag element for sortorder.
$move = html_writer::span($OUTPUT->render_from_template('core/drag_handle',
['movetitle' => get_string('movecontent', 'moodle', $table->getName())]), '',
['data-action' => 'move_updown_table', 'data-dir' => str_replace($CFG->dirroot, '', $dirpath),
'data-table' => $table->getName()]);
$move = html_writer::span(
content: $OUTPUT->render_from_template(
'core/drag_handle',
['movetitle' => get_string('movecontent', 'moodle', $table->getName()), 'extraclasses' => 'me-2']
),
attributes: [
'data-action' => 'move_updown_table',
'data-dir' => str_replace($CFG->dirroot, '', $dirpath),
'data-table' => $table->getName(),
]
);
// The table name (link to edit table)
$t = '<a href="index.php?action=edit_table&amp;table=' . $table->getName() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">' . $table->getName() . '</a>';
// Calculate buttons
+9 -2
View File
@@ -21,9 +21,16 @@
Example context (json):
{
"movetitle": "Move this element"
"movetitle": "Move this element",
"extraclasses": "icon-size-2"
}
}}
<button type="button" class="btn btn-icon" aria-haspopup="true" data-drag-type="move" title="{{movetitle}}" aria-label="{{movetitle}}">
<button type="button"
class="btn btn-icon {{$ extraclasses }}{{extraclasses}}{{/ extraclasses }}"
title="{{movetitle}}"
data-drag-type="move"
aria-haspopup="true"
aria-label="{{movetitle}}"
>
{{#pix}} i/dragdrop, core {{/pix}}
</button>
@@ -261,7 +261,7 @@ class custom_report_table extends base_report_table {
]);
echo html_writer::tag('th', $headercell, [
'class' => 'border-end border-start',
'class' => 'border-end border-start p-2',
'scope' => 'col',
'data-region' => 'column-header',
'data-column-id' => $column->get_persistent()->get('id'),
@@ -28,14 +28,14 @@
}}
<div class="condition list-group-item list-group-item-action text-dark" data-region="active-condition"
data-condition-id="{{id}}" data-condition-name="{{heading}}" data-condition-position="{{sortorder}}">
<div class="condition-header d-flex align-items-start">
{{>core/drag_handle}}
<div>
<div class="d-flex">
<small class="text-muted text-uppercase">{{entityname}} • {{heading}}</small>
</div>
<div class="condition-header d-flex align-items-center">
{{<core/drag_handle}}
{{$extraclasses}}icon-size-2{{/extraclasses}}
{{/core/drag_handle}}
<div class="d-flex ms-2">
<small class="text-muted text-uppercase">{{entityname}} • {{heading}}</small>
</div>
<button class="btn btn-link p-0 ms-auto"
<button class="btn btn-icon icon-size-2 p-0 ms-auto"
type="button"
data-action="report-remove-condition"
title="{{#str}}deletecondition, core_reportbuilder, {{{heading}}}{{/str}}"
@@ -65,24 +65,26 @@
{{#hasactivefilters}}
<ul class="list-group reportbuilder-sortable-list mt-2 ms-0">
{{#activefilters}}
<li class="list-group-item list-group-item-action d-flex align-items-start text-dark"
<li class="list-group-item list-group-item-action text-dark"
data-region="active-filter" data-filter-id="{{id}}" data-filter-name="{{heading}}" data-filter-position="{{sortorder}}">
{{>core/drag_handle}}
<div>
<div class="d-flex">
<div class="d-flex align-items-center mb-1">
{{<core/drag_handle}}
{{$extraclasses}}icon-size-2{{/extraclasses}}
{{/core/drag_handle}}
<div class="d-flex ms-2">
<small class="text-muted text-uppercase">{{entityname}} • {{heading}}</small>
</div>
<div>
{{{headingeditable}}}
</div>
<button class="btn btn-icon icon-size-2 p-0 ms-auto"
type="button"
data-action="report-remove-filter"
title="{{#str}}deletefilter, core_reportbuilder, {{{heading}}}{{/str}}"
aria-label="{{#str}}deletefilter, core_reportbuilder, {{{heading}}}{{/str}}">
{{#pix}}e/cancel, core{{/pix}}
</button>
</div>
<div>
{{{headingeditable}}}
</div>
<button class="btn btn-link p-0 ms-auto"
type="button"
data-action="report-remove-filter"
title="{{#str}}deletefilter, core_reportbuilder, {{{heading}}}{{/str}}"
aria-label="{{#str}}deletefilter, core_reportbuilder, {{{heading}}}{{/str}}">
{{#pix}}e/cancel, core{{/pix}}
</button>
</li>
{{/activefilters}}
</ul>
@@ -53,7 +53,9 @@
data-column-sort-name="{{title}}"
data-column-sort-direction="{{sortdirection}}"
data-column-sort-position="{{sortorder}}">
{{>core/drag_handle}}
{{<core/drag_handle}}
{{$extraclasses}}icon-size-2 me-1{{/extraclasses}}
{{/core/drag_handle}}
{{#sorticon}}
<span class="float-end">
<button id="toggle-sort-direction-{{id}}"
@@ -29,13 +29,15 @@
}}
<div class="d-flex justify-content-start">
<div class="me-2">
{{>core/drag_handle}}
{{<core/drag_handle}}
{{$extraclasses}}icon-size-2{{/extraclasses}}
{{/core/drag_handle}}
</div>
<div class="w-100">
<div class="d-flex justify-content-between mb-2">
<small class="text-muted text-nowrap fw-normal text-uppercase">{{entityname}} &bull; {{name}}</small>
<small class="text-muted text-nowrap fw-normal text-uppercase mt-1">{{entityname}} &bull; {{name}}</small>
<span class="text-nowrap">
<button class="btn btn-link p-0"
<button class="btn btn-icon icon-size-2 ms-1 p-0"
data-action="report-remove-column"
type="button"
title="{{#str}}deletecolumn, core_reportbuilder, {{{name}}}{{/str}}"
+2 -2
View File
@@ -98,8 +98,8 @@ p.arrow_button {
}
@each $size, $length in $iconsizes {
&.icon-size-#{$size} {
height: calc(#{$length} + 1rem);
width: calc(#{$length} + 1rem);
height: calc(#{$length} * 2);
width: calc(#{$length} * 2);
--#{$prefix}btn-font-size: #{$length};
--#{$prefix}btn-line-height: #{$length};
}
+4 -4
View File
@@ -18,8 +18,8 @@ $icon-box-height: 48px;
$iconsizes: () !default;
$iconsizes: map-merge((
0: 0,
1: ($icon-height * .25),
2: ($icon-height * .5),
1: ($icon-height * .5),
2: ($icon-height * .75),
3: $icon-height,
4: ($icon-height * 1.5),
5: ($icon-height * 2),
@@ -29,8 +29,8 @@ $iconsizes: map-merge((
$iconwidthsizes: () !default;
$iconwidthsizes: map-merge((
0: 0,
1: ($icon-width * .25),
2: ($icon-width * .5),
1: ($icon-width * .5),
2: ($icon-width * .75),
3: $icon-width,
4: ($icon-width * 1.5),
5: ($icon-width * 2),
@@ -241,12 +241,6 @@ $rb-right-sidebar-width: 350px !default;
.list-group-item {
padding: .75rem;
.icon {
width: 12px;
height: 12px;
font-size: 12px;
color: $body-color;
}
button[data-action="report-remove-filter"],
button[data-action="report-remove-condition"] {
.icon {
+28 -34
View File
@@ -28627,14 +28627,6 @@ img.icon {
}
.icon-size-1 .icon {
height: 4px !important; /* stylelint-disable-line declaration-no-important */
width: 5px !important; /* stylelint-disable-line declaration-no-important */
max-height: 4px !important; /* stylelint-disable-line declaration-no-important */
max-width: 5px !important; /* stylelint-disable-line declaration-no-important */
font-size: 4px !important; /* stylelint-disable-line declaration-no-important */
}
.icon-size-2 .icon {
height: 8px !important; /* stylelint-disable-line declaration-no-important */
width: 10px !important; /* stylelint-disable-line declaration-no-important */
max-height: 8px !important; /* stylelint-disable-line declaration-no-important */
@@ -28642,6 +28634,14 @@ img.icon {
font-size: 8px !important; /* stylelint-disable-line declaration-no-important */
}
.icon-size-2 .icon {
height: 12px !important; /* stylelint-disable-line declaration-no-important */
width: 15px !important; /* stylelint-disable-line declaration-no-important */
max-height: 12px !important; /* stylelint-disable-line declaration-no-important */
max-width: 15px !important; /* stylelint-disable-line declaration-no-important */
font-size: 12px !important; /* stylelint-disable-line declaration-no-important */
}
.icon-size-3 .icon {
height: 16px !important; /* stylelint-disable-line declaration-no-important */
width: 20px !important; /* stylelint-disable-line declaration-no-important */
@@ -37565,50 +37565,50 @@ p.arrow_button {
margin: 0;
}
.btn-icon.icon-size-0 {
height: calc(0 + 1rem);
width: calc(0 + 1rem);
height: calc(0 * 2);
width: calc(0 * 2);
--bs-btn-font-size: 0;
--bs-btn-line-height: 0;
}
.btn-icon.icon-size-1 {
height: calc(4px + 1rem);
width: calc(4px + 1rem);
--bs-btn-font-size: 4px;
--bs-btn-line-height: 4px;
}
.btn-icon.icon-size-2 {
height: calc(8px + 1rem);
width: calc(8px + 1rem);
height: calc(8px * 2);
width: calc(8px * 2);
--bs-btn-font-size: 8px;
--bs-btn-line-height: 8px;
}
.btn-icon.icon-size-2 {
height: calc(12px * 2);
width: calc(12px * 2);
--bs-btn-font-size: 12px;
--bs-btn-line-height: 12px;
}
.btn-icon.icon-size-3 {
height: calc(16px + 1rem);
width: calc(16px + 1rem);
height: calc(16px * 2);
width: calc(16px * 2);
--bs-btn-font-size: 16px;
--bs-btn-line-height: 16px;
}
.btn-icon.icon-size-4 {
height: calc(24px + 1rem);
width: calc(24px + 1rem);
height: calc(24px * 2);
width: calc(24px * 2);
--bs-btn-font-size: 24px;
--bs-btn-line-height: 24px;
}
.btn-icon.icon-size-5 {
height: calc(32px + 1rem);
width: calc(32px + 1rem);
height: calc(32px * 2);
width: calc(32px * 2);
--bs-btn-font-size: 32px;
--bs-btn-line-height: 32px;
}
.btn-icon.icon-size-6 {
height: calc(40px + 1rem);
width: calc(40px + 1rem);
height: calc(40px * 2);
width: calc(40px * 2);
--bs-btn-font-size: 40px;
--bs-btn-line-height: 40px;
}
.btn-icon.icon-size-7 {
height: calc(48px + 1rem);
width: calc(48px + 1rem);
height: calc(48px * 2);
width: calc(48px * 2);
--bs-btn-font-size: 48px;
--bs-btn-line-height: 48px;
}
@@ -40406,12 +40406,6 @@ div.editor_atto_toolbar button .icon {
.reportbuilder-sidebar-settings .list-group-item {
padding: 0.75rem;
}
.reportbuilder-sidebar-settings .list-group-item .icon {
width: 12px;
height: 12px;
font-size: 12px;
color: #1d2125;
}
.reportbuilder-sidebar-settings .list-group-item button[data-action=report-remove-filter] .icon,
.reportbuilder-sidebar-settings .list-group-item button[data-action=report-remove-condition] .icon {
margin-right: 0;
+28 -34
View File
@@ -28627,14 +28627,6 @@ img.icon {
}
.icon-size-1 .icon {
height: 4px !important; /* stylelint-disable-line declaration-no-important */
width: 5px !important; /* stylelint-disable-line declaration-no-important */
max-height: 4px !important; /* stylelint-disable-line declaration-no-important */
max-width: 5px !important; /* stylelint-disable-line declaration-no-important */
font-size: 4px !important; /* stylelint-disable-line declaration-no-important */
}
.icon-size-2 .icon {
height: 8px !important; /* stylelint-disable-line declaration-no-important */
width: 10px !important; /* stylelint-disable-line declaration-no-important */
max-height: 8px !important; /* stylelint-disable-line declaration-no-important */
@@ -28642,6 +28634,14 @@ img.icon {
font-size: 8px !important; /* stylelint-disable-line declaration-no-important */
}
.icon-size-2 .icon {
height: 12px !important; /* stylelint-disable-line declaration-no-important */
width: 15px !important; /* stylelint-disable-line declaration-no-important */
max-height: 12px !important; /* stylelint-disable-line declaration-no-important */
max-width: 15px !important; /* stylelint-disable-line declaration-no-important */
font-size: 12px !important; /* stylelint-disable-line declaration-no-important */
}
.icon-size-3 .icon {
height: 16px !important; /* stylelint-disable-line declaration-no-important */
width: 20px !important; /* stylelint-disable-line declaration-no-important */
@@ -37565,50 +37565,50 @@ p.arrow_button {
margin: 0;
}
.btn-icon.icon-size-0 {
height: calc(0 + 1rem);
width: calc(0 + 1rem);
height: calc(0 * 2);
width: calc(0 * 2);
--bs-btn-font-size: 0;
--bs-btn-line-height: 0;
}
.btn-icon.icon-size-1 {
height: calc(4px + 1rem);
width: calc(4px + 1rem);
--bs-btn-font-size: 4px;
--bs-btn-line-height: 4px;
}
.btn-icon.icon-size-2 {
height: calc(8px + 1rem);
width: calc(8px + 1rem);
height: calc(8px * 2);
width: calc(8px * 2);
--bs-btn-font-size: 8px;
--bs-btn-line-height: 8px;
}
.btn-icon.icon-size-2 {
height: calc(12px * 2);
width: calc(12px * 2);
--bs-btn-font-size: 12px;
--bs-btn-line-height: 12px;
}
.btn-icon.icon-size-3 {
height: calc(16px + 1rem);
width: calc(16px + 1rem);
height: calc(16px * 2);
width: calc(16px * 2);
--bs-btn-font-size: 16px;
--bs-btn-line-height: 16px;
}
.btn-icon.icon-size-4 {
height: calc(24px + 1rem);
width: calc(24px + 1rem);
height: calc(24px * 2);
width: calc(24px * 2);
--bs-btn-font-size: 24px;
--bs-btn-line-height: 24px;
}
.btn-icon.icon-size-5 {
height: calc(32px + 1rem);
width: calc(32px + 1rem);
height: calc(32px * 2);
width: calc(32px * 2);
--bs-btn-font-size: 32px;
--bs-btn-line-height: 32px;
}
.btn-icon.icon-size-6 {
height: calc(40px + 1rem);
width: calc(40px + 1rem);
height: calc(40px * 2);
width: calc(40px * 2);
--bs-btn-font-size: 40px;
--bs-btn-line-height: 40px;
}
.btn-icon.icon-size-7 {
height: calc(48px + 1rem);
width: calc(48px + 1rem);
height: calc(48px * 2);
width: calc(48px * 2);
--bs-btn-font-size: 48px;
--bs-btn-line-height: 48px;
}
@@ -40340,12 +40340,6 @@ div.editor_atto_toolbar button .icon {
.reportbuilder-sidebar-settings .list-group-item {
padding: 0.75rem;
}
.reportbuilder-sidebar-settings .list-group-item .icon {
width: 12px;
height: 12px;
font-size: 12px;
color: #1d2125;
}
.reportbuilder-sidebar-settings .list-group-item button[data-action=report-remove-filter] .icon,
.reportbuilder-sidebar-settings .list-group-item button[data-action=report-remove-condition] .icon {
margin-right: 0;