Skip to content

Commit

Permalink
Pass menubar preference as a param. Simplify cache mechanics. (#8)
Browse files Browse the repository at this point in the history
Ex: If an admin uses an API call (CLI/REST) to change the menubar color,
then they don't need to follow-up with a cache-clear.  The new setting just
goes live.

Ex: If a customization (via `civicrm.settings.php` or via extension) decides
on the color scheme programmatically (e.g.  per-domain or per-role or
per-user-preference), then they don't need to clear cache.  Multiple color
schemes can coexist.
  • Loading branch information
totten authored and colemanw committed Apr 8, 2019
1 parent 8a52ae3 commit 08a3a51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions CRM/Admin/Form/Preferences/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ public function postProcess() {

$this->postProcessCommon();

\Civi::service('asset_builder')->clear();

// If "Configure CKEditor" button was clicked
if (!empty($this->_params['ckeditor_config'])) {
// Suppress the "Saved" status message and redirect to the CKEditor Config page
Expand Down
6 changes: 4 additions & 2 deletions CRM/Core/Resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,9 @@ public function coreResourceList($region) {
$items[] = 'bower_components/smartmenus/dist/jquery.smartmenus.min.js';
$items[] = 'bower_components/smartmenus/dist/addons/keyboard/jquery.smartmenus.keyboard.min.js';
$items[] = 'js/crm.menubar.js';
$items[] = Civi::service('asset_builder')->getUrl('crm-menubar.css');
$items[] = Civi::service('asset_builder')->getUrl('crm-menubar.css', [
'color' => Civi::settings()->get('menubar_color'),
]);
$items[] = [
'menubar' => [
'position' => $position,
Expand Down Expand Up @@ -844,7 +846,7 @@ public static function renderMenubarStylesheet(GenericHookEvent $e) {
foreach ($items as $item) {
$e->content .= file_get_contents(self::singleton()->getPath('civicrm', $item));
}
$color = Civi::settings()->get('menubar_color');
$color = $e->params['color'];
if (!CRM_Utils_Rule::color($color)) {
$color = Civi::settings()->getDefault('menubar_color');
}
Expand Down

0 comments on commit 08a3a51

Please sign in to comment.