Commit 906e6f44 authored by Mathieu Lutfy's avatar Mathieu Lutfy Committed by Aegir user

Update KAM extension

parent 1edcc041
......@@ -18,15 +18,27 @@
padding-top: 77px;
}
.admin-bar body.crm-menubar-below-cms-menu #civicrm-menu {
z-index: 999;
}
.admin-bar body.backdrop-admin-bar-position-absolute #civicrm-menu {
position: absolute;
}
body.crm-menubar-below-cms-menu #admin-bar {
z-index: 1000;
}
}
@media (max-width: 768px) {
body.backdrop-admin-bar-position-absolute #civicrm-menu-nav {
position: absolute;
}
body #civicrm-menu-nav .crm-menubar-toggle-btn {
margin-top: 0;
top: 33px;
position: absolute;
right: 120px;
top: 0;
margin-top: 3px;
}
}
......@@ -14,8 +14,8 @@
<url desc="Support">https://github.com/aydun/uk.squiffle.kam</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2019-01-17</releaseDate>
<version>1.0</version>
<releaseDate>2019-02-06</releaseDate>
<version>1.1</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.8</ver>
......
// http://civicrm.org/licensing
(function($) {
$(document).on('crmLoad', '#civicrm-menu', function() {
if (Backdrop.settings.admin_bar && !Backdrop.settings.admin_bar.position_fixed) {
$('body').addClass('backdrop-admin-bar-position-absolute');
}
});
})(CRM.$);
......@@ -11,14 +11,14 @@
attachTo: (CRM.menubar && CRM.menubar.position === 'above-crm-container') ? '#crm-container' : 'body',
initialize: function() {
var cache = CRM.cache.get('menubar');
if (cache && cache.code === CRM.config.menuCacheCode && cache.locale === CRM.config.locale && localStorage.civiMenubar) {
if (cache && cache.code === CRM.config.menuCacheCode && cache.locale === CRM.config.locale && cache.cid === CRM.config.cid && localStorage.civiMenubar) {
CRM.menubar.data = cache.data;
insert(localStorage.civiMenubar);
} else {
$.getJSON(CRM.url('civicrm/ajax/navmenu', {c: CRM.config.menuCacheCode, l: CRM.config.locale}))
$.getJSON(CRM.url('civicrm/ajax/navmenu', {code: CRM.config.menuCacheCode, locale: CRM.config.locale, cid: CRM.config.cid}))
.done(function(data) {
var markup = getTpl('tree')(data);
CRM.cache.set('menubar', {code: CRM.config.menuCacheCode, locale: CRM.config.locale, data: data});
CRM.cache.set('menubar', {code: CRM.config.menuCacheCode, locale: CRM.config.locale, cid: CRM.config.cid, data: data});
CRM.menubar.data = data;
localStorage.setItem('civiMenubar', markup);
insert(markup);
......@@ -55,6 +55,12 @@
// For empty links - keep the menu open and don't jump the page anchor
return false;
})
.on('click', 'a:not([href^="#"])', function(e) {
if (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) {
// Prevent menu closing when link is clicked with a keyboard modifier.
e.stopPropagation();
}
})
.on('click', 'a[href="#hidemenu"]', function(e) {
e.preventDefault();
CRM.menubar.hide(250, true);
......@@ -333,8 +339,6 @@
$('#civicrm-menu').on('show.smapi', function(e, menu) {
if ($(menu).parent().attr('data-name') === 'QuickSearch') {
$('#crm-qsearch-input').focus();
} else if ($('#crm-qsearch-input').is(':focus')) {
$('#crm-qsearch-input').blur();
}
});
function setQuickSearchValue() {
......
......@@ -11,12 +11,6 @@ require_once 'kam.civix.php';
function kam_civicrm_coreResourceList(&$list, $region) {
$config = CRM_Core_Config::singleton();
// Don't load default navigation css and menu
$cssWeDontWant = array_search('css/civicrmNavigation.css', $list);
if ($cssWeDontWant !== FALSE) {
unset($list[$cssWeDontWant]);
}
//check if logged in user has access CiviCRM permission and build menu
$buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
if (!$buildNavigation || $config->userFrameworkFrontend) {
......@@ -27,7 +21,6 @@ function kam_civicrm_coreResourceList(&$list, $region) {
$contactID = CRM_Core_Session::getLoggedInContactID();
$position = Civi::settings()->get('menubar_position');
if ($contactID && $position !== 'none' && !defined('CIVICRM_DISABLE_DEFAULT_MENU')) {
define('CIVICRM_DISABLE_DEFAULT_MENU', TRUE);
$cms = strtolower(CRM_Core_Config::singleton()->userFramework);
$cms = $cms === 'drupal' ? 'drupal7' : $cms;
$path = 'packages/smartmenus-1.1.0/';
......@@ -38,13 +31,25 @@ function kam_civicrm_coreResourceList(&$list, $region) {
->addScriptFile('uk.squiffle.kam', $path . 'addons/keyboard/jquery.smartmenus.keyboard.js', -98, 'html-header')
->addScriptFile('uk.squiffle.kam', 'js/crm.menubar.js', -97, 'html-header');
$list[] = [
'config' => ['locale' => CRM_Core_I18n::getLocale()],
'config' => [
'locale' => CRM_Core_I18n::getLocale(),
'cid' => $contactID,
],
'menubar' => [
'position' => $position,
// FIXME: Providing the default explicitly should not be necessary but sometimes the 'menubar_position' setting seems to disappear
'position' => $position ?: 'over-cms-menu',
'qfKey' => CRM_Core_Key::get('CRM_Contact_Controller_Search', TRUE),
],
];
}
if (!defined('CIVICRM_DISABLE_DEFAULT_MENU')) {
define('CIVICRM_DISABLE_DEFAULT_MENU', TRUE);
// Don't load default navigation css and menu
$cssWeDontWant = array_search('css/civicrmNavigation.css', $list);
if ($cssWeDontWant !== FALSE) {
unset($list[$cssWeDontWant]);
}
}
}
}
......@@ -54,10 +59,10 @@ function kam_civicrm_coreResourceList(&$list, $region) {
function kam_civicrm_alterContent(&$content, $context, $tplName, &$object) {
$region = CRM_Core_Region::instance('html-header');
$resources = Civi::resources();
// Remove backdrop.js file
// Override backdrop.js file
$backdropJs = $region->get($resources->getUrl('civicrm', 'js/crm.backdrop.js', TRUE));
if ($backdropJs) {
$override = ['scriptUrl' => NULL];
$override = ['scriptUrl' => $resources->getUrl('uk.squiffle.kam', 'js/crm.backdrop.js', TRUE)];
$region->update($backdropJs['name'], $override);
}
// Override drupal7.js file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment