diff --git a/public/mod/data/classes/output/action_bar.php b/public/mod/data/classes/output/action_bar.php index a4a9beb5822..1c878c01c2a 100644 --- a/public/mod/data/classes/output/action_bar.php +++ b/public/mod/data/classes/output/action_bar.php @@ -33,12 +33,12 @@ class action_bar { /** @var int $id The database module id. */ private $id; - /** @var int $cmid The database course module id. */ - private $cmid; - /** @var moodle_url $currenturl The URL of the current page. */ private $currenturl; + /** @var \cm_info $cm the course module. */ + private $cm; + /** * The class constructor. * @@ -48,7 +48,7 @@ class action_bar { public function __construct(int $id, moodle_url $pageurl) { $this->id = $id; [$course, $cm] = get_course_and_cm_from_instance($this->id, 'data'); - $this->cmid = $cm->id; + $this->cm = $cm; $this->currenturl = $pageurl; } @@ -111,7 +111,7 @@ class action_bar { $triggerclasses = ['btn']; $triggerclasses[] = $isprimarybutton ? 'btn-primary' : 'btn-secondary'; $fieldselect->set_menu_trigger(get_string('newfield', 'mod_data'), join(' ', $triggerclasses)); - $fieldselectparams = ['id' => $this->cmid, 'mode' => 'new']; + $fieldselectparams = ['id' => $this->cm->id, 'mode' => 'new']; foreach ($menufield as $fieldtype => $fieldname) { $fieldselectparams['newtype'] = $fieldtype; $fieldselect->add(new \action_menu_link( @@ -135,10 +135,9 @@ class action_bar { */ public function get_view_action_bar(bool $hasentries, string $mode): string { global $PAGE; - $viewlistlink = new moodle_url('/mod/data/view.php', ['d' => $this->id]); $viewsinglelink = new moodle_url('/mod/data/view.php', ['d' => $this->id, 'mode' => 'single']); - + $manager = manager::create_from_coursemodule($this->cm); $menu = [ $viewlistlink->out(false) => get_string('listview', 'mod_data'), $viewsinglelink->out(false) => get_string('singleview', 'mod_data'), @@ -152,8 +151,28 @@ class action_bar { $urlselect = new url_select($menu, $activeurl->out(false), null, 'viewactionselect'); $urlselect->set_label(get_string('viewnavigation', 'mod_data'), ['class' => 'visually-hidden']); + $cm = $manager->get_coursemodule(); + $instance = $manager->get_instance(); + $currentgroup = groups_get_activity_group($cm); + $groupmode = groups_get_activity_groupmode($cm); + $context = $manager->get_context(); + if (data_user_can_add_entry($instance, $currentgroup, $groupmode, $context)) { + $backtourl = new moodle_url($this->currenturl); + $backtourl->param('mode', $mode); + $addentrylink = new moodle_url( + '/mod/data/edit.php', + ['id' => $this->cm->id, 'backto' => $backtourl] + ); + $addentrybutton = new \core\output\action_link( + $addentrylink, + get_string('add', 'mod_data'), + null, + ['class' => 'btn btn-primary mx-1', 'role' => 'button'] + ); + } $renderer = $PAGE->get_renderer('mod_data'); - $viewactionbar = new view_action_bar($this->id, $urlselect, $hasentries, $mode); + + $viewactionbar = new view_action_bar($this->id, $urlselect, $hasentries, $mode, $addentrybutton ?? null); return $renderer->render_view_action_bar($viewactionbar); } @@ -233,7 +252,7 @@ class action_bar { global $PAGE; $renderer = $PAGE->get_renderer('mod_data'); - $presetsactionbar = new presets_action_bar($this->cmid, $this->get_presets_actions_select(true)); + $presetsactionbar = new presets_action_bar($this->cm->id, $this->get_presets_actions_select(true)); return $renderer->render_presets_action_bar($presetsactionbar); } @@ -302,20 +321,20 @@ class action_bar { if ($hasimport) { // Import. - $actionsselectparams = ['id' => $this->cmid]; + $actionsselectparams = ['id' => $this->cm->id]; $actionsselect->add(new \action_menu_link( new moodle_url('/mod/data/preset.php', $actionsselectparams), null, get_string('importpreset', 'mod_data'), false, - ['data-action' => 'importpresets', 'data-dataid' => $this->cmid] + ['data-action' => 'importpresets', 'data-dataid' => $this->cm->id] )); } // If the database has no fields, export and save as preset options shouldn't be displayed. if ($hasfields) { // Export. - $actionsselectparams = ['id' => $this->cmid, 'action' => 'export']; + $actionsselectparams = ['id' => $this->cm->id, 'action' => 'export']; $actionsselect->add(new \action_menu_link( new moodle_url('/mod/data/preset.php', $actionsselectparams), null, diff --git a/public/mod/data/classes/output/view_action_bar.php b/public/mod/data/classes/output/view_action_bar.php index d54d9601f01..dbec4b378e2 100644 --- a/public/mod/data/classes/output/view_action_bar.php +++ b/public/mod/data/classes/output/view_action_bar.php @@ -16,6 +16,7 @@ namespace mod_data\output; +use core\output\action_link; use data_portfolio_caller; use mod_data\manager; use moodle_url; @@ -44,6 +45,9 @@ class view_action_bar implements templatable, renderable { /** @var bool $mode The current view mode (list, view...). */ private $mode; + /** @var action_link|null $addentrylink The add entry link */ + private ?action_link $addentrylink = null; + /** * The class constructor. * @@ -51,12 +55,20 @@ class view_action_bar implements templatable, renderable { * @param \url_select $urlselect The URL selector object. * @param bool $hasentries Whether entries exist. * @param string $mode The current view mode (list, view...). + * @param action_link|null $addentrylink The add entry link */ - public function __construct(int $id, \url_select $urlselect, bool $hasentries, string $mode) { + public function __construct( + int $id, + \url_select $urlselect, + bool $hasentries, + string $mode, + ?action_link $addentrylink = null + ) { $this->id = $id; $this->urlselect = $urlselect; $this->hasentries = $hasentries; $this->mode = $mode; + $this->addentrylink = $addentrylink; } /** @@ -142,7 +154,9 @@ class view_action_bar implements templatable, renderable { if ($actionsselect) { $data['actionsselect'] = $actionsselect->export_for_template($output); } - + if ($this->addentrylink) { + $data['addentrybutton'] = $this->addentrylink->export_for_template($output); + } return $data; } } diff --git a/public/mod/data/classes/output/view_footer.php b/public/mod/data/classes/output/view_footer.php index 1c3a8305bba..ec09a89dc7f 100644 --- a/public/mod/data/classes/output/view_footer.php +++ b/public/mod/data/classes/output/view_footer.php @@ -16,8 +16,8 @@ namespace mod_data\output; -use action_link; -use core\output\sticky_footer; +use core\output\renderable; +use core\output\templatable; use html_writer; use mod_data\manager; use mod_data\template; @@ -25,14 +25,13 @@ use moodle_url; use renderer_base; /** - * Renderable class for sticky footer in the view pages of the database activity. + * Renderable class for footer in the view pages of the database activity. * * @package mod_data * @copyright 2022 Ferran Recio * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class view_footer extends sticky_footer { - +class view_footer implements renderable, templatable { /** @var int $totalcount the total records count. */ private $totalcount; @@ -84,30 +83,12 @@ class view_footer extends sticky_footer { * @return array data context for a mustache template */ public function export_for_template(renderer_base $output) { - $this->set_content( - $this->get_footer_output($output) - ); - return parent::export_for_template($output); - } - - /** - * Generate the pre-rendered footer content. - * - * @param \renderer_base $output The renderer to be used to render the action bar elements. - * @return string the rendered content - */ - public function get_footer_output(renderer_base $output): string { $data = []; - $cm = $this->manager->get_coursemodule(); - $instance = $this->manager->get_instance(); - $currentgroup = groups_get_activity_group($cm); - $groupmode = groups_get_activity_groupmode($cm); $context = $this->manager->get_context(); $canmanageentries = has_capability('mod/data:manageentries', $context); $parser = $this->parser; - // Sticky footer content. $data['pagination'] = $output->paging_bar( $this->totalcount, $this->currentpage, @@ -138,19 +119,6 @@ class view_footer extends sticky_footer { 'data-toggle' => 'action', ]); } - if (data_user_can_add_entry($instance, $currentgroup, $groupmode, $context)) { - $addentrylink = new moodle_url( - '/mod/data/edit.php', - ['id' => $cm->id, 'backto' => $this->baseurl] - ); - $addentrybutton = new action_link( - $addentrylink, - get_string('add', 'mod_data'), - null, - ['class' => 'btn btn-primary mx-1', 'role' => 'button'] - ); - $data['addentrybutton'] = $addentrybutton->export_for_template($output); - } - return $output->render_from_template('mod_data/view_footer', $data); + return $data; } } diff --git a/public/mod/data/edit.php b/public/mod/data/edit.php index 2208bf4c75c..96475657236 100644 --- a/public/mod/data/edit.php +++ b/public/mod/data/edit.php @@ -198,29 +198,35 @@ if (empty($redirectbackto)) { $redirectbackto = new \moodle_url('/mod/data/view.php', ['id' => $cm->id]); } -$actionbuttons = html_writer::link( - $redirectbackto, - get_string('cancel'), - ['class' => 'btn btn-secondary mx-1', 'role' => 'button'] -); +$actionbuttons = ''; +if ( + !$rid && ( + (!$data->maxentries) || + has_capability('mod/data:manageentries', $context) || + (data_numentries($data) < ($data->maxentries - 1)) + ) +) { + $actionbuttons .= html_writer::empty_tag('input', [ + 'type' => 'submit', + 'name' => 'saveandadd', + 'value' => get_string('saveandadd', 'data'), + 'class' => 'btn btn-primary mx-1', + ]); +} $actionbuttons .= html_writer::empty_tag('input', [ 'type' => 'submit', 'name' => 'saveandview', 'value' => get_string('save'), - 'class' => 'btn btn-primary mx-1' + 'class' => 'btn btn-primary mx-1', ]); -if (!$rid && ((!$data->maxentries) || - has_capability('mod/data:manageentries', $context) || - (data_numentries($data) < ($data->maxentries - 1)))) { - $actionbuttons .= html_writer::empty_tag('input', [ - 'type' => 'submit', 'name' => 'saveandadd', - 'value' => get_string('saveandadd', 'data'), 'class' => 'btn btn-primary mx-1' - ]); -} +$actionbuttons .= html_writer::link( + $redirectbackto, + get_string('cancel'), + ['class' => 'btn btn-secondary mx-1', 'role' => 'button'] +); -$stickyfooter = new core\output\sticky_footer($actionbuttons); -echo $OUTPUT->render($stickyfooter); +echo html_writer::div($actionbuttons, 'mt-2'); echo $OUTPUT->box_end(); echo ''; diff --git a/public/mod/data/lib.php b/public/mod/data/lib.php index 50aacbf7897..85764133a6e 100644 --- a/public/mod/data/lib.php +++ b/public/mod/data/lib.php @@ -463,10 +463,7 @@ class data_field_base { // Base class for Database Field Types (see field/*/ 'class' => 'btn btn-primary mx-1' ]); $actionbuttons .= html_writer::end_div(); - - $stickyfooter = new core\output\sticky_footer($actionbuttons); - echo $OUTPUT->render($stickyfooter); - + echo $actionbuttons; echo ''; echo $OUTPUT->box_end(); diff --git a/public/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature b/public/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature index 471d7013f10..b245e60dc6d 100644 --- a/public/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature +++ b/public/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature @@ -87,7 +87,7 @@ Feature: Users can use the Image gallery preset When I press "Add entry" And I set the field "title" to "New image" And I set the field "description" to "This is the description for the new image." - And I press "Save" + And I press "saveandview" Then I should see "New image" And I should see "This is the description for the new image." diff --git a/public/mod/data/preset/journal/tests/behat/journal_preset.feature b/public/mod/data/preset/journal/tests/behat/journal_preset.feature index 3013aebac77..33c163e9686 100644 --- a/public/mod/data/preset/journal/tests/behat/journal_preset.feature +++ b/public/mod/data/preset/journal/tests/behat/journal_preset.feature @@ -73,7 +73,7 @@ Feature: Users can use the Journal preset When I press "Add entry" And I set the field "Title" to "This is the title" And I set the field "Content" to "This is the content for the new entry." - And I press "Save" + And I press "saveandview" Then I should see "This is the title" And I should see "This is the content for the new entry." diff --git a/public/mod/data/preset/proposals/tests/behat/proposals_preset.feature b/public/mod/data/preset/proposals/tests/behat/proposals_preset.feature index ca6de0b16f7..a6f5e33cc2e 100644 --- a/public/mod/data/preset/proposals/tests/behat/proposals_preset.feature +++ b/public/mod/data/preset/proposals/tests/behat/proposals_preset.feature @@ -89,7 +89,7 @@ Feature: Users can use the Proposals preset And I set the field "Summary" to "This is the summary for the new entry." And I set the field "Content" to "This is the content for the new entry." And I set the field "Status" to "Approved" - And I press "Save" + And I press "saveandview" Then I should see "This is the title" And I should see "Approved" And I should see "This is the summary for the new entry." diff --git a/public/mod/data/preset/resources/tests/behat/resources_preset.feature b/public/mod/data/preset/resources/tests/behat/resources_preset.feature index 5aed5cb8bb5..a4fc4389d55 100644 --- a/public/mod/data/preset/resources/tests/behat/resources_preset.feature +++ b/public/mod/data/preset/resources/tests/behat/resources_preset.feature @@ -94,7 +94,7 @@ Feature: Users can use the Resources preset And I set the field "Description" to "This is description." And I set the field "Web link" to "https://thisisthelink.cat" And I set the field "Type" to "Type2" - And I press "Save" + And I press "saveandview" Then I should see "This is the title" And I should see "This is the author" And I should see "https://thisisthelink.cat" diff --git a/public/mod/data/renderer.php b/public/mod/data/renderer.php index ff7f6eb2f94..491daecfd8b 100644 --- a/public/mod/data/renderer.php +++ b/public/mod/data/renderer.php @@ -121,10 +121,7 @@ class mod_data_renderer extends plugin_renderer_base { 'value' => get_string('continue'), ]); $actionbuttons .= html_writer::end_div(); - - $stickyfooter = new core\output\sticky_footer($actionbuttons); - $html .= $this->render($stickyfooter); - + $html .= $actionbuttons; $html .= html_writer::end_tag('div'); $html .= html_writer::end_tag('form'); $html .= html_writer::end_tag('div'); diff --git a/public/mod/data/styles.css b/public/mod/data/styles.css index 0663582c4eb..88a050d98c4 100644 --- a/public/mod/data/styles.css +++ b/public/mod/data/styles.css @@ -201,7 +201,3 @@ border-color: var(--bs-primary); color: var(--bs-primary); } - -#page-mod-data-preset .table { - margin-bottom: 10rem; -} diff --git a/public/mod/data/templates/fields_footer.mustache b/public/mod/data/templates/fields_footer.mustache index aceffa5b6ab..993a8fc366f 100644 --- a/public/mod/data/templates/fields_footer.mustache +++ b/public/mod/data/templates/fields_footer.mustache @@ -14,18 +14,13 @@ {{! @template mod_data/fields_footer - The mod_data fields sticky footer content. + The mod_data fields footer content. Example context (json): { "pageurl": "http://yoursite/mod/data/field.php" } }} -{{< core/sticky_footer }} - {{$ stickyclasses }} justify-content-start{{/ stickyclasses }} - {{$ stickycontent }} -
- {{#str}} viewtemplates, mod_data {{/str}} -
- {{/ stickycontent }} -{{/ core/sticky_footer }} +
+ {{#str}} viewtemplates, mod_data {{/str}} +
diff --git a/public/mod/data/templates/preset_preview.mustache b/public/mod/data/templates/preset_preview.mustache index 202e4e5a8c0..4edad3c80e3 100644 --- a/public/mod/data/templates/preset_preview.mustache +++ b/public/mod/data/templates/preset_preview.mustache @@ -31,18 +31,14 @@ {{{preview}}} -{{< core/sticky_footer }} - {{$ stickycontent }} -
- - - - - -
- {{/ stickycontent }} -{{/ core/sticky_footer }} +
+ + + + + +
{{#js}} require(['mod_data/importmappingdialogue'], function(importPreset) { diff --git a/public/mod/data/templates/presets.mustache b/public/mod/data/templates/presets.mustache index 1aaa7fffab6..5a6fbdb07b6 100644 --- a/public/mod/data/templates/presets.mustache +++ b/public/mod/data/templates/presets.mustache @@ -96,19 +96,14 @@ - - {{< core/sticky_footer }} - {{$ stickycontent }} - - {{/ stickycontent }} - {{/ core/sticky_footer }} + {{#js}} diff --git a/public/mod/data/templates/template_editor.mustache b/public/mod/data/templates/template_editor.mustache index 38c2e21ffcf..912addbfd76 100644 --- a/public/mod/data/templates/template_editor.mustache +++ b/public/mod/data/templates/template_editor.mustache @@ -110,15 +110,11 @@ {{/disableeditor}} - {{< core/sticky_footer }} - {{$ stickycontent }} -
- + -
- {{/ stickycontent }} - {{/ core/sticky_footer }} + /> + diff --git a/public/mod/data/templates/view_action_bar.mustache b/public/mod/data/templates/view_action_bar.mustache index e57e54f596f..58a1cd01843 100644 --- a/public/mod/data/templates/view_action_bar.mustache +++ b/public/mod/data/templates/view_action_bar.mustache @@ -22,6 +22,18 @@ Example context (json): { + "addentrybutton": { + "disabled": false, + "url": "#", + "id": "test-id", + "classes": "btn btn-link", + "attributes": [ + { + "name": "title", + "value": "Add entry" + } + ] + }, "urlselect": { "id": "url_select_test", "action": "https://example.com/post", @@ -81,28 +93,28 @@ } } }} -
-
+
+
- {{#addentrybutton}} - - {{/addentrybutton}} +
+ {{#urlselect}} + + {{/urlselect}} +
-
- {{#urlselect}} - - {{/urlselect}} -
-
+
{{#actionsselect}} {{/actionsselect}} + {{#addentrybutton}} + + {{/addentrybutton}}
diff --git a/public/mod/data/templates/view_footer.mustache b/public/mod/data/templates/view_footer.mustache index b850a88b07d..95217a2ec69 100644 --- a/public/mod/data/templates/view_footer.mustache +++ b/public/mod/data/templates/view_footer.mustache @@ -14,26 +14,13 @@ {{! @template mod_data/view_footer - The mod_data sticky footer content. + The mod_data footer content. Example context (json): { "selectall": "", "deleteselected": "", - "pagination": "1, 2, 3...", - "addentrybutton": { - "disabled": false, - "url": "#", - "id": "test-id", - "classes": "btn btn-link", - "attributes": [ - { - "name": "title", - "value": "Add entry" - } - ], - "text": "Add" - } + "pagination": "1, 2, 3..." } }} {{#selectall}} @@ -45,8 +32,3 @@ -{{#addentrybutton}} - -{{/addentrybutton}} diff --git a/public/mod/data/tests/behat/actionsmenu_replacement.feature b/public/mod/data/tests/behat/actionsmenu_replacement.feature index ac21c986a4b..64505851254 100644 --- a/public/mod/data/tests/behat/actionsmenu_replacement.feature +++ b/public/mod/data/tests/behat/actionsmenu_replacement.feature @@ -42,11 +42,11 @@ Feature: Users can add the ##actionsmenu## replacement to the database templates | Header | | | Repeated entry | | | Footer |
[[field1]]##actionsmenu##
| - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" And I set the field "Templates tertiary navigation" to "Single view template" And I set the following fields to these values: | Single view template |
[[field1]][[field2]]##actionsmenu##
| - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" @javascript Scenario: The ##actionsmenu## replacement displays the expected actions with default settings depending on the user permissions diff --git a/public/mod/data/tests/behat/advanced_search.feature b/public/mod/data/tests/behat/advanced_search.feature index 04806268df4..25592b678b4 100644 --- a/public/mod/data/tests/behat/advanced_search.feature +++ b/public/mod/data/tests/behat/advanced_search.feature @@ -45,7 +45,7 @@ Feature: Database entries can be searched using an advanced search form. And I set the field "Templates tertiary navigation" to "Advanced search template" And I set the following fields to these values: | Advanced search template | The test is on [[My Field#name]], [[My Field#description]], and the input [[My Field]] | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" And I navigate to "Database" in current page administration And I should see "First content" And I should see "Second content" @@ -63,7 +63,7 @@ Feature: Database entries can be searched using an advanced search form. And I set the field "Templates tertiary navigation" to "Advanced search template" And I set the following fields to these values: | Advanced search template | Main search [[My Field]], Other fields ##otherfields## | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" And I navigate to "Database" in current page administration And I should see "First content" And I should see "Second content" diff --git a/public/mod/data/tests/behat/default_templates.feature b/public/mod/data/tests/behat/default_templates.feature index 6a9983c71ab..eb36d5efc32 100644 --- a/public/mod/data/tests/behat/default_templates.feature +++ b/public/mod/data/tests/behat/default_templates.feature @@ -133,7 +133,7 @@ Feature: Users can use mod_data without editing the templates | Header | New header! | | Repeated entry | This is the template content | | Footer | New footer! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" And I navigate to "Database" in current page administration And I should see "New header!" And I should see "This is the template content" diff --git a/public/mod/data/tests/behat/edit_entries.feature b/public/mod/data/tests/behat/edit_entries.feature index 67848b5e75b..f29955df429 100644 --- a/public/mod/data/tests/behat/edit_entries.feature +++ b/public/mod/data/tests/behat/edit_entries.feature @@ -37,7 +37,7 @@ Feature: Edit existing database entries And I wait until the page is ready And I set the field "headline" to "New headline" And I set the field "description" to "New text" - When I click on "Save" "button" in the "sticky-footer" "region" + When I click on "Save" "button" Then I should not see "Headline 1" in the "region-main" "region" And I should not see "Original text" in the "region-main" "region" And I should see "New headline" in the "region-main" "region" @@ -54,17 +54,17 @@ Feature: Edit existing database entries # Trigger autosave. And I press tab And I wait "1" seconds - And I click on "Cancel" "button" in the "sticky-footer" "region" + And I click on "Cancel" "button" # Edit the second DB entry headline only. And I select "Single view" from the "jump" singleselect - And I click on "2" "link" in the "sticky-footer" "region" + And I click on "2" "link" And I click on ".defaulttemplate-single-body .action-menu" "css_element" And I click on "Edit" "link" in the ".defaulttemplate-single-body .dropdown-menu" "css_element" And I wait until the page is ready And I set the field "headline" to "New headline" - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" And I select "Single view" from the "jump" singleselect - And I click on "2" "link" in the "sticky-footer" "region" + And I click on "2" "link" # Only the new heading is updated and the description field autosave did not carry over from the first entry. And I should see "New headline" in the "region-main" "region" And I should not see "Unsaved changes" in the "region-main" "region" diff --git a/public/mod/data/tests/behat/edit_templates.feature b/public/mod/data/tests/behat/edit_templates.feature index f128d530162..87dd8f7354a 100644 --- a/public/mod/data/tests/behat/edit_templates.feature +++ b/public/mod/data/tests/behat/edit_templates.feature @@ -34,7 +34,7 @@ Feature: Users can edit the database templates | Header | New header! | | Repeated entry | [[field1]] and [[field2]]! | | Footer | New footer! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" When I navigate to "Database" in current page administration Then I should see "New header!" And I should see "Student entry 1 and Some content 1!" @@ -45,7 +45,7 @@ Feature: Users can edit the database templates Given I set the field "Templates tertiary navigation" to "Single view template" And I set the following fields to these values: | Single view template | [[field1]] and [[field2]] details! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" When I navigate to "Database" in current page administration And I set the field "View mode tertiary navigation" to "Single view" Then I should see "Student entry 1 and Some content 1 details!" @@ -55,7 +55,7 @@ Feature: Users can edit the database templates Given I set the field "Templates tertiary navigation" to "Add entry template" And I set the following fields to these values: | Add entry template | [[field1]] [[field2]] Form extra! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" When I navigate to "Database" in current page administration And I click on "Add entry" "button" Then I should see "Form extra!" @@ -65,7 +65,7 @@ Feature: Users can edit the database templates Given I set the field "Templates tertiary navigation" to "Advanced search template" And I set the following fields to these values: | Advanced search template | New advanced search template! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" When I navigate to "Database" in current page administration And I click on "Advanced search" "checkbox" Then I should see "New advanced search template!" @@ -75,7 +75,7 @@ Feature: Users can edit the database templates Given I click on "Enable code editor" "checkbox" And I set the following fields to these values: | Repeated entry | NopeYep! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" When I navigate to "Database" in current page administration Then I should not see "Nope" And I should see "Yep!" @@ -85,11 +85,11 @@ Feature: Users can edit the database templates Given I click on "Enable code editor" "checkbox" And I set the following fields to these values: | Repeated entry | NopeYep! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" And I set the field "Templates tertiary navigation" to "Custom CSS" And I set the following fields to these values: | Custom CSS | .hideme {display: none;} | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" When I navigate to "Database" in current page administration Then I should not see "Nope" And I should see "Yep!" @@ -99,11 +99,11 @@ Feature: Users can edit the database templates Given I click on "Enable code editor" "checkbox" And I set the following fields to these values: | Repeated entry | NopeYep! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" And I set the field "Templates tertiary navigation" to "Custom JavaScript" And I set the following fields to these values: | Custom JavaScript | window.onload = () => document.querySelector('#hideme').style.display = 'none'; | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" When I navigate to "Database" in current page administration Then I should not see "Nope" And I should see "Yep!" @@ -114,7 +114,7 @@ Feature: Users can edit the database templates | Header | New header! | | Repeated entry | This is the template content | | Footer | New footer! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" And I navigate to "Database" in current page administration And I should see "New header!" And I should see "This is the template content" diff --git a/public/mod/data/tests/behat/required_entries.feature b/public/mod/data/tests/behat/required_entries.feature index 058fbce4490..a9cdb22f6fc 100644 --- a/public/mod/data/tests/behat/required_entries.feature +++ b/public/mod/data/tests/behat/required_entries.feature @@ -90,7 +90,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Required URL | http://example.com/ | | Required Multimenu | 1 | | Required Two-Option Multimenu | 1 | - When I press "Save" + When I press "saveandview" And I select "List view" from the "jump" singleselect Then I should not see "No entries in database" And I should see "New entry text" @@ -110,7 +110,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Required URL | http://example.com/ | | Required Multimenu | 1 | | Required Two-Option Multimenu | 1 | - When I press "Save" + When I press "saveandview" Then the following fields match these values: | Base Text input | | | Latitude | 0 | @@ -142,7 +142,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Required Multimenu | 1 | | Required Two-Option Multimenu | 1 | | Latitude | 20 | - When I press "Save" + When I press "saveandview" Then I should see "Both latitude and longitude are required." Scenario: A student filling in number and text fields with zero will not see an error. @@ -163,7 +163,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Required URL | http://example.com/ | | Required Multimenu | 1 | | Required Two-Option Multimenu | 1 | - When I press "Save" + When I press "saveandview" And I select "List view" from the "jump" singleselect Then I should not see "No entries in database" And I should see "Some input to allow us to submit the otherwise empty form" diff --git a/public/mod/data/tests/behat/view_entries.feature b/public/mod/data/tests/behat/view_entries.feature index 4ee31d83996..e4ccae27922 100644 --- a/public/mod/data/tests/behat/view_entries.feature +++ b/public/mod/data/tests/behat/view_entries.feature @@ -87,7 +87,7 @@ Feature: Users can view and search database entries | Test field name | Student original entry tagged | | Test field 2 name | Student original entry tagged 2 | And I set the field with xpath "//div[@class='datatagcontrol']//input[@type='text']" to "Tag1" - And I press "Save" + And I press "saveandview" And I should see "Student original entry" And I should see "Tag1" in the "div.tag_list" "css_element" And I open the action menu in "#defaulttemplate-single" "css_element" @@ -149,7 +149,7 @@ Feature: Users can view and search database entries And I set the field "Templates tertiary navigation" to "List view template" And I set the following fields to these values: | Repeated entry | ##delcheck##[[Test field name]]! | - And I click on "Save" "button" in the "sticky-footer" "region" + And I click on "Save" "button" When I navigate to "Database" in current page administration When I click on "Select all" "button" And I click on "Delete selected" "button" diff --git a/public/mod/data/view.php b/public/mod/data/view.php index 330c1b800c2..ecac830c598 100644 --- a/public/mod/data/view.php +++ b/public/mod/data/view.php @@ -521,7 +521,7 @@ if ($showactivity) { echo $OUTPUT->box_end(); } - $stickyfooter = new mod_data\output\view_footer( + $viewfooter = new mod_data\output\view_footer( $manager, $totalcount, $page, @@ -529,7 +529,7 @@ if ($showactivity) { $baseurl, $parser ); - echo $OUTPUT->render($stickyfooter); + echo $OUTPUT->render($viewfooter); echo html_writer::end_tag('form'); }