MDL-81587 quiz: fix layout of the add/edit random UI

Some of the removed CSS seems no longer relevant now that we have
customisation options for the layout of the question bank.
This commit is contained in:
Tim Hunt 2024-04-17 17:50:02 +01:00
parent 792698af00
commit 78eeb7ea57
6 changed files with 30 additions and 52 deletions

View File

@ -31,14 +31,22 @@ class preview_action_column extends \core_question\local\bank\column_base {
return ['iconcol'];
}
#[\Override]
public function get_title(): string {
return ' ';
}
#[\Override]
public function get_name() {
return 'previewquestionaction';
}
#[\Override]
public function get_default_width(): int {
return 45;
}
#[\Override]
protected function display_content($question, $rowclasses) {
global $PAGE;
if (!question_has_capability_on($question, 'use')) {

View File

@ -27,10 +27,18 @@ namespace mod_quiz\question\bank;
*/
class question_name_text_column extends question_name_column {
#[\Override]
public function get_name(): string {
return 'questionnametext';
}
#[\Override]
public function get_default_width(): int {
// In the places this is used, this seems to make it use all the available space, without overflowing.
return 800;
}
#[\Override]
protected function display_content($question, $rowclasses): void {
echo \html_writer::start_tag('div');
$labelfor = $this->label_for($question);
@ -44,6 +52,7 @@ class question_name_text_column extends question_name_column {
echo \html_writer::end_tag('div');
}
#[\Override]
public function get_required_fields(): array {
$fields = parent::get_required_fields();
$fields[] = 'q.questiontext';
@ -52,6 +61,7 @@ class question_name_text_column extends question_name_column {
return $fields;
}
#[\Override]
public function load_additional_data(array $questions) {
parent::load_additional_data($questions);
parent::load_question_tags($questions);

View File

@ -16,6 +16,8 @@
namespace mod_quiz\question\bank;
use qbank_viewquestiontype\question_type_column;
/**
* Subclass to customise the view of the question bank for the quiz editing screen.
*
@ -25,24 +27,16 @@ namespace mod_quiz\question\bank;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class random_question_view extends custom_view {
/**
* Init required columns.
*
* @return void
*/
protected function init_required_columns(): void {
// Override core columns.
$this->corequestionbankcolumns = [
'question_type_column',
'question_name_text_column',
'preview_action_column'
#[\Override]
protected function get_question_bank_plugins(): array {
return [
new question_type_column($this),
new question_name_text_column($this),
new preview_action_column($this),
];
}
/**
* Prints the table of questions in a category with interactions
*
* @param \context $catcontext*/
#[\Override]
protected function display_bottom_controls(\context $catcontext): void {
}
}

View File

@ -147,12 +147,7 @@ table.question-bank-table {
table-layout: fixed;
overflow-x: scroll;
width: min-content;
td,
th {
max-width: 40vw;
width: max-content;
}
max-width: 100%;
th {
text-align: left;
@ -676,12 +671,3 @@ body.path-question-type .mform fieldset.hidden {
margin: 0;
}
}
@include media-breakpoint-down(md) {
.question-bank-table {
td,
th {
max-width: 75vw;
}
}
}

View File

@ -31975,11 +31975,7 @@ table.question-bank-table {
table-layout: fixed;
overflow-x: scroll;
width: min-content;
}
table.question-bank-table td,
table.question-bank-table th {
max-width: 40vw;
width: max-content;
max-width: 100%;
}
table.question-bank-table th {
text-align: left;
@ -32525,12 +32521,6 @@ body.path-question-type .mform fieldset.hidden {
margin: 0;
}
}
@media (max-width: 991.98px) {
.question-bank-table td,
.question-bank-table th {
max-width: 75vw;
}
}
/* user.less */
.userprofile .fullprofilelink {
text-align: center;

View File

@ -31975,11 +31975,7 @@ table.question-bank-table {
table-layout: fixed;
overflow-x: scroll;
width: min-content;
}
table.question-bank-table td,
table.question-bank-table th {
max-width: 40vw;
width: max-content;
max-width: 100%;
}
table.question-bank-table th {
text-align: left;
@ -32525,12 +32521,6 @@ body.path-question-type .mform fieldset.hidden {
margin: 0;
}
}
@media (max-width: 991.98px) {
.question-bank-table td,
.question-bank-table th {
max-width: 75vw;
}
}
/* user.less */
.userprofile .fullprofilelink {
text-align: center;