Skip to content

Commit

Permalink
Merge branch '4.0-dev' into cpanel-ajax
Browse files Browse the repository at this point in the history
  • Loading branch information
infograf768 committed Mar 19, 2019
2 parents b808270 + d2098c0 commit c68a659
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Language\Language;
use Joomla\CMS\Language\MultiLanguage;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Session\Session;
Expand Down Expand Up @@ -50,8 +51,16 @@ public function setDefault()
$newLang->load('com_languages', JPATH_ADMINISTRATOR);
}

$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
$type = 'message';
if (Multilanguage::isEnabled() && $model->getState('client_id') == 0)
{
$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_MULTILANG_SAVED');
$type = 'message';
}
else
{
$msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED');
$type = 'message';
}
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion administrator/language/en-GB/en-GB.com_languages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ COM_LANGUAGES_INSTALL="Install Languages"
COM_LANGUAGES_INSTALLED_FILTER_SEARCH_DESC="Search in title and language tag."
COM_LANGUAGES_INSTALLED_FILTER_SEARCH_LABEL="Search Installed Languages"
COM_LANGUAGES_INSTALLED_TABLE_CAPTION="Table of Installed Languages"
COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED="Default Language Saved. This does not affect users that have chosen a specific language on their profile or on the login page.<br><strong class=\"red\">Warning!</strong> When using the multilingual functionality (ie when the plugin System - Language Filter is enabled) the Site Default Language also has to be a published Content language."
COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED="Default Language Saved. This does not affect users that have chosen a specific language on their profile or on the login page."
COM_LANGUAGES_MSG_DEFAULT_MULTILANG_SAVED="Default Language Saved. This does not affect users that have chosen a specific language on their profile or on the login page.<br><strong>Warning!</strong> The Site Default Language also has to be a published Content language."
COM_LANGUAGES_MSG_SWITCH_ADMIN_LANGUAGE_SUCCESS="The Administrator Language has been switched to &quot;<strong>%s</strong>&quot;."
COM_LANGUAGES_MULTILANGSTATUS_CONTACTS_ERROR="Some of the contacts linked to the user <strong>%s</strong> are incorrect."
COM_LANGUAGES_MULTILANGSTATUS_CONTACTS_ERROR_TIP="Warning! A user/author should have only one contact to which is assigned language 'All' OR one contact for each published Content Language."
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 c68a659

Please sign in to comment.