Skip to content
Snippets Groups Projects
Commit dafd2d75 authored by colemanw's avatar colemanw
Browse files

CRM-14165 - Improve lookup and styling of options edit link

parent 54df0f0c
No related branches found
No related tags found
No related merge requests found
......@@ -919,11 +919,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
if (!isset($props['data-api-field'])) {
$props['data-api-field'] = strrpos($name, '[') ? rtrim(substr($name, 1 + strrpos($name, '[')), ']') : $name;
}
$options = civicrm_api3($props['data-api-entity'], 'getoptions', array(
$info = civicrm_api3($props['data-api-entity'], 'getoptions', array(
'field' => $props['data-api-field'],
'options' => array('metadata' => array('fields'))
)
);
$options = $options['values'];
$options = $info['values'];
if (!array_key_exists('placeholder', $props)) {
$props['placeholder'] = $required ? ts('- select -') : ts('- none -');
}
......@@ -939,8 +940,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
}
// Core field
else {
$getFields = civicrm_api3($props['data-api-entity'], 'getfields');
foreach($getFields['values'] as $uniqueName => $fieldSpec) {
foreach($info['metadata']['fields'] as $uniqueName => $fieldSpec) {
if (
$uniqueName === $props['data-api-field'] ||
CRM_Utils_Array::value('name', $fieldSpec) === $props['data-api-field'] ||
......
......@@ -137,9 +137,9 @@ class CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty {
*
* @access private
*
* @param object An HTML_QuickForm_element object
* @param bool Whether an element is required
* @param string Error associated with the element
* @param $element HTML_QuickForm_element object
* @param $required bool Whether an element is required
* @param $error string Error associated with the element
*
* @return array
* @static
......@@ -164,14 +164,12 @@ class CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty {
if ($type == 'text') {
$size = $element->getAttribute('size');
if (!empty($size)) {
if (array_key_exists($size, self::$_sizeMapper)) {
$class .= ' ' . self::$_sizeMapper[$size];
}
$class = CRM_Utils_Array::value($size, self::$_sizeMapper);
}
}
}
$class .= ($class ? ' ' : '') . 'crm-form-' . $type;
$class = ($class ? "$class " : '') . 'crm-form-' . $type;
if ($required) {
$class .= ' required';
......@@ -216,7 +214,7 @@ class CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty {
*/
function addOptionsEditLink(&$el, $field) {
if (CRM_Core_Permission::check('administer CiviCRM')) {
$el['html'] .= ' &nbsp; <a href="#" class="crm-edit-optionvalue-link" title="' . ts('Edit Options') . '" data-option-group-url="' . $field->getAttribute('data-option-group-url') . '"><span class="batch-edit"></span></a>';
$el['html'] .= ' <a href="#" class="crm-edit-optionvalue-link crm-hover-button" title="' . ts('Edit Options') . '" data-option-group-url="' . $field->getAttribute('data-option-group-url') . '"><span class="icon edit-icon"></span></a>';
}
}
}
......
......@@ -2622,6 +2622,30 @@ div.grippie {
background-position: -32px -32px;
}
/* Icon hover-buttons */
.crm-container .crm-hover-button {
display: inline-block;
}
.crm-container .crm-hover-button:hover,
.crm-container .crm-hover-button:active {
background: #ccc;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(1, #ccc));
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #ccc 100%);
background-image: -moz-linear-gradient(center bottom, #eee 0%, #ccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#cccccc', endColorstr = '#eeeeee', GradientType = 0);
background-image: linear-gradient(top, #eee 0%, #ccc 100%);
border: 1px solid #AAAAAA;
border-radius: 4px;
}
.crm-container .crm-hover-button .icon {
margin-left: 3px;
margin-top: 2px;
vertical-align: middle;
}
.crm-container .crm-hover-button:hover .icon,
.crm-container .crm-hover-button:active .icon {
background-image: url("../i/icons/jquery-ui-2786C2.png");
}
/* accordion styles */
.crm-container .crm-accordion-header {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment