1
0
Fork 0
mirror of synced 2024-05-18 19:52:39 +12:00
appwrite/app/views/console/database/rules/array.phtml

57 lines
2.6 KiB
PHTML
Raw Normal View History

2020-04-21 06:47:26 +12:00
<?php
$key = $this->getParam('key', '');
$type = $this->getParam('type', '');
2020-04-21 06:47:26 +12:00
$required = $this->getParam('required', '');
$comp = $this->getParam('comp', '');
$namespace = $this->getParam('namespace', '');
$list = $this->getParam('list', []);
2020-04-28 06:37:42 +12:00
$collections = $this->getParam('collections', []);
2020-04-21 06:47:26 +12:00
$comp->setParam('namespace', 'node');
if($type === 'document') {
$comp->setParam('key', null);
}
2020-04-21 06:47:26 +12:00
?>
<input type="hidden" name="<?php echo $this->escape($key); ?>"<?php if($required): ?> required<?php endif; ?> data-cast-to="array-empty">
2020-04-28 06:37:42 +12:00
<hr />
2020-04-29 20:36:55 +12:00
<ul data-ls-loop="<?php echo $this->escape($namespace); ?>" data-ls-as="node" class="sortable numbers">
2020-04-28 06:37:42 +12:00
<li data-forms-move-up data-forms-move-down>
<div class="drop-list bottom end settings" data-ls-ui-open="" data-button-text="" data-button-icon="icon-cog" data-button-aria="Options" data-button-selector="[data-toggler]" data-button-class="round dark small margin-bottom-small margin-top-tiny pull-end" data-blur="1">
2020-05-01 04:34:51 +12:00
<ul class="arrow-end margin-top margin-end-negative-small">
<li data-move-up>
<button type="button" class="link"><i class="icon-up-dir"></i> Move Up</button>
</li>
<li data-move-down>
<button type="button" class="link"><i class="icon-down-dir"></i> Move Down</button>
</li>
<li>
2020-10-30 09:11:16 +13:00
<button type="button" data-ls-ui-trigger="splice-<?php echo $this->escape($namespace); ?>-{{$index}}" class="link"><i class="icon-cancel"></i> Remove</button>
2020-05-01 04:34:51 +12:00
</li>
</ul>
2020-04-21 06:47:26 +12:00
</div>
2020-05-01 04:34:51 +12:00
<?php echo $comp->render(); ?>
2020-05-01 18:28:39 +12:00
<hr />
2020-04-21 06:47:26 +12:00
</li>
</ul>
2020-04-28 06:37:42 +12:00
<?php if(!empty($list) && $type === 'document'): ?>
<div class="drop-list" data-ls-ui-open="" data-button-text="Add" data-button-aria="Add" data-button-icon="" data-button-selector="[data-toggler]" data-button-class="reverse margin-bottom-small" data-blur="1">
2020-04-28 06:37:42 +12:00
<ul>
<?php foreach($list as $item):
2020-05-03 21:49:22 +12:00
$name = (isset($collections[$item])) ? $collections[$item]->getAttribute('name', '') : '';
2020-04-28 06:37:42 +12:00
?>
<li>
<button type="button" class="link" data-ls-ui-trigger="collection-child-<?php echo $this->escape($namespace); ?>-<?php echo $this->escape($item); ?>"><i class="icon-edit"></i> Add <?php echo $this->escape($name); ?></button>
</li>
<?php endforeach; ?>
</ul>
</div>
2020-04-29 20:36:55 +12:00
<?php else: ?>
2020-05-03 09:16:34 +12:00
<button type="button" data-ls-ui-trigger="collection-child-<?php echo $this->escape($namespace); ?>" class="reverse margin-bottom-small">Add</button>
2020-04-29 20:36:55 +12:00
<?php endif; ?>