chg: [templates] updated to support the new functionalities of localtools
parent
cc31a22527
commit
d84caa97c9
|
@ -66,8 +66,15 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
|||
[
|
||||
'url' => '/broods/view',
|
||||
'url_params_data_paths' => ['id'],
|
||||
'title' => __('View details'),
|
||||
'icon' => 'eye'
|
||||
],
|
||||
[
|
||||
'url' => '/localTools/broodTools',
|
||||
'url_params_data_paths' => ['id'],
|
||||
'title' => __('List available local tools'),
|
||||
'icon' => 'wrench'
|
||||
],
|
||||
[
|
||||
'open_modal' => '/broods/edit/[onclick_params_data_path]',
|
||||
'modal_params_data_path' => 'id',
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
echo $this->element('genericElements/Form/genericForm', $data);
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
echo $this->element('genericElements/IndexTable/index_table', $index_table);
|
||||
echo $this->element('genericElements/IndexTable/index_table', $data);
|
||||
echo '</div>';
|
||||
?>
|
||||
|
|
|
@ -81,11 +81,21 @@
|
|||
);
|
||||
|
||||
} else if (!empty($action['open_modal']) && !empty($action['modal_params_data_path'])) {
|
||||
if (is_array($action['modal_params_data_path'])) {
|
||||
foreach ($action['modal_params_data_path'] as $k => $v) {
|
||||
$modal_url = str_replace(
|
||||
sprintf('{{%s}}', $k),
|
||||
h(Cake\Utility\Hash::extract($row, $v)[0]),
|
||||
$action['open_modal']
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$modal_url = str_replace(
|
||||
'[onclick_params_data_path]',
|
||||
h(Cake\Utility\Hash::extract($row, $action['modal_params_data_path'])[0]),
|
||||
$action['open_modal']
|
||||
);
|
||||
}
|
||||
$reload_url = !empty($action['reload_url']) ? $action['reload_url'] : $this->Url->build(['action' => 'index']);
|
||||
$action['onclick'] = sprintf('UI.openModalFromURL(\'%s\', \'%s\', \'%s\')', $modal_url, $reload_url, $tableRandomValue);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
|
||||
if (!isset($arrayData) && isset($field['arrayData'])) {
|
||||
$arrayData = $field['arrayData'];
|
||||
}
|
||||
echo h($arrayData[$this->Hash->extract($row, $field['data_path'])[0]]);
|
||||
?>
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
'<i class="fa fa-%s"></i>',
|
||||
$data ? 'check' : 'times'
|
||||
);
|
||||
$data = '';
|
||||
} else {
|
||||
$data = h($data);
|
||||
if (!empty($field['privacy'])) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
if (isset($field['raw'])) {
|
||||
$string = $field['raw'];
|
||||
} else {
|
||||
$value = 1;
|
||||
$value = Cake\Utility\Hash::extract($data, $field['path']);
|
||||
$string = empty($value[0]) ? '' : $value[0];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
$randomId = Cake\Utility\Security::randomString(8);
|
||||
if (isset($field['raw'])) {
|
||||
$string = $field['raw'];
|
||||
} else {
|
||||
$value = Cake\Utility\Hash::extract($data, $field['path']);
|
||||
$string = empty($value[0]) ? '' : $value[0];
|
||||
}
|
||||
echo sprintf(
|
||||
'<div class="json_container_%s"></div>',
|
||||
h($randomId)
|
||||
);
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.json_container_<?php echo h($randomId);?>').html(syntaxHighlightJson(<?php echo json_encode($string); ?>, 4));
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue