1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 10:26:17 +02:00
This commit is contained in:
Sara Arjona 2022-09-12 14:56:02 +02:00
commit c6bac74c2f
6 changed files with 73 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -142,7 +142,7 @@ define([
$("#tag-management-delete").click(function(e) {
var form = $(this).closest('form').get(0);
var cnt = $(form).find("input[type=checkbox]:checked").length;
var cnt = $(form).find("input[data-togglegroup='tags-manage'][data-toggle='slave']:checked").length;
if (!cnt) {
return;
}
@ -172,7 +172,7 @@ define([
e.preventDefault();
var form = $(this).closest('form').get(0);
var tags = $(form).find("input[type=checkbox]:checked");
var tags = $(form).find("input[data-togglegroup='tags-manage'][data-toggle='slave']:checked");
if (tags.length <= 1) {
str.get_strings([

@ -14,13 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Contains class core_tag_manage_table
*
* @package core_tag
* @copyright 2015 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use core\output\checkbox_toggleall;
defined('MOODLE_INTERNAL') || die();
@ -29,7 +23,7 @@ require_once($CFG->libdir . '/tablelib.php');
/**
* Class core_tag_manage_table
*
* @package core
* @package core_tag
* @copyright 2015 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -47,7 +41,8 @@ class core_tag_manage_table extends table_sql {
* @param int $tagcollid
*/
public function __construct($tagcollid) {
global $USER, $CFG, $PAGE;
global $USER, $PAGE, $OUTPUT;
parent::__construct('tag-management-list-'.$USER->id);
$this->tagcollid = $tagcollid;
@ -58,8 +53,16 @@ class core_tag_manage_table extends table_sql {
$baseurl = new moodle_url('/tag/manage.php', array('tc' => $tagcollid,
'perpage' => $perpage, 'page' => $page, 'filter' => $filter));
$checkboxall = new checkbox_toggleall('tags-manage', true, [
'id' => 'select-all-tags',
'name' => 'select-all-tags',
'checked' => false,
'label' => get_string('selectall'),
'labelclasses' => 'accesshide',
]);
$tablecolumns = array('select', 'name', 'fullname', 'count', 'flag', 'timemodified', 'isstandard', 'controls');
$tableheaders = array(get_string('select', 'tag'),
$tableheaders = array($OUTPUT->render($checkboxall),
get_string('name', 'tag'),
get_string('owner', 'tag'),
get_string('count', 'tag'),
@ -176,6 +179,20 @@ class core_tag_manage_table extends table_sql {
}
}
/**
* Override the table show_hide_link to not show for select column.
*
* @param string $column the column name, index into various names
* @param int $index numerical index of the column
* @return string HTML fragment
*/
protected function show_hide_link($column, $index) {
if ($index > 0) {
return parent::show_hide_link($column, $index);
}
return '';
}
/**
* Get any extra classes names to add to this row in the HTML
*
@ -252,11 +269,18 @@ class core_tag_manage_table extends table_sql {
* @return string
*/
public function col_select($tag) {
$id = "tagselect" . $tag->id;
return html_writer::label(get_string('selecttag', 'tag', $tag->rawname), $id,
false, array('class' => 'accesshide')).
html_writer::empty_tag('input', array('type' => 'checkbox',
'name' => 'tagschecked[]', 'value' => $tag->id, 'id' => $id));
global $OUTPUT;
$checkbox = new checkbox_toggleall('tags-manage', false, [
'id' => 'tagselect' . $tag->id,
'name' => 'tagschecked[]',
'value' => $tag->id,
'checked' => false,
'label' => get_string('selecttag', 'tag', $tag->rawname),
'labelclasses' => 'accesshide',
]);
return $OUTPUT->render($checkbox);
}
/**

@ -104,3 +104,18 @@ Feature: Manager is able to delete tags
And I should see "Cat"
And I should not see "Dog"
And I log out
@javascript
Scenario: Delete all tags
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 field "Select all" to "1"
And I press "Delete selected"
And I click on "Yes" "button" in the "Delete" "dialogue"
Then I should see "Tag(s) deleted"
And I should see "Nothing to display"
And I should not see "Cat"
And I should not see "Dog"
And I should not see "Turtle"
And I should not see "Neverusedtag"

@ -225,6 +225,21 @@ Feature: Users can edit tags to add description or rename
# Even though Turtle was not standard but at least one of combined tags was (Neverusedtag). Now Turtle is also standard.
And "Remove from standard tags" "link" should exist in the "Turtle" "table_row"
@javascript
Scenario: Combining all tags
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 field "Select all" to "1"
And I press "Combine selected"
And I set the field "Turtle" in the "Combine selected" "dialogue" to "1"
And I click on "Continue" "button" in the "Combine selected" "dialogue"
Then I should see "Tags are combined"
And I should not see "Cat"
And I should not see "Dog"
And I should see "Turtle"
And I should not see "Neverusedtag"
Scenario: Filtering tags
When I log in as "manager1"
And I navigate to "Appearance > Manage tags" in site administration