formwork/admin/views/pages/editor.php
2018-10-13 13:46:06 +02:00

102 lines
7.5 KiB
PHP
Executable File

<div class="container-no-margin">
<div class="row">
<form action="<?= $this->uri('/pages/' . trim($page->slug(), '/') . '/edit/') ?>" method="post" data-form="page-editor-form">
<div class="col-l-3-4">
<div class="component">
<h3 class="caption"><?= $this->label('pages.content') ?></h3>
<input class="title-input" id="title" type="text" name="title" tabindex="1" value="<?= $this->escape($page->title()) ?>" required autocomplete="off">
<div class="page-info">
<div class="page-uri">
<a <?php if ($page->published() && $page->routable()): ?>href="<?= $this->pageUri($page) ?>"<?php endif; ?> target="_blank"><?= $page->slug() ?></a>
</div>
</div>
<div class="editor-toolbar" data-for="content">
<button class="toolbar-button" tabindex="-1" data-command="bold" title="<?= $this->label('pages.editor.bold') ?>" type="button"><span class="i-bold"></span></button>
<button class="toolbar-button" tabindex="-1" data-command="italic" title="<?= $this->label('pages.editor.italic') ?>" type="button"><span class="i-italic"></span></button>
<button class="toolbar-button" tabindex="-1" data-command="ul" title="<?= $this->label('pages.editor.bullet-list') ?>" type="button"><span class="i-list-ul"></span></button>
<button class="toolbar-button" tabindex="-1" data-command="ol" title="<?= $this->label('pages.editor.numbered-list') ?>" type="button"><span class="i-list-ol"></span></button>
<span class="spacer"></span>
<button class="toolbar-button" tabindex="-1" data-command="quote" title="<?= $this->label('pages.editor.quote') ?>" type="button"><span class="i-quote"></span></button>
<button class="toolbar-button" tabindex="-1" data-command="link" title="<?= $this->label('pages.editor.link') ?>" type="button"><span class="i-link"></span></button>
<button class="toolbar-button" tabindex="-1" data-command="image" title="<?= $this->label('pages.editor.image') ?>" type="button"><span class="i-image"></span></button>
<button class="toolbar-button" tabindex="-1" data-command="summary" title="<?= $this->label('pages.editor.summary') ?>" type="button"><span class="i-read-more"></span></button>
</div>
<textarea tabindex="2" class="editor-textarea" id="content" name="content" autocomplete="off"><?= $this->escape($page->rawContent()) ?></textarea>
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
<button class="button-accent button-right" type="submit" tabindex="4" data-command="save"><i class="i-check"></i> <?= $this->label('pages.save') ?></button>
<button class="button-link button-right" tabindex="-1" type="button" data-modal="deletePageModal" data-modal-action="<?= $this->uri('/pages/' . trim($page->slug(), '/') . '/delete/') ?>" title="<?= $this->label('pages.delete-page') ?>" <?php if (!$page->isDeletable()): ?> disabled<?php endif; ?>><i class="i-trash"></i></button>
<a class="button button-link button-right<?php if (!$page->published() || !$page->routable()): ?> disabled<?php endif; ?>" <?php if ($page->published() && $page->routable()): ?>href="<?= $this->pageUri($page) ?>"<?php endif; ?> target="_blank" title="<?= $this->label('pages.preview') ?>"><i class="i-eye"></i></a>
</div>
</div>
<div class="col-l-1-4">
<div class="component">
<h3 class="caption"><?= $this->label('pages.options') ?></h3>
<?= $fields ?>
</div>
<div class="component">
<h3 class="caption"><?= $this->label('pages.attributes') ?></h3>
<label for="page-parent"><?= $this->label('pages.parent') ?>:</label>
<select id="page-parent" name="parent">
<option value="." <?php if ($page->parent() === $this->site()): ?> selected<?php endif; ?>><?= $this->label('pages.new-page.site') ?> (/)</option>
<?php
foreach ($parents as $parent):
$scheme = $this->scheme($parent->template()->name());
if (!$scheme->get('pages', true)) continue;
if ($parent === $page) continue;
?>
<option value="<?= $parent->slug() ?>"<?php if ($page->parent() === $parent): ?> selected<?php endif; ?>><?= str_repeat('— ', $parent->level() - 1) . $parent->title() ?></option>
<?php
endforeach;
?>
</select>
<label for="page-template"><?= $this->label('pages.template') ?>:</label>
<select id="page-template" name="template">
<?php
foreach ($templates as $template):
$scheme = $this->scheme($template);
?>
<option value="<?= $template ?>"<?php if ($page->template()->name() === $template): ?> selected<?php endif; ?>><?= $scheme->title() ?></option>
<?php
endforeach;
?>
</select>
</div>
</div>
</form>
<div class="col-l-3-4">
<div class="component">
<h3 class="caption"><?= $this->label('pages.files') ?></h3>
<ul class="files-list">
<?php
foreach ($page->files() as $file):
?>
<li>
<div class="files-item">
<div class="files-item-cell file-name <?= is_null($file->type()) ? '' : 'file-type-' . $file->type() ?>" data-overflow-tooltip="true"><?= $file->name() ?> <span class="file-size">(<?= $file->size() ?>)</span></div>
<div class="files-item-cell file-actions">
<a class="button button-link" href="<?= $this->pageUri($page) . $file->name() ?>" target="_blank" title="<?= $this->label('pages.preview-file') ?>"><i class="i-eye"></i></a>
<button class="button-link" type="button" data-modal="deleteFileModal" data-modal-action="<?= $this->uri('/pages/' . trim($page->slug(), '/') . '/file/' . $file->name() . '/delete/') ?>" title="<?= $this->label('pages.delete-file') ?>">
<i class="i-trash"></i>
</button>
</div>
</div>
</li>
<?php
endforeach;
?>
</ul>
<form action="<?= $this->uri('/pages/' . trim($page->slug(), '/') . '/file/upload/') ?>" method="post" enctype="multipart/form-data">
<input class="file-input" id="file-uploader" type="file" name="uploaded-file" data-auto-upload="true" accept="<?= implode(', ', $this->option('files.allowed_extensions')) ?>">
<label for="file-uploader" class="file-input-label">
<span><?= $this->label('pages.files.upload-label') ?></span>
</label>
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
</form>
</div>
</div>
</div>
</div>
<script>
$('.date-input').datePicker(<?= json_encode($datePickerOptions) ?>);
</script>