forked from fa/breadcrumb-the-shire
Replace inconsistent `primary` class with `app-action-success` on all standalone save buttons so they match the green titlebar convention. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
121 lines
5.3 KiB
PHTML
121 lines
5.3 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var array|null $page
|
|
* @var bool $canEdit
|
|
* @var bool $editMode
|
|
* @var string $contentJson
|
|
* @var string $slug
|
|
*/
|
|
|
|
?>
|
|
<div class="app-details-container app-page">
|
|
<section>
|
|
<?php if (!$page): ?>
|
|
<p><?php e(t('Page not found')); ?></p>
|
|
<?php else: ?>
|
|
<form method="post" action="<?php e($formAction ?? ''); ?>" class="page-editor" id="page-editor" data-page-editor
|
|
data-can-edit="<?php e($canEdit ? '1' : '0'); ?>" data-edit-mode="<?php e($editMode ? 'edit' : 'view'); ?>"
|
|
data-placeholder="<?php e(t('Start writing...')); ?>" data-header-placeholder="<?php e(t('Heading')); ?>">
|
|
<?php MintyPHP\Session::getCsrfInput(); ?>
|
|
<input type="hidden" name="return" value="<?php e($returnPath ?? ''); ?>">
|
|
<textarea name="content" id="page-content" hidden><?php e($contentJson); ?></textarea>
|
|
<div data-editor-holder></div>
|
|
</form>
|
|
<?php if (file_exists('web/vendor/editorjs/tools/header.umd.js')): ?>
|
|
<script src="<?php e(assetVersion('vendor/editorjs/tools/header.umd.js')); ?>"></script>
|
|
<?php endif; ?>
|
|
<?php if (file_exists('web/vendor/editorjs/tools/list.umd.js')): ?>
|
|
<script src="<?php e(assetVersion('vendor/editorjs/tools/list.umd.js')); ?>"></script>
|
|
<?php endif; ?>
|
|
<?php if (file_exists('web/vendor/editorjs/tools/checklist.umd.js')): ?>
|
|
<script src="<?php e(assetVersion('vendor/editorjs/tools/checklist.umd.js')); ?>"></script>
|
|
<?php endif; ?>
|
|
<?php if (file_exists('web/vendor/editorjs/tools/table.umd.js')): ?>
|
|
<script src="<?php e(assetVersion('vendor/editorjs/tools/table.umd.js')); ?>"></script>
|
|
<?php endif; ?>
|
|
<?php if (file_exists('web/vendor/editorjs/tools/columns.js')): ?>
|
|
<script src="<?php e(assetVersion('vendor/editorjs/tools/columns.js')); ?>"></script>
|
|
<?php endif; ?>
|
|
<?php if (file_exists('web/vendor/editorjs/tools/marker.umd.js')): ?>
|
|
<script src="<?php e(assetVersion('vendor/editorjs/tools/marker.umd.js')); ?>"></script>
|
|
<?php endif; ?>
|
|
<script type="application/json" id="page-config-page-editor"><?php gridJsonForJs([
|
|
'selector' => '[data-page-editor]',
|
|
'holderSelector' => '[data-editor-holder]',
|
|
'contentFieldSelector' => '#page-content',
|
|
'toggleSelector' => '[data-editor-toggle]',
|
|
'saveSelector' => '[data-editor-save]',
|
|
]); ?></script>
|
|
<script type="module" src="<?php e(assetVersion('js/pages/app-page-editor-entry.js')); ?>"></script>
|
|
<?php endif; ?>
|
|
</section>
|
|
<?php if ($canEdit): ?>
|
|
<aside id="app-details-aside-section">
|
|
<div class="app-details-aside-section app-page-action-card">
|
|
|
|
<div class="grid">
|
|
<button type="button" class="secondary outline" data-tooltip-pos="top"
|
|
data-tooltip="<?php e($editMode ? t('View') : t('Edit')); ?>" data-editor-toggle
|
|
data-edit-label="<?php e(t('Edit')); ?>" data-view-label="<?php e(t('View')); ?>">
|
|
<?php if ($editMode): ?>
|
|
<i class="bi bi-eye-fill" data-editor-icon aria-hidden="true"></i>
|
|
<?php else: ?>
|
|
<i class="bi bi-pencil-square" data-editor-icon aria-hidden="true"></i>
|
|
<?php endif; ?>
|
|
</button>
|
|
<button type="submit" form="page-editor" class="app-action-success" data-editor-save>
|
|
<?php e(t('Save')); ?>
|
|
</button>
|
|
</div>
|
|
|
|
<?php if (isset($locales, $currentLocale) && is_array($locales) && count($locales) > 1): ?>
|
|
<hr>
|
|
<details>
|
|
<summary><?php e(t('Copy')); ?></summary>
|
|
<hr>
|
|
<form method="post" action="page/copy-language" class="app-page-copy">
|
|
<?php MintyPHP\Session::getCsrfInput(); ?>
|
|
<input type="hidden" name="slug" value="<?php e($slug ?? ''); ?>">
|
|
<input type="hidden" name="from_locale" value="<?php e($currentLocale); ?>">
|
|
<input type="hidden" name="return" value="<?php e($returnPath ?? ''); ?>">
|
|
<label class="app-field">
|
|
<span>
|
|
<?php e(t('Copy content to')); ?>
|
|
</span>
|
|
<div role="group">
|
|
<select name="to_locale" required>
|
|
<?php foreach ($locales as $locale): ?>
|
|
<?php if ($locale === $currentLocale) {
|
|
continue;
|
|
} ?>
|
|
<option value="<?php e($locale); ?>">
|
|
<?php
|
|
$label = strtoupper($locale);
|
|
if ($locale === 'de') {
|
|
$label = t('German');
|
|
} elseif ($locale === 'en') {
|
|
$label = t('English');
|
|
}
|
|
e($label);
|
|
?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<button type="submit" class="secondary outline">
|
|
<?php e(t('Copy')); ?>
|
|
</button>
|
|
</div>
|
|
</label>
|
|
</form>
|
|
<small>
|
|
<?php e(t('Existing content in the target language will be overwritten')); ?>
|
|
</small>
|
|
</details>
|
|
<hr>
|
|
<?php endif; ?>
|
|
</div>
|
|
</aside>
|
|
<?php endif; ?>
|
|
</div>
|