Skip to content

Commit

Permalink
Merge branch '4.0-dev' into useNamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonge committed Mar 19, 2019
2 parents 73bde52 + 5d6f86d commit 3231287
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 6 deletions.
10 changes: 6 additions & 4 deletions administrator/components/com_finder/tmpl/filter/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

use Joomla\CMS\Layout\LayoutHelper;

JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
JHtml::_('behavior.core');
Expand All @@ -24,7 +26,7 @@

<form action="<?php echo JRoute::_('index.php?option=com_finder&view=filter&layout=edit&filter_id=' . (int) $this->item->filter_id); ?>" method="post" name="adminForm" id="adminForm" class="form-validate">

<?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>
<?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>

<?php echo JHtml::_('uitab.startTabSet', 'myTab', array('active' => 'details')); ?>

Expand All @@ -47,18 +49,18 @@
<div class="col-md-3">
<div class="card card-light">
<div class="card-body">
<?php echo JLayoutHelper::render('joomla.edit.global', $this); ?>
<?php echo LayoutHelper::render('joomla.edit.global', $this); ?>
</div>
</div>
</div>
</div>
<?php echo JHtml::_('uitab.endTab'); ?>

<?php echo JHtml::_('uitab.addTab', 'myTab', 'publishing', JText::_('JGLOBAL_FIELDSET_PUBLISHING')); ?>
<?php echo JLayoutHelper::render('joomla.edit.publishingdata', $this); ?>
<?php echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?>
<?php echo JHtml::_('uitab.endTab'); ?>

<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>

<?php echo JHtml::_('uitab.endTabSet'); ?>

Expand Down
3 changes: 2 additions & 1 deletion administrator/components/com_finder/tmpl/index/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\Component\Finder\Administrator\Helper\FinderHelperLanguage;

JHtml::_('bootstrap.popover');
Expand All @@ -30,7 +31,7 @@
</div>
<div class="col-md-10">
<div id="j-main-container" class="j-main-container">
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<table class="table">
<caption id="captionTable" class="sr-only">
<?php echo Text::_('COM_FINDER_INDEX_TABLE_CAPTION'); ?>, <?php echo Text::_('JGLOBAL_SORTED_BY'); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
Expand All @@ -26,7 +27,7 @@
</div>
<div class="col-md-10">
<div id="j-main-container" class="j-main-container">
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => false))); ?>
<?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => false))); ?>
<?php if (empty($this->items)) : ?>
<div class="alert alert-warning">
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
Expand Down
151 changes: 151 additions & 0 deletions build/media_source/mod_menu/js/menu.es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/**
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

(() => {
'use strict';

function topLevelMouseOver(el, settings) {
const ulChild = el.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'false');
ulChild.classList.add(settings.menuHoverClass);
}
}

function topLevelMouseOut(el, settings) {
const ulChild = el.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'true');
ulChild.classList.remove(settings.menuHoverClass);
}
}

function setupNavigation(nav) {
const settings = {
menuHoverClass: 'show-menu',
dir: 'ltr',
};
const topLevelChilds = nav.querySelectorAll(':scope > li');

// Set tabIndex to -1 so that top_level_childs can't receive focus until menu is open
topLevelChilds.forEach((topLevelEl) => {
const linkEl = topLevelEl.querySelector('a');
if (linkEl) {
linkEl.tabIndex = '0';
linkEl.addEventListener('mouseover', topLevelMouseOver(topLevelEl, settings));
linkEl.addEventListener('mouseout', topLevelMouseOut(topLevelEl, settings));
}
const spanEl = topLevelEl.querySelector('span');
if (spanEl) {
spanEl.tabIndex = '0';
spanEl.addEventListener('mouseover', topLevelMouseOver(topLevelEl, settings));
spanEl.addEventListener('mouseout', topLevelMouseOut(topLevelEl, settings));
}

topLevelEl.addEventListener('mouseover', (event) => {
const curEl = event.target;
const ulChild = curEl.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'false');
ulChild.classList.add(settings.menuHoverClass);
}
});

topLevelEl.addEventListener('mouseout', (event) => {
const curEl = event.target;
const ulChild = curEl.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'true');
ulChild.classList.remove(settings.menuHoverClass);
}
});

topLevelEl.addEventListener('focus', (event) => {
const curEl = event.target;
const ulChild = curEl.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'true');
ulChild.classList.add(settings.menuHoverClass);
}
});

topLevelEl.addEventListener('blur', (event) => {
const curEl = event.target;
const ulChild = curEl.querySelector('ul');
if (ulChild) {
ulChild.setAttribute('aria-hidden', 'false');
ulChild.classList.remove(settings.menuHoverClass);
}
});

topLevelEl.addEventListener('keydown', (event) => {
const keyName = event.key;
const curEl = event.target;
const curLiEl = curEl.parentElement;
const curUlEl = curLiEl.parentElement;
let prevLiEl = curLiEl.previousElementSibling;
let nextLiEl = curLiEl.nextElementSibling;
if (!prevLiEl) {
prevLiEl = curUlEl.children[curUlEl.children.length - 1];
}
if (!nextLiEl) {
[nextLiEl] = curUlEl.children;
}
switch (keyName) {
case 'ArrowLeft':
event.preventDefault();
if (settings.dir === 'rtl') {
nextLiEl.children[0].focus();
} else {
prevLiEl.children[0].focus();
}
break;
case 'ArrowRight':
event.preventDefault();
if (settings.dir === 'rtl') {
prevLiEl.children[0].focus();
} else {
nextLiEl.children[0].focus();
}
break;
case 'ArrowUp':
{
event.preventDefault();
const parent = curLiEl.parentElement.parentElement;
if (parent.nodeName === 'LI') {
parent.children[0].focus();
} else {
prevLiEl.children[0].focus();
}
break;
}
case 'ArrowDown':
event.preventDefault();
if (curLiEl.classList.contains('parent')) {
const child = curLiEl.querySelector('ul');
if (child != null) {
const childLi = child.querySelector('li');
childLi.children[0].focus();
} else {
nextLiEl.children[0].focus();
}
} else {
nextLiEl.children[0].focus();
}
break;
default:
break;
}
});
});
}

document.addEventListener('DOMContentLoaded', () => {
const navs = document.querySelectorAll('.nav');
[].forEach.call(navs, (nav) => {
setupNavigation(nav);
});
});
})();
3 changes: 3 additions & 0 deletions modules/mod_menu/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Helper\ModuleHelper;

HTMLHelper::_('script', 'mod_menu/menu.min.js', array('version' => 'auto', 'relative' => true));

$id = '';

if ($tagId = $params->get('tag_id', ''))
Expand Down

0 comments on commit 3231287

Please sign in to comment.