Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/com_finder/helpers/html/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ public static function explained(FinderIndexerQuery $query)
if ($query->date1)
{
$date = JFactory::getDate($query->date1)->format(JText::_('DATE_FORMAT_LC'));
$parts[] = '<span class="query-start-date">' . JText::sprintf('COM_FINDER_QUERY_START_DATE', $query->when1, $date) . '</span>';
$datecondition = JText::_('COM_FINDER_QUERY_DATE_CONDITION_' . strtoupper($query->when1));
$parts[] = '<span class="query-start-date">' . JText::sprintf('COM_FINDER_QUERY_START_DATE', $datecondition, $date) . '</span>';
}

// Process the end date.
if ($query->date2)
{
$date = JFactory::getDate($query->date2)->format(JText::_('DATE_FORMAT_LC'));
$parts[] = '<span class="query-end-date">' . JText::sprintf('COM_FINDER_QUERY_END_DATE', $query->when2, $date) . '</span>';
$datecondition = JText::_('COM_FINDER_QUERY_DATE_CONDITION_' . strtoupper($query->when2));
$parts[] = '<span class="query-end-date">' . JText::sprintf('COM_FINDER_QUERY_END_DATE', $datecondition, $date) . '</span>';
}

// Process the taxonomy filters.
Expand Down
70 changes: 21 additions & 49 deletions components/com_finder/views/search/tmpl/default_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,24 @@
JHtml::_('jquery.framework');

$script = "
jQuery(function() {
";
jQuery(function() {";
if ($this->params->get('show_advanced', 1))
{
/*
* This segment of code adds the slide effect to the advanced search box.
*/
$script .= "
var searchSlider = jQuery('#advanced-search');
if (searchSlider.length)
{";
if (!$this->params->get('expand_advanced', 0))
{
$script .= "searchSlider.hide();";
}

$script .= "
jQuery('#advanced-search-toggle').on('click', function(e) {
e.stopPropagation();
e.preventDefault();
searchSlider.slideToggle();
});
}";
/*
* This segment of code disables select boxes that have no value when the
* form is submitted so that the URL doesn't get blown up with null values.
*/
$script .= "
if (jQuery('#finder-search').length) {
jQuery('#finder-search').on('submit', function(e){
e.stopPropagation();
if (searchSlider.length)
{
// Disable select boxes with no value selected.
searchSlider.find('select').each(function(index, el) {
var el = jQuery(el);
if(!el.val()){
el.attr('disabled', 'disabled');
}
});
}
});
jQuery('#finder-search').on('submit', function(e){
e.stopPropagation();
// Disable select boxes with no value selected.
jQuery('#advancedSearch').find('select').each(function(index, el) {
var el = jQuery(el);
if(!el.val()){
el.attr('disabled', 'disabled');
}
";
});
});";
}
/*
* This segment of code sets up the autocompleter.
Expand All @@ -67,21 +41,19 @@
JHtml::_('script', 'media/jui/js/jquery.autocomplete.min.js', false, false, false, false, true);

$script .= "
var suggest = jQuery('#q').autocomplete({
serviceUrl: '" . JRoute::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component', false) . "',
paramName: 'q',
minChars: 1,
maxHeight: 400,
width: 300,
zIndex: 9999,
deferRequestBy: 500
});
";
var suggest = jQuery('#q').autocomplete({
serviceUrl: '" . JRoute::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component', false) . "',
paramName: 'q',
minChars: 1,
maxHeight: 400,
width: 300,
zIndex: 9999,
deferRequestBy: 500
});";
}

$script .= "
});
";
});";

JFactory::getDocument()->addScriptDeclaration($script);
}
Expand Down Expand Up @@ -114,7 +86,7 @@
</fieldset>

<?php if ($this->params->get('show_advanced', 1)) : ?>
<div id="advancedSearch" class="collapse">
<div id="advancedSearch" class="collapse<?php if ($this->params->get('expand_advanced', 0)) echo ' in'?>">
<hr />
<?php if ($this->params->get('show_advanced_tips', 1)) : ?>
<div class="advanced-search-tip">
Expand Down
3 changes: 3 additions & 0 deletions language/en-GB/en-GB.com_finder.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ COM_FINDER_FILTER_DATE2_DESC="Enter a date in YYYY-MM-DD format"
COM_FINDER_FILTER_SELECT_ALL_LABEL="Search All"
COM_FINDER_FILTER_WHEN_AFTER="After"
COM_FINDER_FILTER_WHEN_BEFORE="Before"
COM_FINDER_QUERY_DATE_CONDITION_AFTER="after"
COM_FINDER_QUERY_DATE_CONDITION_BEFORE="before"
COM_FINDER_QUERY_DATE_CONDITION_EXACT="exactly on"
COM_FINDER_QUERY_END_DATE="ending date <span class="_QQ_"when"_QQ_">%s</span> <span class="_QQ_"date"_QQ_">%s</span>"
COM_FINDER_QUERY_OPERATOR_AND="and"
COM_FINDER_QUERY_OPERATOR_OR="or"
Expand Down