This commit is contained in:
Jun Pataleta 2024-02-09 16:46:54 +08:00
commit f96df76bfc
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
15 changed files with 360 additions and 223 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -26,26 +26,26 @@ import $ from 'jquery';
import {call as fetchMany} from 'core/ajax';
import * as Notification from 'core/notification';
import * as Templates from 'core/templates';
import {
get_string as getString,
get_strings as getStrings,
} from 'core/str';
import {getString} from 'core/str';
import * as ModalEvents from 'core/modal_events';
import Pending from 'core/pending';
import SaveCancelModal from 'core/modal_save_cancel';
import Config from 'core/config';
import * as reportSelectors from 'core_reportbuilder/local/selectors';
const getTagIndex = (tagindex) => fetchMany([{
methodname: 'core_tag_get_tagindex',
args: {tagindex}
}])[0];
const getCheckedTags = (form) => form.querySelectorAll('input[data-togglegroup="tags-manage"][data-toggle="slave"]:checked');
const getCheckedTags = (root) => root.querySelectorAll('[data-togglegroup="report-select-all"][data-toggle="slave"]:checked');
const handleCombineRequest = async(tagManagementCombine) => {
const pendingPromise = new Pending('core/tag:tag-management-combine');
const form = tagManagementCombine.closest('form');
const checkedTags = getCheckedTags(form);
const reportElement = document.querySelector(reportSelectors.regions.report);
const checkedTags = getCheckedTags(reportElement);
if (checkedTags.length <= 1) {
// We need at least 2 tags to combine them.
@ -86,6 +86,13 @@ const handleCombineRequest = async(tagManagementCombine) => {
tempElement.name = tagManagementCombine.name;
form.append(tempElement);
// Append selected tags element.
const tagsElement = document.createElement('input');
tagsElement.hidden = true;
tagsElement.name = 'tagschecked';
tagsElement.value = [...checkedTags].map(check => check.value).join(',');
form.append(tagsElement);
// Get the selected tag from the modal.
var maintag = $('input[name=maintag]:checked', '#combinetags_form').val();
// Append this in the tags list form.
@ -157,8 +164,12 @@ const addStandardTags = async() => {
pendingPromise.resolve();
};
const deleteSelectedTags = async(form) => {
const checkedTags = getCheckedTags(form);
const deleteSelectedTags = async(bulkActionDeleteButton) => {
const form = bulkActionDeleteButton.closest('form');
const reportElement = document.querySelector(reportSelectors.regions.report);
const checkedTags = getCheckedTags(reportElement);
if (!checkedTags.length) {
return;
}
@ -174,8 +185,16 @@ const deleteSelectedTags = async(form) => {
// Append this temp element in the form in the tags list, not the form in the modal. Confusing, right?!?
const tempElement = document.createElement('input');
tempElement.hidden = true;
tempElement.name = 'bulkdelete';
tempElement.name = bulkActionDeleteButton.name;
form.append(tempElement);
// Append selected tags element.
const tagsElement = document.createElement('input');
tagsElement.hidden = true;
tagsElement.name = 'tagschecked';
tagsElement.value = [...checkedTags].map(check => check.value).join(',');
form.append(tagsElement);
form.submit();
} catch {
return;
@ -303,37 +322,10 @@ export const initTagindexPage = async() => {
* @method initManagePage
*/
export const initManagePage = () => {
// Set cell 'time modified' to 'now' when any of the element is updated in this row.
$('body').on('updated', '[data-inplaceeditable]', function(e) {
var pendingPromise = new Pending('core/tag:initManagePage');
getStrings([
{
key: 'selecttag',
component: 'core_tag',
},
{
key: 'now',
component: 'core',
},
])
.then(function(result) {
$('label[for="tagselect' + e.ajaxreturn.itemid + '"]').html(result[0]);
$(e.target).closest('tr').find('td.col-timemodified').html(result[1]);
return;
})
.always(pendingPromise.resolve)
.catch(Notification.exception);
if (e.ajaxreturn.itemtype === 'tagflag') {
var row = $(e.target).closest('tr');
if (e.ajaxreturn.value === '0') {
row.removeClass('table-warning');
} else {
row.addClass('table-warning');
}
}
// Toggle row class when updating flag.
$('body').on('updated', '[data-inplaceeditable][data-itemtype=tagflag]', function(e) {
var row = $(e.target).closest('tr');
row.toggleClass('table-warning', e.ajaxreturn.value === '1');
});
// Confirmation for bulk tag combine button.
@ -344,7 +336,7 @@ export const initManagePage = () => {
handleCombineRequest(tagManagementCombine);
}
if (e.target.closest('a[data-action="addstandardtag"]')) {
if (e.target.closest('[data-action="addstandardtag"]')) {
e.preventDefault();
addStandardTags();
}
@ -352,7 +344,7 @@ export const initManagePage = () => {
const bulkActionDeleteButton = e.target.closest('#tag-management-delete');
if (bulkActionDeleteButton) {
e.preventDefault();
deleteSelectedTags(bulkActionDeleteButton.closest('form'));
deleteSelectedTags(bulkActionDeleteButton);
}
const rowDeleteButton = e.target.closest('.tagdelete');

View File

@ -40,13 +40,11 @@ Feature: Edited book chapters handle tags correctly
@javascript
Scenario: Book chapter edition of standard tags works as expected
Given I log in as "admin"
And I change window size to "large"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I follow "Add standard tags"
And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3"
And I press "Continue"
Given the following "tags" exist:
| name | isstandard |
| OT1 | 1 |
| OT2 | 1 |
| OT3 | 1 |
And I am on the "Test book" "book activity" page logged in as teacher1
And I open the autocomplete suggestions list
And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element"

View File

@ -38,13 +38,11 @@ Feature: Edited forum posts handle tags correctly
@javascript
Scenario: Forum post edition of standard tags works as expected
Given I log in as "admin"
And I change window size to "large"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I follow "Add standard tags"
And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3"
And I press "Continue"
Given the following "tags" exist:
| name | isstandard |
| OT1 | 1 |
| OT2 | 1 |
| OT3 | 1 |
And I am on the "Test forum name" "forum activity" page logged in as teacher1
And I click on "Add discussion topic" "link"
And I click on "Advanced" "button"

View File

@ -40,15 +40,12 @@ Feature: Edited glossary entries handle tags correctly
Then I should see "Cool" in the ".form-autocomplete-selection" "css_element"
Scenario: Glossary entry edition of standard tags works as expected
Given I log in as "admin"
And I change window size to "large"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I follow "Add standard tags"
And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3"
And I press "Continue"
And I log out
Given I am on the "Test glossary" "glossary activity" page logged in as teacher1
Given the following "tags" exist:
| name | isstandard |
| OT1 | 1 |
| OT2 | 1 |
| OT3 | 1 |
And I am on the "Test glossary" "glossary activity" page logged in as teacher1
And I press "Add entry"
And I expand all fieldsets
And I open the autocomplete suggestions list

View File

@ -41,15 +41,12 @@ Feature: Edited wiki pages handle tags correctly
@javascript
Scenario: Wiki page edition of standard tags works as expected
Given I log in as "admin"
And I change window size to "large"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I follow "Add standard tags"
And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3"
And I press "Continue"
And I log out
Given I am on the "Test wiki name" "wiki activity" page logged in as student1
Given the following "tags" exist:
| name | isstandard |
| OT1 | 1 |
| OT2 | 1 |
| OT3 | 1 |
And I am on the "Test wiki name" "wiki activity" page logged in as student1
And I press "Create page"
And I open the autocomplete suggestions list
And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element"

View File

@ -26,6 +26,7 @@ require_once($CFG->libdir . '/tablelib.php');
* @package core_tag
* @copyright 2015 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated since Moodle 4.4
*/
class core_tag_manage_table extends table_sql {
@ -43,11 +44,13 @@ class core_tag_manage_table extends table_sql {
public function __construct($tagcollid) {
global $USER, $PAGE, $OUTPUT;
debugging('core_tag_manage_table is deprecated, please use the new system report', DEBUG_DEVELOPER);
parent::__construct('tag-management-list-'.$USER->id);
$this->tagcollid = $tagcollid;
$perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT);
$perpage = optional_param('perpage', 30, PARAM_INT);
$page = optional_param('page', 0, PARAM_INT);
$filter = optional_param('filter', '', PARAM_NOTAGS);
$baseurl = new moodle_url('/tag/manage.php', array('tc' => $tagcollid,

View File

@ -0,0 +1,220 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_tag\reportbuilder\local\systemreports;
use core\context\system;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\report\{action, column};
use core_reportbuilder\system_report;
use core_tag\output\{tagflag, tagisstandard, tagname};
use core_tag\reportbuilder\local\entities\tag;
use lang_string;
use moodle_url;
use pix_icon;
use stdClass;
/**
* Tags collection system report
*
* @package core_tag
* @copyright 2023 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tags extends system_report {
/**
* Report initialisation
*/
protected function initialise(): void {
$tag = new tag();
$this->add_entity($tag);
$tagalias = $tag->get_table_alias('tag');
$this->set_main_table('tag', $tagalias);
// Base fields required for various callbacks.
$this->add_base_fields("{$tagalias}.id, {$tagalias}.rawname, {$tagalias}.flag, {$tagalias}.tagcollid");
$this->set_checkbox_toggleall(static function(stdClass $tag): array {
return [$tag->id, get_string('selecttag', 'core_tag', $tag->rawname)];
});
// Limit tags to current collection.
$this->add_base_condition_simple("{$tagalias}.tagcollid", $this->get_parameter('collection', 0, PARAM_INT));
// Join the user entity to represent the tag author.
$user = new user();
$useralias = $user->get_table_alias('user');
$this->add_entity($user->add_join("LEFT JOIN {user} {$useralias} ON {$useralias}.id = {$tagalias}.userid"));
$this->add_columns($tag);
$this->add_filters();
$this->add_actions();
$this->set_downloadable(false);
}
/**
* Report access
*
* @return bool
*/
protected function can_view(): bool {
global $CFG;
return !empty($CFG->usetags) && has_capability('moodle/tag:manage', system::instance());
}
/**
* Report columns
*
* @param tag $tag
*/
public function add_columns(tag $tag): void {
$tagentity = $tag->get_entity_name();
$tagalias = $tag->get_table_alias('tag');
// Name (editable).
$this->add_column((new column(
'nameeditable',
new lang_string('name', 'core_tag'),
$tagentity,
))
->add_fields("{$tagalias}.name, {$tagalias}.rawname, {$tagalias}.tagcollid, {$tagalias}.id")
->set_type(column::TYPE_TEXT)
->set_is_sortable(true)
->set_callback(static function(string $name, stdClass $tag): string {
global $PAGE;
$editable = new tagname($tag);
return $editable->render($PAGE->get_renderer('core'));
})
);
// User.
$this->add_column_from_entity('user:fullnamewithlink');
// Count (TODO MDL-76392 use native entity aggregation).
$this->add_column((new column(
'instancecount',
new lang_string('count', 'core_tag'),
$tagentity,
))
->add_field("(SELECT COUNT(*) FROM {tag_instance} WHERE tagid = {$tagalias}.id)", 'instancecount')
->set_type(column::TYPE_INTEGER)
->set_is_sortable(true)
);
// Flag (editable).
$this->add_column((new column(
'flageditable',
new lang_string('flag', 'core_tag'),
$tagentity,
))
->add_fields("{$tagalias}.flag, {$tagalias}.id")
->set_type(column::TYPE_BOOLEAN)
->set_is_sortable(true)
->set_callback(static function(bool $flag, stdClass $tag): string {
global $PAGE;
$editable = new tagflag($tag);
return $editable->render($PAGE->get_renderer('core'));
})
);
// Time modified.
$this->add_column_from_entity('tag:timemodified')
->set_callback(fn($timemodified) => format_time(time() - $timemodified));
// Standard (editable).
$this->add_column((new column(
'standardeditable',
new lang_string('standardtag', 'core_tag'),
$tagentity,
))
->add_fields("{$tagalias}.isstandard, {$tagalias}.id")
->set_type(column::TYPE_BOOLEAN)
->set_is_sortable(true)
->set_callback(static function(bool $standard, stdClass $tag): string {
global $PAGE;
$editable = new tagisstandard($tag);
return $editable->render($PAGE->get_renderer('core'));
})
);
$this->set_initial_sort_column('tag:flageditable', SORT_DESC);
}
/**
* Report filters
*/
protected function add_filters(): void {
$this->add_filters_from_entities([
'tag:name',
'tag:standard',
'tag:flagged',
]);
}
/**
* Report actions
*/
protected function add_actions(): void {
// Edit.
$this->add_action((new action(
new moodle_url('/tag/edit.php', [
'id' => ':id',
'returnurl' => ':returnurl',
]),
new pix_icon('t/edit', ''),
[],
false,
new lang_string('edit'),
))
->add_callback(static function(stdClass $tag): bool {
$tag->returnurl = (new moodle_url('/tag/manage.php', ['tc' => $tag->tagcollid]))->out_as_local_url(false);
return true;
})
);
// Delete.
$this->add_action(new action(
new moodle_url('/tag/manage.php', [
'tc' => ':tagcollid',
'tagid' => ':id',
'action' => 'delete',
'sesskey' => sesskey(),
]),
new pix_icon('t/delete', ''),
[
'class' => 'tagdelete text-danger',
],
false,
new lang_string('delete'),
));
}
/**
* Report row class
*
* @param stdClass $row
* @return string
*/
public function get_row_class(stdClass $row): string {
return $row->flag ? 'table-warning' : '';
}
}

View File

@ -23,36 +23,22 @@
*/
require_once('../config.php');
require_once($CFG->libdir.'/tablelib.php');
require_once('lib.php');
require_once($CFG->libdir.'/adminlib.php');
define('SHOW_ALL_PAGE_SIZE', 50000);
define('DEFAULT_PAGE_SIZE', 30);
use core\context\system;
use core_reportbuilder\system_report_factory;
use core_tag\reportbuilder\local\systemreports\tags;
$tagschecked = optional_param_array('tagschecked', array(), PARAM_INT);
$tagid = optional_param('tagid', null, PARAM_INT);
$isstandard = optional_param('isstandard', null, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA);
$perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT);
$page = optional_param('page', 0, PARAM_INT);
$tagcollid = optional_param('tc', 0, PARAM_INT);
$tagareaid = optional_param('ta', null, PARAM_INT);
$filter = optional_param('filter', '', PARAM_NOTAGS);
$params = array();
if ($perpage != DEFAULT_PAGE_SIZE) {
$params['perpage'] = $perpage;
}
if ($page > 0) {
$params['page'] = $page;
}
if ($tagcollid) {
$params['tc'] = $tagcollid;
}
if ($filter !== '') {
$params['filter'] = $filter;
}
admin_externalpage_setup('managetags', '', $params, '', array('pagelayout' => 'report'));
@ -66,7 +52,6 @@ if ($tagid) {
$tagcollid = $tagobject->tagcollid;
}
$tagcoll = core_tag_collection::get_by_id($tagcollid);
$tagarea = core_tag_area::get_by_id($tagareaid);
$manageurl = new moodle_url('/tag/manage.php');
if ($tagcoll) {
// We are inside a tag collection - add it to the breadcrumb.
@ -125,6 +110,7 @@ switch($action) {
break;
case 'bulk':
$tagschecked = explode(',', optional_param('tagschecked', '', PARAM_SEQUENCE));
if (optional_param('bulkdelete', null, PARAM_RAW) !== null) {
if ($tagschecked) {
require_sesskey();
@ -206,70 +192,39 @@ if (!$tagcoll) {
}
// Tag collection is specified. Manage tags in this collection.
echo $OUTPUT->heading(core_tag_collection::display_name($tagcoll));
echo html_writer::div(
$OUTPUT->heading(core_tag_collection::display_name($tagcoll)) .
html_writer::tag(
'button',
$OUTPUT->pix_icon('t/add', '') . get_string('addotags', 'core_tag'),
[
'type' => 'button',
'class' => 'btn btn-primary my-auto',
'data-action' => 'addstandardtag',
],
),
'd-flex justify-content-between mb-2',
);
$hiddenfields = [
(object) ['type' => 'hidden', 'name' => 'tc', 'value' => $tagcollid],
(object) ['type' => 'hidden', 'name' => 'perpage', 'value' => $perpage]
];
// Render the report.
$report = system_report_factory::create(tags::class, system::instance(), '', '', 0, ['collection' => $tagcoll->id]);
echo $report->output();
$otherfields = '';
if ($filter !== '') {
$otherfields = html_writer::link(new moodle_url($PAGE->url, ['filter' => null]),
get_string('resetfilter', 'tag'));
}
$data = [
'action' => new moodle_url('/tag/manage.php'),
'hiddenfields' => $hiddenfields,
'inputname' => 'filter',
'searchstring' => get_string('search'),
'query' => s($filter),
'extraclasses' => 'mb-2',
'otherfields' => $otherfields
];
echo $OUTPUT->render_from_template('core/search_input', $data);
// Link to add an standard tags.
$img = $OUTPUT->pix_icon('t/add', '');
echo '<div class="addstandardtags visibleifjs">' .
html_writer::link('#', $img . get_string('addotags', 'tag'), array('data-action' => 'addstandardtag')) .
'</div>';
$table = new core_tag_manage_table($tagcollid);
echo '<form class="tag-management-form" method="post" action="'.$CFG->wwwroot.'/tag/manage.php">';
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'tc', 'value' => $tagcollid));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'bulk'));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'perpage', 'value' => $perpage));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'page', 'value' => $page));
echo $table->out($perpage, true);
if ($table->rawdata) {
echo html_writer::start_tag('p');
// Render bulk actions.
if ($DB->record_exists('tag', [])) {
echo '<form class="tag-management-form" method="post" action="' . $PAGE->url->out_omit_querystring() . '">';
echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'tc', 'value' => $tagcoll->id]);
echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()]);
echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'action', 'value' => 'bulk']);
echo html_writer::tag('button', get_string('deleteselected', 'tag'),
array('id' => 'tag-management-delete', 'type' => 'submit',
'class' => 'tagdeleteselected btn btn-secondary', 'name' => 'bulkdelete'));
echo html_writer::tag('button', get_string('combineselected', 'tag'),
array('id' => 'tag-management-combine', 'type' => 'submit',
'class' => 'tagcombineselected btn btn-secondary', 'name' => 'bulkcombine'));
echo html_writer::end_tag('p');
echo '</form>';
}
echo '</form>';
$totalcount = $table->totalcount;
if ($perpage == SHOW_ALL_PAGE_SIZE) {
echo html_writer::start_tag('div', array('id' => 'showall'));
$params = array('perpage' => DEFAULT_PAGE_SIZE, 'page' => 0);
$url = new moodle_url($PAGE->url, $params);
echo html_writer::link($url, get_string('showperpage', '', DEFAULT_PAGE_SIZE));
echo html_writer::end_tag('div');
} else if ($totalcount > 0 and $perpage < $totalcount) {
echo html_writer::start_tag('div', array('id' => 'showall'));
$params = array('perpage' => SHOW_ALL_PAGE_SIZE, 'page' => 0);
$url = new moodle_url($PAGE->url, $params);
echo html_writer::link($url, get_string('showall', '', $totalcount));
echo html_writer::end_tag('div');
}
$PAGE->requires->js_call_amd('core/tag', 'initManagePage');
echo $OUTPUT->footer();

View File

@ -29,34 +29,17 @@ Feature: Manager is able to delete tags
And I should not see "Dog"
And I log out
Scenario: Deleting multiple tags with javascript disabled
When I log in as "manager1"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I set the following fields to these values:
| Select tag Dog | 1 |
| Select tag Neverusedtag | 1 |
And I press "Delete selected"
Then I should see "Tag(s) deleted"
And I should not see "Dog"
And I should not see "Neverusedtag"
And I follow "Cat"
And I follow "User 1"
And I should see "Cat"
And I should not see "Dog"
And I log out
@javascript
Scenario: Deleting a tag with javascript enabled
When I log in as "manager1"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I click on "Delete" "link" in the "Turtle" "table_row"
And I press "Delete" action in the "Turtle" report row
Then I should see "Are you sure you want to delete this tag?"
And I click on "Cancel" "button" in the "Delete" "dialogue"
And I should not see "Tag(s) deleted"
And I should see "Turtle"
And I click on "Delete" "link" in the "Dog" "table_row"
And I press "Delete" action in the "Dog" report row
And I should see "Are you sure you want to delete this tag?"
And I press "Yes"
And I should see "Tag(s) deleted"

View File

@ -120,7 +120,7 @@ Feature: Users can edit tags to add description or rename
When I log in as "manager1"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I click on "Edit this tag" "link" in the "Cat" "table_row"
And I press "Edit" action in the "Cat" report row
And I set the following fields to these values:
| Tag name | Kitten |
| Description | Description of tag 1 |
@ -138,7 +138,7 @@ Feature: Users can edit tags to add description or rename
When I log in as "manager1"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I click on "Edit this tag" "link" in the "Cat" "table_row"
And I press "Edit" action in the "Cat" report row
And I set the following fields to these values:
| Tag name | DOG |
And I press "Update"
@ -146,7 +146,7 @@ Feature: Users can edit tags to add description or rename
And I set the following fields to these values:
| Tag name | Kitten |
And I press "Update"
And I click on "Edit this tag" "link" in the "Kitten" "table_row"
And I press "Edit" action in the "Kitten" report row
And I set the following fields to these values:
| Tag name | KITTEN |
And I press "Update"
@ -160,10 +160,10 @@ Feature: Users can edit tags to add description or rename
And I follow "Default collection"
# Renaming tag to a valid name
And I set the field "Edit tag name" in the "Cat" "table_row" to "Kitten"
Then I should not see "Cat"
And "New name for tag" "field" should not exist
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
Then the following should not exist in the "reportbuilder-table" table:
| First name | Tag name |
| Admin User | Cat |
And I reload the page
And I should see "Kitten"
And I should not see "Cat"
# Renaming tag to an invalid name
@ -174,22 +174,6 @@ Feature: Users can edit tags to add description or rename
And I should see "Turtle"
And I should see "Dog"
And I should not see "DOG"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I should see "Turtle"
And I should see "Dog"
And I should not see "DOG"
# Cancel tag renaming
And I click on "Edit tag name" "link" in the "Dog" "table_row"
And I type "Penguin"
And I press the escape key
And "New name for tag" "field" should not exist
And I should see "Turtle"
And I should not see "Penguin"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I should see "Turtle"
And I should not see "Penguin"
@javascript
Scenario: Combining tags when renaming
@ -238,18 +222,17 @@ Feature: Users can edit tags to add description or rename
And I should see "Turtle"
And I should not see "Neverusedtag"
@javascript
Scenario: Filtering tags
When I log in as "manager1"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I should not see "Reset filter"
And I set the field "Search" to "t"
And I press "Search"
Then the field "Search" matches value "t"
And I should not see "Dog"
And I should see "Cat"
And I should see "Turtle"
And I follow "Reset filter"
And I should see "Dog"
And I should see "Cat"
And I should see "Turtle"
And I click on "Filters" "button"
And I set the following fields in the "Tag name" "core_reportbuilder > Filter" to these values:
| Tag name operator | Is equal to |
| Tag name value | Cat,Dog |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then I should see "Cat" in the "reportbuilder-table" "table"
And I should see "Dog" in the "reportbuilder-table" "table"
And I should not see "Turtle" in the "reportbuilder-table" "table"
And I should not see "Neverusedtag" in the "reportbuilder-table" "table"

View File

@ -69,25 +69,35 @@ Feature: Users can flag tags and manager can reset flags
And I follow "Default collection"
Then "Sweartag" "link" should appear before "Badtag" "link"
And "Badtag" "link" should appear before "Nicetag" "link"
And "(2)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(1)" "text" should exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(" "text" should not exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
And the following should exist in the "reportbuilder-table" table:
| Tag name | Flag |
| Sweartag | (2) |
| Badtag | (1) |
And the following should not exist in the "reportbuilder-table" table:
| Tag name | Flag |
| Nicetag | ( |
| Neverusertag | ( |
And I click on "Reset flag" "link" in the "Sweartag" "table_row"
And I click on "Reset flag" "link" in the "Badtag" "table_row"
And I wait until "//tr[contains(.,'Sweartag')]//a[contains(@title,'Flag as inappropriate')]" "xpath_element" exists
And I click on "Flag as inappropriate" "link" in the "Sweartag" "table_row"
And I click on "Flag as inappropriate" "link" in the "Nicetag" "table_row"
And "(1)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(1)" "text" should exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(" "text" should not exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And "Nicetag" "link" should appear before "Sweartag" "link"
And the following should exist in the "reportbuilder-table" table:
| Tag name | Flag |
| Sweartag | (1) |
| Nicetag | (1) |
And the following should not exist in the "reportbuilder-table" table:
| Tag name | Flag |
| Badtag | ( |
| Neverusertag | ( |
And I reload the page
And "Nicetag" "link" should appear before "Neverusedtag" "link"
And "Sweartag" "link" should appear before "Badtag" "link"
And "(1)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(1)" "text" should exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(" "text" should not exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
And I log out
And the following should exist in the "reportbuilder-table" table:
| Tag name | Flag |
| Sweartag | (1) |
| Nicetag | (1) |
And the following should not exist in the "reportbuilder-table" table:
| Tag name | Flag |
| Badtag | ( |
| Neverusertag | ( |

View File

@ -28,7 +28,7 @@ Feature: Manager can add standard tags and change the tag type of existing tags
And "Make standard" "link" should exist in the "Tag1" "table_row"
And "Make standard" "link" should exist in the "Tag2" "table_row"
And "Remove from standard tags" "link" should exist in the "Tag3" "table_row"
And I follow "Add standard tags"
And I click on "Add standard tags" "button"
And I set the field "Enter comma-separated list of new tags" to "Tag1,TAG2,Tag3,Tag4,Tag5"
And I press "Continue"
And I should see "Standard tag(s) added"
@ -75,12 +75,12 @@ Feature: Manager can add standard tags and change the tag type of existing tags
When I log in as "manager1"
And I navigate to "Appearance > Manage tags" in site administration
And I follow "Default collection"
And I click on "Edit this tag" "link" in the "Tag1" "table_row"
And I press "Edit" action in the "Tag1" report row
And I set the following fields to these values:
| Standard | 1 |
And I press "Update"
Then "Remove from standard tags" "link" should exist in the "Tag1" "table_row"
And I click on "Edit this tag" "link" in the "Tag1" "table_row"
And I press "Edit" action in the "Tag1" report row
And I set the following fields to these values:
| Standard | 0 |
And I press "Update"

View File

@ -5,6 +5,7 @@ here is intended especially for developers.
* New additional property 'viewurl' has been added to the pre-defined structure in tag_item_exporter. This property
represents the URL to view a given tag.
* The `core_tag_manage_table` class has been deprecated, in favour of new report builder implementation
=== 3.6 ===