-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modal category searchtools optimization #8633
Conversation
Bring up all relevant filters to the modal category field. The template code is simplified while enjoying the factorization of JLayoutHelper. To test the modal category field ( you can you can do what is indicated at joomla#8185 ) : Change the file administrator/components/com_content/models/forms/article.xml 45: <field name="catid" type="categoryedit" to 45: <field name="catid" type="modal_category" and open an article
I have tested this item ✅ successfully on b5cf4b8 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8633. |
Thanks for testing @Gerlof. You are right, I could notice that the category modal will not work on mobile. It could be an other PR. |
I have tested this item ✅ successfully on b5cf4b8 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8633. |
Setting RTC - thanks for testing This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8633. |
I am taking off the RTC Label here as this patch has the potential of killing multilingual sites category associations by letting associate a category to itself or to the wrong target language. The language filter/Select should NOT display in this case. It should obey to ForcedLanguage https://www.dropbox.com/s/ij46tywkgvpwtu6/modal_categories.mp4?dl=0 |
Taking off RTC This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8633. |
Can you have a look at this? I tried to play with filtersHidden without much success. |
I have a solution which works here, by not displaying the language filter in SearchTools ONLY when dealing with category multilingual associations. We first have to check if the modal_category type field is used when dealing with category associations. The variable In /administrator/components/com_categories/views/categories/tmpl/modal.php (once applied this PR), I add on top
Then I modify further down the call to searchtools layout by adding an option:
Then I modify /layouts/joomla/searchtools/default/filters.php to get something like:
Here are the screenshots obtained. Then, after changing the catid field in article.xml to "modal_category" @Bakual @phproberto |
Hmm, even that does not work perfectly when the field modal_category is added to other xmls. |
'filtersHidden' is a boolean. I guess it is used to hide all filters ? I propose to introduce a 'hiddenFilters' (array) option that lets us set filters as hidden: /layouts/joomla/searchtools/default/filters.php <?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
$data = $displayData;
// Load the form filters
$filters = $data['view']->filterForm->getGroup('filter');
// Introduced a 'hiddenFilters' (array) option that lets us set filters as hidden
if (isset($data['options']['hiddenFilters']))
{
foreach ($data['options']['hiddenFilters'] as $hiddenFilter){
if (isset($filters[$hiddenFilter]))
{
unset($filters[$hiddenFilter]);
}
}
}
// Remove explicitly the search filter
unset($filters['filter_search']);
?>
<?php if ($filters) : ?>
<?php foreach ($filters as $fieldName => $field) : ?>
<div class="js-stools-field-filter">
<?php echo $field->input; ?>
</div>
<?php endforeach; ?>
<?php endif; ?> Then, We can do: echo JLayoutHelper::render('joomla.searchtools.default', array(
'view' => $this,
'options' => array(
'hiddenFilters' => array('filter_language')
)
)); |
This does not work either in categories association. When using the Clear button it reinstate the language filter. FYI, this modal and the "modal_category" field were never coded to be used elsewhere than for category associations... If someone wants to use that field elsewhere it should never show the language filter in the associations case and always display it in any other case. It has to be tested on a multilingual site and the "modal_category" field should be able to replace everywhere the "categoryedit" field. |
I Thank You for your help, I'll open an other PR "Possibility to remove filters individually when using the searchtools layout helper" with the code I have just given. I am convinced it could be useful in many situations. If it's validated, |
Ok for the new feature for the filters.php, but please remember that in this precise case of "modal_category", with your code (this PR + your proposed filters.php), we still have an issue with the Clear button when we have a conditional.
and I get https://www.dropbox.com/s/qyi6j8pds5yrga4/cat_modal2.mp4?dl=0 If I do not have any conditional, then your filters.php works great. |
Thank You, There seems to work well with : <fieldset class="filter clearfix">
<?php if ($this->state->get('filter.forcedLanguage')) : ?>
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('hiddenFilters' => array('filter_language')))); ?>
<input type="hidden" name="forcedLanguage" value="<?php echo $this->escape($this->state->get('filter.forcedLanguage')); ?>" />
<input type="hidden" name="filter_language" value="<?php echo $this->escape($this->state->get('filter.language')); ?>" />
<?php else : ?>
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<?php endif; ?>
<hr class="hr-condensed" /> |
@panopt
|
For issue 2, looks like it can be solved by re-adding
|
as for the tip we are already missing in the present modal.php the "data-placement="bottom" |
For fix the issue 1. 'we can't sort anymore when clicking on the column headings'. |
For fix issue 2. 'the Search Tools buttons tips are unreadable as they are displayed on top of the buttons':
(Notice that bootstrap 2 does not allow 'auto top' placement) @infograf768, thank you again |
These would work indeed. |
If you can give the searchtools buttons a specific class, then you can place those tooltips different from the others by using two JHtml::_('bootstrap.tooltip) calls. One generic and one for the search tool specific ones. |
@Bakual We could override this layout when using com_categories directly, but would it work when the modal_category field is used in other contexts (for example a module or a menu item)? |
We could also directly add a second class to the core JLayout for Searchtools, which would then allow to target it. Or maybe adjust the JLayout so a class could be passed. |
if i understand correctly the issue here, this is already solved in latest staging @brianteeman @infograf768 |
I am closing this at this time as it appears to have been resolved elsewhere and there has been no response to the comments. It can always be reopened if that is done. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8633. |
Bring up all relevant filters to the modal category field.
The template code is simplified while enjoying the factorization of JLayoutHelper.
Testing
To test the modal category field ( you can do what is indicated at #8185; listed below ) :
administrator/components/com_content/models/forms/article.xml
45 - :
<field name="catid" type="categoryedit"
45 + :
<field name="catid" type="modal_category"