mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-81742 mod_feedback: Improve 'Edit' page navigation
- Remove 'Use template' from edit page tertiary navigation - Create a new 'Actions' menu in the tertiary naviagation - Move 'Import' tertiary navigation to the actions menu - Move 'Export' button to the actions menu - Move 'Save as new template' to the actions menu - Convert add question select into an action menu - Fix related behat scenarios
This commit is contained in:
parent
d3ae1391ab
commit
f61201c947
7
.upgradenotes/MDL-81742-2024061108544588.yml
Normal file
7
.upgradenotes/MDL-81742-2024061108544588.yml
Normal file
@ -0,0 +1,7 @@
|
||||
issueNumber: MDL-81742
|
||||
notes:
|
||||
mod_feedback:
|
||||
- message: >-
|
||||
The method `mod_feedback\output\renderer::create_template_form()` has
|
||||
been deprecated. It is not used anymore.
|
||||
type: deprecated
|
@ -246,6 +246,9 @@ class icon_system_fontawesome extends icon_system_font {
|
||||
'core:i/link' => 'fa-link',
|
||||
'core:i/externallink' => 'fa-external-link',
|
||||
'core:i/files' => 'fa-file',
|
||||
'core:i/file_plus' => 'fa-file-circle-plus',
|
||||
'core:i/file_export' => 'fa-file-export',
|
||||
'core:i/file_import' => 'fa-file-import',
|
||||
'core:i/filter' => 'fa-filter',
|
||||
'core:i/flagged' => 'fa-flag',
|
||||
'core:i/folder' => 'fa-folder',
|
||||
|
@ -17,9 +17,9 @@
|
||||
namespace mod_feedback\output;
|
||||
|
||||
use moodle_url;
|
||||
use action_link;
|
||||
use single_select;
|
||||
use url_select;
|
||||
use action_menu;
|
||||
use action_menu_link;
|
||||
use pix_icon;
|
||||
|
||||
/**
|
||||
* Class actionbar - Display the action bar
|
||||
@ -53,48 +53,83 @@ class edit_action_bar extends base_action_bar {
|
||||
* @return array
|
||||
*/
|
||||
public function get_items(): array {
|
||||
global $DB;
|
||||
if (!has_capability('mod/feedback:edititems', $this->context)) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
'addselect' => $this->get_add_question_menu(),
|
||||
'actionsselect' => $this->get_edit_actions_menu(),
|
||||
];
|
||||
}
|
||||
|
||||
$url = new moodle_url('/mod/feedback/view.php', ['id' => $this->cmid]);
|
||||
$items['left'][]['actionlink'] = new action_link($url, get_string('back'), null, ['class' => 'btn btn-secondary']);
|
||||
|
||||
if (has_capability('mod/feedback:edititems', $this->context)) {
|
||||
$editurl = new moodle_url('/mod/feedback/edit.php', $this->urlparams);
|
||||
$templateurl = new moodle_url('/mod/feedback/manage_templates.php', $this->urlparams);
|
||||
$importurl = new moodle_url('/mod/feedback/import.php', $this->urlparams);
|
||||
|
||||
$options = [
|
||||
$editurl->out(false) => get_string('add_item', 'feedback'),
|
||||
$templateurl->out(false) => get_string('using_templates', 'feedback'),
|
||||
$importurl->out(false) => get_string('import_questions', 'feedback')
|
||||
];
|
||||
|
||||
$selected = $this->currenturl;
|
||||
// Template pages can have sub pages, so match these.
|
||||
if ($this->currenturl->compare(new moodle_url('/mod/feedback/use_templ.php'), URL_MATCH_BASE)) {
|
||||
$selected = $templateurl;
|
||||
}
|
||||
|
||||
$items['left'][]['urlselect'] = new url_select($options, $selected->out(false), null);
|
||||
|
||||
$viewquestions = $editurl->compare($this->currenturl);
|
||||
if ($viewquestions) {
|
||||
$select = new single_select(new moodle_url('/mod/feedback/edit_item.php',
|
||||
['cmid' => $this->cmid, 'position' => $this->lastposition, 'sesskey' => sesskey()]),
|
||||
'typ', feedback_load_feedback_items_options());
|
||||
$items['left'][]['singleselect'] = $select;
|
||||
|
||||
if ($DB->record_exists('feedback_item', ['feedback' => $this->feedback->id])) {
|
||||
$items['export'] = new action_link(
|
||||
new moodle_url('/mod/feedback/export.php', $this->urlparams + ['action' => 'exportfile']),
|
||||
get_string('export_questions', 'feedback'),
|
||||
null,
|
||||
['class' => 'btn btn-secondary'],
|
||||
);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the add question menu
|
||||
*
|
||||
* @return action_menu
|
||||
*/
|
||||
private function get_add_question_menu(): action_menu {
|
||||
$addselect = new action_menu();
|
||||
$addselect->set_menu_trigger(get_string('add_item', 'mod_feedback'), 'btn btn-primary');
|
||||
$addselect->set_menu_left();
|
||||
$addselectparams = ['cmid' => $this->cmid, 'position' => $this->lastposition, 'sesskey' => sesskey()];
|
||||
foreach (feedback_load_feedback_items_options() as $key => $value) {
|
||||
$addselect->add(new action_menu_link(
|
||||
new moodle_url('/mod/feedback/edit_item.php', $addselectparams + ['typ' => $key]),
|
||||
null,
|
||||
$value,
|
||||
false,
|
||||
));
|
||||
}
|
||||
|
||||
return $items;
|
||||
return $addselect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the edit actions menu
|
||||
*
|
||||
* @return action_menu
|
||||
*/
|
||||
private function get_edit_actions_menu(): action_menu {
|
||||
global $DB, $PAGE;
|
||||
|
||||
$actionsselect = new action_menu();
|
||||
$actionsselect->set_menu_trigger(get_string('actions'), 'btn btn-outline-primary');
|
||||
|
||||
// Export.
|
||||
if ($DB->record_exists('feedback_item', ['feedback' => $this->feedback->id])) {
|
||||
$exporturl = new moodle_url('/mod/feedback/export.php', $this->urlparams + ['action' => 'exportfile']);
|
||||
$actionsselect->add(new action_menu_link(
|
||||
$exporturl,
|
||||
new pix_icon('i/file_export', get_string('export_questions', 'feedback')),
|
||||
get_string('export_questions', 'feedback'),
|
||||
false,
|
||||
));
|
||||
}
|
||||
|
||||
// Import.
|
||||
$importurl = new moodle_url('/mod/feedback/import.php', $this->urlparams);
|
||||
$actionsselect->add(new action_menu_link(
|
||||
$importurl,
|
||||
new pix_icon('i/file_import', get_string('import_questions', 'feedback')),
|
||||
get_string('import_questions', 'feedback'),
|
||||
false,
|
||||
));
|
||||
|
||||
// Save as template.
|
||||
$cancreatetemplates = has_any_capability([
|
||||
'mod/feedback:createprivatetemplate',
|
||||
'mod/feedback:createpublictemplate'], \context_module::instance($this->cmid));
|
||||
if ($cancreatetemplates) {
|
||||
$PAGE->requires->js_call_amd('mod_feedback/createtemplate', 'init');
|
||||
$actionsselect->add(new action_menu_link(
|
||||
new moodle_url('#'),
|
||||
new pix_icon('i/file_plus', get_string('save_as_new_template', 'feedback')),
|
||||
get_string('save_as_new_template', 'feedback'),
|
||||
false,
|
||||
['data-action' => 'createtemplate', 'data-dataid' => $this->cmid],
|
||||
));
|
||||
}
|
||||
|
||||
return $actionsselect;
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,13 @@ class renderer extends plugin_renderer_base {
|
||||
*
|
||||
* @param int $id
|
||||
* @return bool|string
|
||||
* @deprecated since 4.5
|
||||
* @todo MDL-82164 This will be deleted in Moodle 6.0.
|
||||
*/
|
||||
#[\core\attribute\deprecated(replacement: null, since: '4.5')]
|
||||
public function create_template_form(int $id) {
|
||||
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
|
||||
|
||||
return $this->render_from_template('mod_feedback/create_template', ['id' => $id]);
|
||||
}
|
||||
}
|
||||
|
@ -63,13 +63,9 @@ if ($deleteitem) {
|
||||
redirect($url);
|
||||
}
|
||||
|
||||
// Process the create template form.
|
||||
$cancreatetemplates = has_capability('mod/feedback:createprivatetemplate', $context) ||
|
||||
has_capability('mod/feedback:createpublictemplate', $context);
|
||||
|
||||
//Get the feedbackitems
|
||||
$lastposition = 0;
|
||||
$feedbackitems = $DB->get_records('feedback_item', array('feedback'=>$feedback->id), 'position');
|
||||
$feedbackitems = $DB->get_records('feedback_item', ['feedback' => $feedback->id], 'position');
|
||||
if (is_array($feedbackitems)) {
|
||||
$feedbackitems = array_values($feedbackitems);
|
||||
if (count($feedbackitems) > 0) {
|
||||
@ -93,16 +89,21 @@ $PAGE->add_body_class('limitedwidth');
|
||||
|
||||
//Adding the javascript module for the items dragdrop.
|
||||
if (count($feedbackitems) > 1) {
|
||||
$PAGE->requires->strings_for_js(array(
|
||||
'pluginname',
|
||||
'move_item',
|
||||
'position',
|
||||
), 'feedback');
|
||||
$PAGE->requires->yui_module('moodle-mod_feedback-dragdrop', 'M.mod_feedback.init_dragdrop',
|
||||
array(array('cmid' => $cm->id)));
|
||||
$PAGE->requires->strings_for_js([
|
||||
'pluginname',
|
||||
'move_item',
|
||||
'position',
|
||||
], 'feedback');
|
||||
$PAGE->requires->yui_module(
|
||||
'moodle-mod_feedback-dragdrop',
|
||||
'M.mod_feedback.init_dragdrop',
|
||||
[['cmid' => $cm->id]]
|
||||
);
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('edit_items', 'mod_feedback'), 3);
|
||||
|
||||
/** @var \mod_feedback\output\renderer $renderer */
|
||||
$renderer = $PAGE->get_renderer('mod_feedback');
|
||||
echo $renderer->main_action_bar($actionbar);
|
||||
@ -112,8 +113,4 @@ echo '<div id="feedback_dragarea">'; // The container for the dragging area.
|
||||
$form->display();
|
||||
echo '</div>';
|
||||
|
||||
if ($cancreatetemplates) {
|
||||
echo $renderer->create_template_form($id);
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -31,7 +31,7 @@ $id = required_param('id', PARAM_INT);
|
||||
$choosefile = optional_param('choosefile', false, PARAM_PATH);
|
||||
$action = optional_param('action', false, PARAM_ALPHA);
|
||||
|
||||
$url = new moodle_url('/mod/feedback/import.php', array('id'=>$id));
|
||||
$url = new moodle_url('/mod/feedback/import.php', ['id' => $id]);
|
||||
if ($choosefile !== false) {
|
||||
$url->param('choosefile', $choosefile);
|
||||
}
|
||||
@ -44,11 +44,11 @@ if (! $cm = get_coursemodule_from_id('feedback', $id)) {
|
||||
throw new \moodle_exception('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", ["id" => $cm->course])) {
|
||||
throw new \moodle_exception('coursemisconf');
|
||||
}
|
||||
|
||||
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
|
||||
if (! $feedback = $DB->get_record("feedback", ["id" => $cm->instance])) {
|
||||
throw new \moodle_exception('invalidcoursemodule');
|
||||
}
|
||||
|
||||
@ -57,14 +57,15 @@ $context = context_module::instance($cm->id);
|
||||
require_login($course, true, $cm);
|
||||
|
||||
require_capability('mod/feedback:edititems', $context);
|
||||
$actionbar = new \mod_feedback\output\edit_action_bar($cm->id, $url);
|
||||
|
||||
$mform = new feedback_import_form();
|
||||
$newformdata = array('id'=>$id,
|
||||
'deleteolditems'=>'1',
|
||||
'action'=>'choosefile',
|
||||
'confirmadd'=>'1',
|
||||
'do_show'=>'templates');
|
||||
$newformdata = [
|
||||
'id' => $id,
|
||||
'deleteolditems' => '1',
|
||||
'action' => 'choosefile',
|
||||
'confirmadd' => '1',
|
||||
'do_show' => 'templates',
|
||||
];
|
||||
$mform->set_data($newformdata);
|
||||
$formdata = $mform->get_data();
|
||||
|
||||
@ -99,18 +100,17 @@ $PAGE->activityheader->set_attrs([
|
||||
"hidecompletion" => true,
|
||||
"description" => ''
|
||||
]);
|
||||
$PAGE->add_body_class('limitedwidth');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
/** @var \mod_feedback\output\renderer $renderer */
|
||||
$renderer = $PAGE->get_renderer('mod_feedback');
|
||||
echo $renderer->main_action_bar($actionbar);
|
||||
|
||||
/// Print the main part of the page
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(get_string('import_questions', 'feedback'), 3);
|
||||
}
|
||||
echo $OUTPUT->heading(get_string('import_questions', 'feedback'), 3);
|
||||
|
||||
if (isset($importerror->msg) AND is_array($importerror->msg)) {
|
||||
echo $OUTPUT->box_start('generalbox errorboxcontent boxaligncenter');
|
||||
@ -150,7 +150,7 @@ function feedback_import_loaded_data(&$data, $feedbackid) {
|
||||
|
||||
$error = new stdClass();
|
||||
$error->stat = true;
|
||||
$error->msg = array();
|
||||
$error->msg = [];
|
||||
|
||||
if (!is_array($data)) {
|
||||
$error->msg[] = get_string('data_is_not_an_array', 'feedback');
|
||||
@ -163,13 +163,13 @@ function feedback_import_loaded_data(&$data, $feedbackid) {
|
||||
$position = 0;
|
||||
} else {
|
||||
//items will be add to the end of the existing items
|
||||
$position = $DB->count_records('feedback_item', array('feedback'=>$feedbackid));
|
||||
$position = $DB->count_records('feedback_item', ['feedback' => $feedbackid]);
|
||||
}
|
||||
|
||||
//depend items we are storing temporary in an mapping list array(new id => dependitem)
|
||||
//we also store a mapping of all items array(oldid => newid)
|
||||
$dependitemsmap = array();
|
||||
$itembackup = array();
|
||||
// Depend items we are storing temporary in an mapping list [new id => dependitem].
|
||||
// We also store a mapping of all items [oldid => newid].
|
||||
$dependitemsmap = [];
|
||||
$itembackup = [];
|
||||
foreach ($data as $item) {
|
||||
$position++;
|
||||
//check the typ
|
||||
@ -269,7 +269,7 @@ function feedback_import_loaded_data(&$data, $feedbackid) {
|
||||
}
|
||||
//remapping the dependency
|
||||
foreach ($dependitemsmap as $key => $dependitem) {
|
||||
$newitem = $DB->get_record('feedback_item', array('id'=>$key));
|
||||
$newitem = $DB->get_record('feedback_item', ['id' => $key]);
|
||||
$newitem->dependitem = $itembackup[$newitem->dependitem];
|
||||
$DB->update_record('feedback_item', $newitem);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class feedback_import_form extends moodleform {
|
||||
$mform->addElement('radio', 'deleteolditems', '', $strnodeleteolditmes);
|
||||
|
||||
// buttons
|
||||
$this->add_action_buttons(false, get_string('save'));
|
||||
$this->add_action_buttons(true, get_string('import'));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -169,15 +169,20 @@
|
||||
</div>
|
||||
{{/singleselect}}
|
||||
{{/left}}
|
||||
{{#addselect}}
|
||||
<div class="navitem">
|
||||
{{> core/action_menu }}
|
||||
</div>
|
||||
{{/addselect}}
|
||||
{{#usetemplate }}
|
||||
<div class="navitem">
|
||||
{{> mod_feedback/use_template }}
|
||||
</div>
|
||||
{{/usetemplate}}
|
||||
{{#export}}
|
||||
{{#actionsselect}}
|
||||
<div class="navitem ml-sm-auto">
|
||||
{{> core/action_link }}
|
||||
{{> core/action_menu }}
|
||||
</div>
|
||||
{{/export}}
|
||||
{{/actionsselect}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -50,7 +50,8 @@ class behat_mod_feedback extends behat_base {
|
||||
public function i_add_question_to_the_feedback_with($questiontype, TableNode $questiondata) {
|
||||
|
||||
$questiontype = $this->escape($questiontype);
|
||||
$this->execute('behat_forms::i_select_from_the_singleselect', array($questiontype, 'typ'));
|
||||
$this->execute('behat_general::i_click_on', [get_string('add_item', 'mod_feedback'), 'link']);
|
||||
$this->execute('behat_general::i_click_on', [$questiontype, 'link']);
|
||||
|
||||
// Wait again, for page to reloaded.
|
||||
$this->execute('behat_general::i_wait_to_be_redirected');
|
||||
@ -81,7 +82,8 @@ class behat_mod_feedback extends behat_base {
|
||||
public function i_add_a_page_break_to_the_feedback() {
|
||||
|
||||
$questiontype = $this->escape(get_string('add_pagebreak', 'feedback'));
|
||||
$this->execute('behat_forms::i_select_from_the_singleselect', array($questiontype, 'typ'));
|
||||
$this->execute('behat_general::i_click_on', [get_string('add_item', 'mod_feedback'), 'link']);
|
||||
$this->execute('behat_general::i_click_on', [$questiontype, 'link']);
|
||||
|
||||
// Wait again, for page to reloaded.
|
||||
$this->execute('behat_general::i_wait_to_be_redirected');
|
||||
|
@ -40,7 +40,7 @@ Feature: Exporting and importing feedbacks
|
||||
| Label | multichoice1 |
|
||||
| Multiple choice type | Multiple choice - single answer |
|
||||
| Multiple choice values | option a\noption b\noption c |
|
||||
And I select "Add a page break" from the "typ" singleselect
|
||||
And I add a page break to the feedback
|
||||
And I add a "Multiple choice" question to the feedback with:
|
||||
| Question | this is a multiple choice 2 |
|
||||
| Label | multichoice2 |
|
||||
@ -68,7 +68,6 @@ Feature: Exporting and importing feedbacks
|
||||
| Label | shorttext |
|
||||
| Maximum characters accepted | 200 |
|
||||
Then following "Export questions" should export feedback identical to "mod/feedback/tests/fixtures/testexport.xml"
|
||||
And I log out
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Import feedback deleting old items
|
||||
@ -78,10 +77,10 @@ Feature: Exporting and importing feedbacks
|
||||
| Question | Existing question |
|
||||
| Label | numeric |
|
||||
| Range to | 100 |
|
||||
And I select "Import questions" from the "jump" singleselect
|
||||
And I press "Actions"
|
||||
And I choose "Import" in the open action menu
|
||||
And I upload "mod/feedback/tests/fixtures/testexport.xml" file to "File" filemanager
|
||||
And I press "Save"
|
||||
And I select "Add question" from the "jump" singleselect
|
||||
And I press "Import"
|
||||
Then I should not see "Existing question"
|
||||
And I should see "this is an information question"
|
||||
And I should see "label text"
|
||||
@ -101,11 +100,11 @@ Feature: Exporting and importing feedbacks
|
||||
| Question | Existing question |
|
||||
| Label | numeric |
|
||||
| Range to | 100 |
|
||||
And I select "Import questions" from the "jump" singleselect
|
||||
And I press "Actions"
|
||||
And I choose "Import" in the open action menu
|
||||
And I set the field "Append new items" to "1"
|
||||
And I upload "mod/feedback/tests/fixtures/testexport.xml" file to "File" filemanager
|
||||
And I press "Save"
|
||||
And I select "Add question" from the "jump" singleselect
|
||||
And I press "Import"
|
||||
Then I should see "Existing question"
|
||||
And "Existing question" "text" should appear before "this is an information question" "text"
|
||||
And I should see "this is an information question"
|
||||
|
@ -33,7 +33,7 @@ Feature: Testing multichoice questions in feedback
|
||||
| Multiple choice values | option a\noption b\noption c |
|
||||
And I add a "Text and media area" question to the feedback with:
|
||||
| Contents | this is the first page of the feedback |
|
||||
And I select "Add a page break" from the "typ" singleselect
|
||||
And I add a page break to the feedback
|
||||
And I add a "Multiple choice" question to the feedback with:
|
||||
| Question | this is a multiple choice 2 |
|
||||
| Label | multichoice2 |
|
||||
@ -42,7 +42,7 @@ Feature: Testing multichoice questions in feedback
|
||||
| Required | 1 |
|
||||
And I add a "Text and media area" question to the feedback with:
|
||||
| Contents | this is the second page of the feedback |
|
||||
And I select "Add a page break" from the "typ" singleselect
|
||||
And I add a page break to the feedback
|
||||
And I add a "Multiple choice" question to the feedback with:
|
||||
| Question | this is a multiple choice 3 |
|
||||
| Label | multichoice3 |
|
||||
@ -161,7 +161,6 @@ Feature: Testing multichoice questions in feedback
|
||||
And I should see "1 (100.00 %)" in the "option a" "table_row"
|
||||
And I should not see "%" in the "option b" "table_row"
|
||||
And I should not see "%" in the "option c" "table_row"
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario: Non-rated multiple-answers multiple choice questions in feedback
|
||||
@ -173,7 +172,7 @@ Feature: Testing multichoice questions in feedback
|
||||
| Multiple choice values | option a\noption b\noption c |
|
||||
And I add a "Text and media area" question to the feedback with:
|
||||
| Contents | this is the first page of the feedback |
|
||||
And I select "Add a page break" from the "typ" singleselect
|
||||
And I add a page break to the feedback
|
||||
And I add a "Multiple choice" question to the feedback with:
|
||||
| Question | this is a multiple choice 2 |
|
||||
| Label | multichoice2 |
|
||||
@ -182,7 +181,7 @@ Feature: Testing multichoice questions in feedback
|
||||
| Required | 1 |
|
||||
And I add a "Text and media area" question to the feedback with:
|
||||
| Contents | this is the second page of the feedback |
|
||||
And I select "Add a page break" from the "typ" singleselect
|
||||
And I add a page break to the feedback
|
||||
And I add a "Multiple choice" question to the feedback with:
|
||||
| Question | this is a multiple choice 3 |
|
||||
| Label | multichoice3 |
|
||||
@ -301,7 +300,6 @@ Feature: Testing multichoice questions in feedback
|
||||
And I should see "1 (100.00 %)" in the "option a" "table_row"
|
||||
And I should see "1 (100.00 %)" in the "option b" "table_row"
|
||||
And I should not see "%" in the "option c" "table_row"
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario: Non-rated single-answer dropdown multiple choice questions in feedback
|
||||
@ -312,7 +310,7 @@ Feature: Testing multichoice questions in feedback
|
||||
| Multiple choice values | option a\noption b\noption c |
|
||||
And I add a "Text and media area" question to the feedback with:
|
||||
| Contents | this is the first page of the feedback |
|
||||
And I select "Add a page break" from the "typ" singleselect
|
||||
And I add a page break to the feedback
|
||||
And I add a "Multiple choice" question to the feedback with:
|
||||
| Question | this is a multiple choice 2 |
|
||||
| Label | multichoice2 |
|
||||
@ -321,7 +319,7 @@ Feature: Testing multichoice questions in feedback
|
||||
| Required | 1 |
|
||||
And I add a "Text and media area" question to the feedback with:
|
||||
| Contents | this is the second page of the feedback |
|
||||
And I select "Add a page break" from the "typ" singleselect
|
||||
And I add a page break to the feedback
|
||||
And I add a "Multiple choice" question to the feedback with:
|
||||
| Question | this is a multiple choice 3 |
|
||||
| Label | multichoice3 |
|
||||
|
@ -39,24 +39,26 @@ Feature: Saving, using and deleting feedback templates
|
||||
# Go to feedback templates and make sure none exist yet
|
||||
When I am on the "Learning experience course 1" "feedback activity" page logged in as teacher
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
Then I should see "No templates available yet"
|
||||
And "Use a template" "field" should not exist
|
||||
And "Public" "field" should not exist
|
||||
And I select "Add question" from the "jump" singleselect
|
||||
# Save as a course template
|
||||
And I press "Save as new template"
|
||||
And I navigate to "Feedback" in current page administration
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I press "Actions"
|
||||
And I choose "Save as new template" in the open action menu
|
||||
And I should see "Save as new template" in the ".modal-title" "css_element"
|
||||
And I should see "Name" in the ".modal-body" "css_element"
|
||||
And I set the field "Name" to "My first template"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
And I should see "Template saved"
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
And I should see "My first template"
|
||||
# Create a feedback from this template in the same course
|
||||
And I am on the "Another feedback in course 1" "feedback activity" page
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
And I follow "My first template"
|
||||
And I should see "this is a multiple choice 1"
|
||||
And I press "Use this template"
|
||||
@ -65,21 +67,22 @@ Feature: Saving, using and deleting feedback templates
|
||||
# Make sure this template is not available in another course
|
||||
And I am on the "Learning experience course 2" "feedback activity" page
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
And I should see "No templates available yet"
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario: Teacher can append template to existing questions or remove them
|
||||
# Save feedback as a course template
|
||||
When I am on the "Learning experience course 1" "feedback activity" page logged in as teacher
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I press "Save as new template"
|
||||
And I press "Actions"
|
||||
And I choose "Save as new template" in the open action menu
|
||||
And I should see "Save as new template" in the ".modal-title" "css_element"
|
||||
And I should see "Name" in the ".modal-body" "css_element"
|
||||
And I set the field "Name" to "My first template"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
And I press "Save as new template"
|
||||
And I press "Actions"
|
||||
And I choose "Save as new template" in the open action menu
|
||||
# Add questions to another feedback
|
||||
And I am on the "Another feedback in course 1" "feedback activity" page
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
@ -89,14 +92,14 @@ Feature: Saving, using and deleting feedback templates
|
||||
| Multiple choice type | Multiple choice - single answer |
|
||||
| Multiple choice values | Maths\bScience\nEnglish\nOther |
|
||||
# Import template appending items
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
And I follow "My first template"
|
||||
And I press "Use this template"
|
||||
And I set the field "Append new items" to "1"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
Then "What is your favourite subject" "text" should appear before "this is a multiple choice 1" "text"
|
||||
# Import template replacing items
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
And I follow "My first template"
|
||||
And I press "Use this template"
|
||||
And I set the field "Delete old items" to "1"
|
||||
@ -109,81 +112,80 @@ Feature: Saving, using and deleting feedback templates
|
||||
Scenario: Manager can save template as public and it will be available in any course
|
||||
When I am on the "Learning experience course 1" "feedback activity" page logged in as manager
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I press "Save as new template"
|
||||
And I press "Actions"
|
||||
And I choose "Save as new template" in the open action menu
|
||||
And I set the field "Name" to "My first template"
|
||||
And I set the field "Public" to "1"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
And I log out
|
||||
And I am on the "Learning experience course 2" "feedback activity" page logged in as teacher
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
And I follow "My first template"
|
||||
And I should see "this is a multiple choice 1"
|
||||
And I press "Use this template"
|
||||
And I set the field "Delete old items" to "1"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
Then I should see "this is a multiple choice 1"
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario: Teacher can delete course templates but can not delete public templates
|
||||
# Save feedback as both public and course template
|
||||
When I am on the "Learning experience course 1" "feedback activity" page logged in as manager
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I press "Save as new template"
|
||||
And I press "Actions"
|
||||
And I choose "Save as new template" in the open action menu
|
||||
And I set the field "Name" to "My public template"
|
||||
And I set the field "Public" to "1"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
And I press "Save as new template"
|
||||
And I press "Actions"
|
||||
And I choose "Save as new template" in the open action menu
|
||||
And I set the field "Name" to "My course template"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
And I log out
|
||||
# Login as teacher and try to delete templates
|
||||
And I am on the "Another feedback in course 1" "feedback activity" page logged in as teacher
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
And I follow "My public template"
|
||||
Then I should not see "Delete"
|
||||
And I click on "Back" "link" in the ".tertiary-navigation" "css_element"
|
||||
And "My course template" "text" should exist in the ".coursetemplates" "css_element"
|
||||
And I follow "My course template"
|
||||
And I click on "Delete" "link"
|
||||
And I click on "Delete template" "link" in the "My course template" "table_row"
|
||||
And I click on "Yes" "button"
|
||||
And I should see "Template deleted"
|
||||
And "My course template" "text" should not exist in the ".coursetemplates" "css_element"
|
||||
And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element"
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario: Manager can delete both course and public templates
|
||||
# Save feedback as both public and course template
|
||||
When I am on the "Learning experience course 1" "feedback activity" page logged in as manager
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I press "Save as new template"
|
||||
And I press "Actions"
|
||||
And I choose "Save as new template" in the open action menu
|
||||
And I set the field "Name" to "My public template"
|
||||
And I set the field "Public" to "1"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
And I press "Save as new template"
|
||||
And I press "Actions"
|
||||
And I choose "Save as new template" in the open action menu
|
||||
And I set the field "Name" to "My course template"
|
||||
And I click on "Save" "button" in the ".modal-dialog" "css_element"
|
||||
# Delete course template
|
||||
And I select "Use a template" from the "jump" singleselect
|
||||
And I navigate to "Templates" in current page administration
|
||||
Then "My public template" "text" should exist in the ".publictemplates" "css_element"
|
||||
And "My course template" "text" should exist in the ".coursetemplates" "css_element"
|
||||
And I follow "My course template"
|
||||
And I click on "Delete" "link"
|
||||
And I click on "Delete template" "link" in the "My course template" "table_row"
|
||||
And I should see "Are you sure you want to delete this template?"
|
||||
And I press "Yes"
|
||||
And I should see "Template deleted"
|
||||
And "My course template" "text" should not exist in the ".coursetemplates" "css_element"
|
||||
And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element"
|
||||
And "My public template" "text" should exist in the ".publictemplates" "css_element"
|
||||
And I follow "My public template"
|
||||
And I click on "Delete" "link"
|
||||
And I click on "Delete template" "link" in the "My public template" "table_row"
|
||||
And I should see "Are you sure you want to delete this template?"
|
||||
And I press "Yes"
|
||||
And I should see "Template deleted"
|
||||
And "My public template" "text" should not exist in the ".publictemplates" "css_element"
|
||||
And "No templates available yet" "text" should exist in the ".publictemplates" "css_element"
|
||||
And I should see "No templates available yet"
|
||||
And I log out
|
||||
|
1
pix/i/file_export.svg
Normal file
1
pix/i/file_export.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V288H216c-13.3 0-24 10.7-24 24s10.7 24 24 24H384V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM384 336V288H494.1l-39-39c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l80 80c9.4 9.4 9.4 24.6 0 33.9l-80 80c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l39-39H384zm0-208H256V0L384 128z"/></svg>
|
After Width: | Height: | Size: 567 B |
1
pix/i/file_import.svg
Normal file
1
pix/i/file_import.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M128 64c0-35.3 28.7-64 64-64H352V128c0 17.7 14.3 32 32 32H512V448c0 35.3-28.7 64-64 64H192c-35.3 0-64-28.7-64-64V336H302.1l-39 39c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l80-80c9.4-9.4 9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l39 39H128V64zm0 224v48H24c-13.3 0-24-10.7-24-24s10.7-24 24-24H128zM512 128H384V0L512 128z"/></svg>
|
After Width: | Height: | Size: 570 B |
1
pix/i/file_plus.svg
Normal file
1
pix/i/file_plus.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384v38.6C310.1 219.5 256 287.4 256 368c0 59.1 29.1 111.3 73.7 143.3c-3.2 .5-6.4 .7-9.7 .7H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zm48 96a144 144 0 1 1 0 288 144 144 0 1 1 0-288zm16 80c0-8.8-7.2-16-16-16s-16 7.2-16 16v48H368c-8.8 0-16 7.2-16 16s7.2 16 16 16h48v48c0 8.8 7.2 16 16 16s16-7.2 16-16V384h48c8.8 0 16-7.2 16-16s-7.2-16-16-16H448V304z"/></svg>
|
After Width: | Height: | Size: 638 B |
Loading…
x
Reference in New Issue
Block a user