mirror of https://github.com/MISP/MISP
Merge pull request #6343 from JakubOnderka/after-attribute-edit
fix: [UI] Show properly formatted attribute value after quick editpull/6346/head
commit
1f5c8fb409
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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)) . ' ';
|
||||
if ($value === 'No') {
|
||||
echo '<input type="checkbox" disabled>';
|
||||
} else if ($value === 'Yes') {
|
||||
echo '<input type="checkbox" checked disabled>';
|
||||
} else {
|
||||
echo nl2br(h($value)) . ' ';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue