From: Coleman Watts Date: Mon, 8 Apr 2019 18:39:13 +0000 (-0400) Subject: Navigation admin - live refresh and links to related settings X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5e69f428e99be6f2a625ef5be60251d9bf658d29;p=civicrm-core.git Navigation admin - live refresh and links to related settings --- diff --git a/templates/CRM/Admin/Page/Navigation.hlp b/templates/CRM/Admin/Page/Navigation.hlp index b2e6ddd951..038ac93e0c 100644 --- a/templates/CRM/Admin/Page/Navigation.hlp +++ b/templates/CRM/Admin/Page/Navigation.hlp @@ -40,5 +40,5 @@
  • {ts}Change the permissions for a menu item. Right-click and select 'Edit'.{/ts}
  • {ts}Re-order menu items (including moving them from one branch of the menu 'tree' to another. Simply use your mouse to 'drag and drop' the menu item to the new location.{/ts}
  • -

    {ts}Changes you make to the menu are saved immediately. However, you will need reload this page to see your changes in the menu bar above.{/ts}

    +

    {ts}Changes you make to the menu are saved immediately.{/ts}

    {/htxt} diff --git a/templates/CRM/Admin/Page/Navigation.tpl b/templates/CRM/Admin/Page/Navigation.tpl index 9165e8a9d9..5c826b8488 100644 --- a/templates/CRM/Admin/Page/Navigation.tpl +++ b/templates/CRM/Admin/Page/Navigation.tpl @@ -27,19 +27,19 @@ {include file="CRM/Admin/Form/Navigation.tpl"} {else}
    - {ts}Customize the CiviCRM navigation menu bar for your users here.{/ts} {help id="id-navigation"} + {capture assign="displayPrefUrl"}href="{crmURL p='civicrm/admin/setting/preferences/display' q='reset=1'}"{/capture} + {capture assign="searchPrefUrl"}href="{crmURL p='civicrm/admin/setting/search' q='reset=1'}"{/capture} +

    {ts}Customize the CiviCRM navigation menu bar for your users here.{/ts} {help id="id-navigation"}

    +

    {ts 1=$displayPrefUrl}The menu color and position can be adjusted on the Display Preferences screen.{/ts}

    +

    {ts 1=$searchPrefUrl}Quicksearch options can be edited on the Search Preferences screen.{/ts}

    - {crmButton p="civicrm/admin/menu" q="action=add&reset=1" id="newMenuItem" icon="crm-i fa-plus-circle" style="margin-left: 6px;"}{ts}Add Menu Item{/ts}{/crmButton}     -

    + {crmButton p="civicrm/admin/menu" q="action=add&reset=1" id="newMenuItem" icon="crm-i fa-plus-circle" style="margin-left: 6px;"}{ts}Add Menu Item{/ts}{/crmButton}
    -
    +
    @@ -63,7 +63,7 @@ return: ['label', 'parent_id', 'icon'], name: {'!=': 'Home'}, sequential: 1 - }).done(function(data) { + }).then(function(data) { var items = []; $.each(data.values, function(key, value) { items.push({ @@ -108,9 +108,8 @@ } CRM.confirm({message: deleteMsg}) .on('crmConfirm:yes', function() { - CRM.api3('Navigation', 'delete', {id: nodeID}, true); + CRM.api3('Navigation', 'delete', {id: nodeID}, true).then(refreshMenubar); $("#navigation-tree").jstree(true).delete_node(menu.reference.closest('li')); - $("#reset-menu").show(); }); } } @@ -123,8 +122,7 @@ var refID = data.parent === '#' ? '' : data.parent; var ps = data.position; var postURL = {/literal}"{crmURL p='civicrm/ajax/menutree' h=0 q='key='}{crmKey name='civicrm/ajax/menutree'}"{literal}; - CRM.status({}, $.get( postURL + '&type=move&id=' + nodeID + '&ref_id=' + refID + '&ps='+ps)); - $("#reset-menu").show(); + CRM.status({}, $.get( postURL + '&type=move&id=' + nodeID + '&ref_id=' + refID + '&ps='+ps).then(refreshMenubar)); }); function editForm(menu) { @@ -138,7 +136,7 @@ } CRM.loadForm(CRM.url('civicrm/admin/menu', args)).on('crmFormSuccess', function() { $("#navigation-tree").jstree(true).refresh(); - $("#reset-menu").show(); + refreshMenubar(); }); } @@ -146,7 +144,7 @@ .on('click', CRM.popup) .on('crmPopupFormSuccess', function() { $("#navigation-tree").jstree(true).refresh(); - $("#reset-menu").show(); + refreshMenubar(); }); $('a.nav-reset').on('click', function(e) { @@ -158,13 +156,20 @@ .on('crmConfirm:yes', function() { $('#crm-container').block(); CRM.api3('Navigation', 'reset', {'for': 'report'}, true) - .done(function() { + .then(function() { $('#crm-container').unblock(); $("#navigation-tree").jstree(true).refresh(); - $("#reset-menu").show(); - }) + refreshMenubar(); + }); }); }); + + // Force-refresh the menubar by resetting the cache code + function refreshMenubar() { + CRM.menubar.destroy(); + CRM.menubar.cacheCode = Math.random(); + CRM.menubar.initialize(); + } }); {/literal}