Skip to content

Commit

Permalink
Merge pull request #17579 from colemanw/menubarSep
Browse files Browse the repository at this point in the history
Update has_separator field in civicrm_navigation
  • Loading branch information
seamuslee001 authored Jun 12, 2020
2 parents 2869021 + e0674c3 commit d4b99fb
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function buildQuickForm() {
$this->add('select', 'permission_operator', NULL, $operators);

//make separator location configurable
$separator = [ts('None'), ts('After menu element'), ts('Before menu element')];
$separator = CRM_Core_SelectValues::navigationMenuSeparator();
$this->add('select', 'has_separator', ts('Separator'), $separator);

$active = $this->add('advcheckbox', 'is_active', ts('Enabled'));
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/CodeGen/Specification.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public function getField(&$fieldXML, &$fields) {
default:
$field['phpType'] = $this->value('phpType', $fieldXML, $type);
$field['sqlType'] = $type;
if ($type == 'int unsigned') {
if ($type == 'int unsigned' || $type == 'tinyint') {
$field['phpType'] = 'int';
$field['crmType'] = 'CRM_Utils_Type::T_INT';
}
Expand Down
16 changes: 10 additions & 6 deletions CRM/Core/DAO/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Navigation.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:3819d9a3e40bfbc36a06809c1f4bd98c)
* (GenCodeChecksum:8d6052b04bcd4a7bdfff07ecfa14e60b)
*/

/**
Expand Down Expand Up @@ -97,9 +97,9 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
public $is_active;

/**
* If separator needs to be added after this menu item
* Place a separator either before or after this menu item.
*
* @var bool
* @var int
*/
public $has_separator;

Expand Down Expand Up @@ -289,14 +289,18 @@ public static function &fields() {
],
'has_separator' => [
'name' => 'has_separator',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Use separator'),
'description' => ts('If separator needs to be added after this menu item'),
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Separator'),
'description' => ts('Place a separator either before or after this menu item.'),
'where' => 'civicrm_navigation.has_separator',
'default' => '0',
'table_name' => 'civicrm_navigation',
'entity' => 'Navigation',
'bao' => 'CRM_Core_BAO_Navigation',
'localizable' => 0,
'pseudoconstant' => [
'callback' => 'CRM_Core_SelectValues::navigationMenuSeparator',
],
],
'weight' => [
'name' => 'weight',
Expand Down
14 changes: 14 additions & 0 deletions CRM/Core/SelectValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,9 @@ public static function getComponentSelectValues() {
return $ret;
}

/**
* @return string[]
*/
public static function fieldSerialization() {
return [
CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND => 'separator_bookend',
Expand All @@ -1182,4 +1185,15 @@ public static function fieldSerialization() {
];
}

/**
* @return array
*/
public static function navigationMenuSeparator() {
return [
ts('None'),
ts('After menu element'),
ts('Before menu element'),
];
}

}
4 changes: 4 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.28.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{* file to handle db changes in 5.28.alpha1 during upgrade *}

-- https://github.com/civicrm/civicrm-core/pull/17579
ALTER TABLE `civicrm_navigation` CHANGE `has_separator`
`has_separator` tinyint DEFAULT 0 COMMENT 'Place a separator either before or after this menu item.';

-- https://github.com/civicrm/civicrm-core/pull/17450
ALTER TABLE `civicrm_activity` CHANGE `activity_date_time` `activity_date_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.';
ALTER TABLE `civicrm_activity` CHANGE `created_date` `created_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When was the activity was created.';
Expand Down
6 changes: 2 additions & 4 deletions css/crm-menubar.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
#civicrm-menu li li a {
padding: 6px 36px 6px 10px;
}
#civicrm-menu li.crm-menu-border-bottom:not(:last-child) {
border-bottom: 1px solid #bbb;
}
#civicrm-menu li:not(.crm-menu-border-bottom) + li.crm-menu-border-top {
#civicrm-menu li.crm-menu-border-bottom + li,
#civicrm-menu li + li.crm-menu-border-top {
border-top: 1px solid #bbb;
}
#civicrm-menu li a:focus,
Expand Down
10 changes: 7 additions & 3 deletions xml/schema/Core/Navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,14 @@
</field>
<field>
<name>has_separator</name>
<title>Use separator</title>
<type>boolean</type>
<comment>If separator needs to be added after this menu item</comment>
<title>Separator</title>
<type>tinyint</type>
<comment>Place a separator either before or after this menu item.</comment>
<default>0</default>
<add>3.0</add>
<pseudoconstant>
<callback>CRM_Core_SelectValues::navigationMenuSeparator</callback>
</pseudoconstant>
</field>
<field>
<name>weight</name>
Expand Down

0 comments on commit d4b99fb

Please sign in to comment.