joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.73k stars 3.64k forks source link

Missing search tooltip #7146

Closed brianteeman closed 9 years ago

brianteeman commented 9 years ago

While answering a support request about using the filter search in the admin and menu manager I realised that the strings

COM_CONTENT_FILTER_SEARCH_DESC="Search title or alias. Prefix with ID: to search for an article ID." COM_MENUS_ITEMS_SEARCH_FILTER="Search title or alias. Prefix with ID: to search for a menu ID." Are never being displayed

Looking at the relevant code it should be

< input type="text" name="filter_search" id="filtersearch" placeholder="<?php echo JText::('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_MENUS_ITEMS_SEARCH_FILTER'); ?>" />

Is this something to do with the switch to using a layout?

infograf768 commented 9 years ago

Yes.

infograf768 commented 9 years ago

There is a possible solution to get it back: screen shot 2015-06-10 at 11 27 47

brianteeman commented 9 years ago

And what is that solution?

infograf768 commented 9 years ago

I guess using JQuery to inject in the input the class and title

Bakual commented 9 years ago

The issue is that our JForm adds the tooltip to the label, but we don't have labels in our searchtools and thus no tooltips are shown. We would need to add them to the input elements. However as those are generated by the individual JFormFields the simplest solution would probably be to add a span around the input which contains the tooltip.

You could use <?php echo JText::_($filters['filter_search']->description); ?> to add the description text to the element. Assuming a description is defined in the XML (https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/forms/filter_articles.xml#L4), which in this case is missing.

The search input is generated in this JLayout: https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/searchtools/default/bar.php#L37

By the way, a similar issue exists for the other searchtool filters as well. No labels and tooltips are present there.

brianteeman commented 9 years ago

YEs I realised that it was not being displayed in all the searchtools and in Hathor which uses an override

On 10 June 2015 at 12:09, Thomas Hunziker notifications@github.com wrote:

The issue is that our JForm adds the tooltip to the label, but we don't have labels in our searchtools and thus no tooltips are shown. We would need to add them to the input elements. However as those are generated by the individual JFormFields the simplest solution would probably be to add a span around the input which contains the tooltip.

You could use <?php echo JText::_($filters['filter_search']->description); ?> to add the description text to the element. Assuming a description is defined in the XML ( https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/forms/filter_articles.xml#L4), which in this case is missing.

The search input is generated in this JLayout: https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/searchtools/default/bar.php#L37

By the way, a similar issue exists for the other searchtool filters as well. No labels and tooltips are present there.

— Reply to this email directly or view it on GitHub https://github.com/joomla/joomla-cms/issues/7146#issuecomment-110701737.

Brian Teeman Co-founder Joomla! and OpenSourceMatters Inc. http://brian.teeman.net/

Bakual commented 9 years ago

I'm not sure what the best approach is. Adding spans around a form element just to be able to add a tooltip sounds hacky to me. But I don't know a better (easy) way currently. I think the tooltip could also be created using JavaScript directly, but I'm not a JS guru and I'd prefer to use our API.

brianteeman commented 9 years ago

I guess an easy option would be to replace the tooltip on the search button which just says Search with the more informative tooltip??


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7146.

infograf768 commented 9 years ago

That tooltip is also present in the layout <button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>">

string is: JSEARCH_FILTER_SUBMIT="Search"

Only way I see to add the right tooltip on the button would be to override that string in the component by adding (for example in en-GB.com_content.ini) JSEARCH_FILTER_SUBMIT="Search title or alias. Prefix with ID: to search for an article ID."

screen shot 2015-06-11 at 11 55 02

Bakual commented 9 years ago

We could use the description specified in the filter form and fall back to JSEARCH_FILTER_SUBMIT in case no description is specified. That would even be B/C.

Bakual commented 9 years ago

Have a look at PR #7150 if that solves this issue.

zero-24 commented 9 years ago

Closing as we have a Pull Request by @Bakual #7150