User tests: Successful: Unsuccessful:
Pull Request for Issue #19101 .
Added Tag Parent filter in tags view.
Have nested tags, filter by parent all tags below should show. Also test max levels, parent tag should by level 1 and so on.
@richard67 @ggppdk @Septdir @rgblogs can we get some tests please :-)
Status | New | ⇒ | Pending |
Category | ⇒ | com_tags Administration Language & Strings |
Labels |
Added:
?
?
|
This needs a little more work
please remove the existing code of
// Filter on the level.
if ($level = $this->getState('filter.level'))
{
$query->where('a.level <= ' . (int) $level);
}
and append it as an ELSEIF to the parent ID filter:
if (!empty($parentId))
{
// ... this is correct
// here the max level filter will be applied according to currently chosen parent id
}
// Filter on the level.
elseif ($level = $this->getState('filter.level'))
{
$query->where('a.level <= ' . (int) $level);
}
I have tested this item
Test on Joomla! 3.9.0 RC 2
P.S Maybe the parent tag itself should also be displayed after filtering?
The filter field is using the type=tag. This will give a list of all tags, which is not helpful if you have a few hundred tags.
Selecting a tag which has no children as the parent filter is meaningless.
A better solution might be to only show tags that are parents in the filter dropdown.
eg:
<field
name="parent_id"
label="Parent"
description="Select parent tag to filter by"
onchange="this.form.submit();"
default=""
query="SELECT DISTINCT c.`parent_id`, p.id AS value, p.title AS parent, p.published
FROM `#__tags` AS c
LEFT JOIN `#__tags` AS p ON c.`parent_id` = p.`id`
WHERE p.published
ORDER BY p.lft"
>
<option value="">Select parent</option>
</field>
Obviously you need language strings for the Label, Description and Default value, but I think you have those.
Also I find it is very helpful to have the parent tag visible at the top of the list so I use
// Filter on the level.
if (($level = $this->getState('filter.level')) AND !($parent = $this->getState('filter.parent')))
// if we have set a parent then don't do the simple level filter
{
$query->where('a.level <= ' . (int) $level);
}
// Filter on the parent.
if ($parent = $this->getState('filter.parent'))
{
if (($level>1) AND ($lim = self::getPlftPrgt($parent))) { //if level is empty or 1 then only show the direct children
$query->where('a.lft BETWEEN '.$lim);
} else {
$query->where('a.parent_id = ' . (int) $parent. ' OR a.id = '.(int) $parent );
//the OR ensures that the selected parent is show if level is not set
}
}
where getPlftPrgt($parent)
is a function to return the lft and rgt limits as a string eg "97 AND 101" rather than use a subquery
protected function getPlftPrgt($pid)
{
$db1 = JFactory::getDBO();
$qry = 'SELECT p.lft, p.rgt FROM #__tags AS p WHERE p.id = '.$pid;
$db1->setQuery($qry);
$ans = $db1->loadObject();
if (!$db1->query()) {
// throw new Exception($db->getErrorMsg(), 500); //could provide a better error trap than simply ignoring it
return false;
}
if (isset($ans->lft) && isset($ans->rgt)) {
return $ans->lft.' AND '.$ans->rgt;
}
return false;
}
I implemented this on my sites a while back but never realised it was a feature request - sorry about that.
This version addresses the issue of the selector for the filter getting cumbersome if you have many tags and also ensures that the parent is always show at the top of the list
I have tested this item
J3.9.2
I think it works as stated and expected.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Category | com_tags Administration Language & Strings | ⇒ | Administration com_tags |
Title |
|
Title |
|
Category | com_tags Administration | ⇒ | com_tags Administration Language & Strings |
Category | com_tags Administration Language & Strings | ⇒ | Administration com_tags |
Because this PR is a new feature it can't be merged into 3.9, please create a new PR for Joomla! 4.
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-06-05 17:05:36 |
Closed_By | ⇒ | HLeithner |
Category | com_tags Administration | ⇒ | com_tags Administration Language & Strings |
There will be 3.10 will there not?
On Wed, 5 Jun 2019 at 18:05, Harald Leithner notifications@github.com
wrote:
Because this PR is a new feature it can't be merged into 3.9, please
create a new PR for Joomla! 4.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/joomla/joomla-cms/pull/22322?email_source=notifications&email_token=AAKWBFTAJEZRHAKPGQSAIF3PY7W6PA5CNFSM4FWUW5B2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXAL53Q#issuecomment-499171054,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKWBFQQ2RE636OM4J2I5ITPY7W6PANCNFSM4FWUW5BQ
.
3.10 will not have new features. It's a compatibility version for upgrading to Joomla 4.0
I have tested this item✅ successfully on 7cabf95
Works good.But I do not like how select looks
It is possible not to get out the name of the parent but just use it
-
For example
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22322.