Merge pull request #6343 from JakubOnderka/after-attribute-edit

fix: [UI] Show properly formatted attribute value after quick edit
pull/6346/head
Jakub Onderka 2020-09-26 14:03:27 +02:00 committed by GitHub
commit 1f5c8fb409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

@ -1950,14 +1950,10 @@ class AttributesController extends AppController
throw new MethodNotAllowedException(__('This function can only be accessed via AJAX.'));
}
$params = array(
'conditions' => array('Attribute.id' => $id),
'fields' => array('id', 'distribution', 'event_id', $field),
'contain' => array(
'Event' => array(
'fields' => array('distribution', 'id', 'org_id'),
)
),
'flatten' => 1
'conditions' => array('Attribute.id' => $id),
'fields' => array('id', 'category', 'type', $field),
'contain' => ['Event'],
'flatten' => 1,
);
$attribute = $this->Attribute->fetchAttributes($this->Auth->user(), $params);
if (empty($attribute)) {
@ -1977,6 +1973,8 @@ class AttributesController extends AppController
}
}
$this->set('value', $result);
$this->set('object', $attribute);
$this->set('field', $field);
$this->layout = 'ajax';
$this->render('ajax/attributeViewFieldForm');
}

View File

@ -1,8 +1,12 @@
<?php
if ($value === 'No') {
echo '<input type="checkbox" disabled>';
} else if ($value === 'Yes') {
echo '<input type="checkbox" checked disabled>';
if ($field === 'value') {
echo $this->element('Events/View/value_field', ['object' => $object['Attribute']]);
} else {
echo nl2br(h($value)) . '&nbsp;';
if ($value === 'No') {
echo '<input type="checkbox" disabled>';
} else if ($value === 'Yes') {
echo '<input type="checkbox" checked disabled>';
} else {
echo nl2br(h($value)) . '&nbsp;';
}
}