new: [eventview] value quickedit are triggered by clicking a button

And no longer using double-click
pull/3940/head
Sami Mokaddem 2018-12-12 14:45:18 +01:00
parent 260f75d8c3
commit e076239a0e
3 changed files with 59 additions and 7 deletions

View File

@ -99,13 +99,16 @@
<?php echo h($object['type']); ?>
</div>
</td>
<td id="Attribute_<?php echo h($object['id']); ?>_container" class="showspaces limitedWidth shortish">
<div id="Attribute_<?php echo $object['id']; ?>_value_placeholder" class="inline-field-placeholder"></div>
<?php
if ('attachment' !== $object['type'] && 'malware-sample' !== $object['type']) $editable = ' ondblclick="activateField(\'' . $editScope . '\', \'' . $object['id'] . '\', \'value\', \'' . $event['Event']['id'] . '\');"';
else $editable = '';
?>
<div id = "Attribute_<?php echo $object['id']; ?>_value_solid" class="inline-field-solid" <?php echo $editable; ?>>
<?php
if ('attachment' !== $object['type'] && 'malware-sample' !== $object['type']):
$editable = ' onmouseenter="quickEditHover(this, \'' . $editScope . '\', \'' . $object['id'] . '\', \'value\', \'' . $event['Event']['id'] . '\' );"';
else:
$editable = '';
endif;
?>
<td id="Attribute_<?php echo h($object['id']); ?>_container" class="showspaces limitedWidth shortish" <?php echo $editable; ?>>
<div id="Attribute_<?php echo $object['id']; ?>_value_placeholder" class="inline-field-placeholder"></div>
<div id = "Attribute_<?php echo $object['id']; ?>_value_solid" class="inline-field-solid">
<span>
<?php
$spanExtra = '';

View File

@ -2078,6 +2078,35 @@ table tr:hover .down-expand-button {
}
}
.label-icon {
left: 5px;
position: relative;
}
.fa-as-icon {
font-size: 20px;
padding-left: 2px;
padding-top: 2px;
width: 18px;
height: 20px;
cursor: pointer;
background-image: unset;
text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
transition: background .2s linear;
color: black;
}
.fa-as-icon:hover {
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
font-weight: 900;
font-size: 22px;
color: white;
}
.quick-edit-row-div {
display: inline-block;
position: relative;
}
#attackmatrix_div {
border-color: #363636;
overflow: visible;

View File

@ -453,6 +453,26 @@ function postActivationScripts(name, type, id, field, event) {
$(name + '_solid').hide();
}
function quickEditHover(td, type, id, field, event) {
$td = $(td);
$td.find('#quickEditButton').remove(); // clean all similar if exist
$div = $('<div id="quickEditButton"></div>');
$div.addClass('quick-edit-row-div');
$span = $('<span></span>');
$span.addClass('fa-as-icon fa fa-edit');
$span.css('font-size', '12px');
$div.append($span);
$td.find("[id*=value_solid]").append($div);
$span.click(function() {
activateField(type, id, field, event);
});
$td.off('mouseleave').on('mouseleave', function(e) {
$div.remove();
});
}
function addSighting(type, attribute_id, event_id, page) {
$('#Sighting_' + attribute_id + '_type').val(type);
$.ajax({