Merge branch 'MDL-87304-main' of https://github.com/laurentdavid/moodle
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <[email protected]>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
||||
+22
-16
@@ -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 '</div></form>';
|
||||
|
||||
@@ -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 '</form>';
|
||||
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
@@ -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."
|
||||
|
||||
|
||||
@@ -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."
|
||||
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -201,7 +201,3 @@
|
||||
border-color: var(--bs-primary);
|
||||
color: var(--bs-primary);
|
||||
}
|
||||
|
||||
#page-mod-data-preset .table {
|
||||
margin-bottom: 10rem;
|
||||
}
|
||||
|
||||
@@ -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 }}
|
||||
<div class="ps-3">
|
||||
<a href="{{pageurl}}">{{#str}} viewtemplates, mod_data {{/str}}</a>
|
||||
</div>
|
||||
{{/ stickycontent }}
|
||||
{{/ core/sticky_footer }}
|
||||
<div class="ps-3">
|
||||
<a href="{{pageurl}}">{{#str}} viewtemplates, mod_data {{/str}}</a>
|
||||
</div>
|
||||
|
||||
@@ -31,18 +31,14 @@
|
||||
{{{preview}}}
|
||||
</div>
|
||||
</div>
|
||||
{{< core/sticky_footer }}
|
||||
{{$ stickycontent }}
|
||||
<form method="post" action="{{formactionurl}}">
|
||||
<input type="hidden" name="cmid" value="{{cmid}}">
|
||||
<input type="hidden" name="mode" value="usepreset">
|
||||
<input type="hidden" name="action" value="select">
|
||||
<input type="hidden" name="fullname" value="{{userid}}/{{shortname}}">
|
||||
<input type="submit" name="selectpreset" data-action="selectpreset" value="{{#str}}usepreset, mod_data{{/str}}" class="btn btn-primary"
|
||||
data-cmid="{{cmid}}" data-presetname="{{userid}}/{{shortname}}">
|
||||
</form>
|
||||
{{/ stickycontent }}
|
||||
{{/ core/sticky_footer }}
|
||||
<form method="post" action="{{formactionurl}}">
|
||||
<input type="hidden" name="cmid" value="{{cmid}}">
|
||||
<input type="hidden" name="mode" value="usepreset">
|
||||
<input type="hidden" name="action" value="select">
|
||||
<input type="hidden" name="fullname" value="{{userid}}/{{shortname}}">
|
||||
<input type="submit" name="selectpreset" data-action="selectpreset" value="{{#str}}usepreset, mod_data{{/str}}" class="btn btn-primary"
|
||||
data-cmid="{{cmid}}" data-presetname="{{userid}}/{{shortname}}">
|
||||
</form>
|
||||
|
||||
{{#js}}
|
||||
require(['mod_data/importmappingdialogue'], function(importPreset) {
|
||||
|
||||
@@ -96,19 +96,14 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
{{< core/sticky_footer }}
|
||||
{{$ stickycontent }}
|
||||
<input
|
||||
type="submit"
|
||||
name="selectpreset"
|
||||
data-action="selectpreset"
|
||||
value="{{#str}}usepreset, mod_data{{/str}}"
|
||||
class="btn btn-secondary"
|
||||
disabled
|
||||
>
|
||||
{{/ stickycontent }}
|
||||
{{/ core/sticky_footer }}
|
||||
<input
|
||||
type="submit"
|
||||
name="selectpreset"
|
||||
data-action="selectpreset"
|
||||
value="{{#str}}usepreset, mod_data{{/str}}"
|
||||
class="btn btn-secondary"
|
||||
disabled
|
||||
>
|
||||
</form>
|
||||
|
||||
{{#js}}
|
||||
|
||||
@@ -110,15 +110,11 @@
|
||||
</div>
|
||||
</div>
|
||||
{{/disableeditor}}
|
||||
{{< core/sticky_footer }}
|
||||
{{$ stickycontent }}
|
||||
<div>
|
||||
<input
|
||||
class="btn btn-primary mx-1"
|
||||
<div>
|
||||
<input
|
||||
class="btn btn-primary mt-2"
|
||||
type="submit"
|
||||
value="{{#str}} save {{/str}}"
|
||||
/>
|
||||
</div>
|
||||
{{/ stickycontent }}
|
||||
{{/ core/sticky_footer }}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -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 @@
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div class="container-fluid tertiary-navigation d-flex">
|
||||
<div class="row ms-auto">
|
||||
<div class="container-fluid tertiary-navigation px-0">
|
||||
<div class="row justify-content-between">
|
||||
<div class="col">
|
||||
{{#addentrybutton}}
|
||||
<div class="navitem mb-0">
|
||||
{{>core/single_button}}
|
||||
</div>
|
||||
{{/addentrybutton}}
|
||||
<div class="d-flex">
|
||||
{{#urlselect}}
|
||||
<div class="navitem">
|
||||
{{>core/url_select}}
|
||||
</div>
|
||||
{{/urlselect}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
{{#urlselect}}
|
||||
<div class="navitem mb-0">
|
||||
{{>core/url_select}}
|
||||
</div>
|
||||
{{/urlselect}}
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col d-flex justify-content-end">
|
||||
{{#actionsselect}}
|
||||
<div class='navitem mb-0 entriesactions'>
|
||||
{{>core/action_menu}}
|
||||
</div>
|
||||
{{/actionsselect}}
|
||||
{{#addentrybutton}}
|
||||
<div class="navitem">
|
||||
{{>core/action_link}}
|
||||
</div>
|
||||
{{/addentrybutton}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,26 +14,13 @@
|
||||
{{!
|
||||
@template mod_data/view_footer
|
||||
|
||||
The mod_data sticky footer content.
|
||||
The mod_data footer content.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"selectall": "<button>Select all</button>",
|
||||
"deleteselected": "<button>Cancel selection</button>",
|
||||
"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 @@
|
||||
<div class="navitem submit mx-auto">
|
||||
{{{pagination}}}
|
||||
</div>
|
||||
{{#addentrybutton}}
|
||||
<div class="navitem">
|
||||
{{> core/action_link}}
|
||||
</div>
|
||||
{{/addentrybutton}}
|
||||
|
||||
@@ -42,11 +42,11 @@ Feature: Users can add the ##actionsmenu## replacement to the database templates
|
||||
| Header | <table> |
|
||||
| Repeated entry | <tr><td>[[field1]]</td><td>##actionsmenu##</td><tr> |
|
||||
| Footer | </table> |
|
||||
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 | <table><tr><td>[[field1]]</td><td>[[field2]]</td><td>##actionsmenu##</td><tr></table> |
|
||||
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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 | <span class="d-none">Nope</span>Yep! |
|
||||
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 | <span class="hideme">Nope</span>Yep! |
|
||||
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 | <span id="hideme">Nope</span>Yep! |
|
||||
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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user