mirror of
https://github.com/flextype/flextype.git
synced 2025-08-13 08:34:19 +02:00
- Entries Controller/Views implementation
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
namespace Flextype;
|
||||
|
||||
use Flextype\Component\Registry\Registry;
|
||||
use Flextype\Component\Http\Http;
|
||||
use Flextype\Component\Form\Form;
|
||||
use Flextype\Component\Html\Html;
|
||||
use Flextype\Component\Token\Token;
|
||||
use function Flextype\Component\I18n\__;
|
||||
|
||||
Themes::view('admin/views/partials/head')->display();
|
||||
Themes::view('admin/views/partials/navbar')
|
||||
->assign('links', [
|
||||
'entries' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries',
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_add' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries/add?entry=' . Http::get('entry'),
|
||||
'title' => __('admin_create_new_entry'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
])
|
||||
->display();
|
||||
Themes::view('admin/views/partials/content-start')->display();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?= Form::open() ?>
|
||||
<?= Form::hidden('token', Token::generate()) ?>
|
||||
<?= Form::hidden('parent_entry', Http::get('entry')) ?>
|
||||
<div class="form-group">
|
||||
<?= Form::label('title', __('admin_title'), ['for' => 'entryTitle']) ?>
|
||||
<?= Form::input('title', '', ['class' => 'form-control', 'id' => 'entryTitle', 'required', 'data-validation' => 'length required', 'data-validation-length' => 'min1', 'data-validation-error-msg' => __('admin_error_title_empty_input')]) ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?= Form::label('slug', __('admin_name'), ['for' => 'entrySlug']) ?>
|
||||
<?= Form::input('slug', '', ['class' => 'form-control', 'id' => 'entrySlug', 'required', 'data-validation' => 'length required', 'data-validation-allowing' => '-_', 'data-validation-length' => 'min1', 'data-validation-error-msg' => __('admin_error_name_empty_input')]) ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><?= __('admin_type') ?></label>
|
||||
<select class="form-control" name="fieldset">
|
||||
<?php foreach ($fieldsets as $key => $fieldset): ?>
|
||||
<option value="<?= $key ?>"><?= $fieldset ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= Form::submit('create_entry', __('admin_create'), ['class' => 'btn btn-black']) ?>
|
||||
<?= Form::close() ?>
|
||||
|
||||
<?php Themes::view('admin/views/partials/content-end')->display() ?>
|
||||
<?php Themes::view('admin/views/partials/footer')->display() ?>
|
@@ -43,14 +43,14 @@
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="{{ path_for('admin.entries.add') }}?entry={{ entry.slug }}">{{ tr('admin_add') }}</a>
|
||||
<a class="dropdown-item" href="{{ path_for('admin.entries.duplicate') }}?entry={{ entry.slug }}">{{ tr('admin_duplicate') }}</a>
|
||||
<a class="dropdown-item" href="{{ path_for('admin.entries.duplicateProcess') }}?entry={{ entry.slug }}">{{ tr('admin_duplicate') }}</a>
|
||||
<a class="dropdown-item" href="{{ path_for('admin.entries.rename') }}?entry={{ entry.slug }}">{{ tr('admin_rename') }}</a>
|
||||
<a class="dropdown-item" href="{{ path_for('admin.entries.move') }}?entry={{ entry.slug }}">{{ tr('admin_move') }}</a>
|
||||
<a class="dropdown-item" href="{{ base_url() }}/{{ entry.slug }}" target="_blank">{{ tr('admin_preview') }}</a>
|
||||
<a class="dropdown-item" href="{{ path_for('admin.entries.type') }}?entry={{ entry.slug }}">{{ tr('admin_type') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/entries/delete?entry=<?= $entry['slug'] ?>&entry_current=<?= Http::get('entry') ?>&token=<?= Token::generate() ?>">{{ tr('admin_delete') }}</a>
|
||||
<a class="btn btn-default" href="{{ path_for('admin.entries.deleteProcess') }}?entry={{ entry.slug }}&entry_current={{ entry_current }}">{{ tr('admin_delete') }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@@ -1,83 +0,0 @@
|
||||
<?php namespace Flextype ?>
|
||||
<?php use Flextype\Component\{Http\Http, Registry\Registry, Filesystem\Filesystem, Token\Token, Text\Text} ?>
|
||||
<?php use function Flextype\Component\I18n\__; ?>
|
||||
<?php Themes::view('admin/views/partials/head')->display() ?>
|
||||
<?php Themes::view('admin/views/partials/navbar')
|
||||
->assign('links', [
|
||||
'entries' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries',
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
])
|
||||
->assign('buttons', [
|
||||
'entries' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries/add?entry=' . Http::get('entry'),
|
||||
'title' => __('admin_create_new_entry'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
]
|
||||
])
|
||||
->display()
|
||||
?>
|
||||
<?php Themes::view('admin/views/partials/content-start')->display() ?>
|
||||
|
||||
<?php if (count($entries_list) > 0): ?>
|
||||
<table class="table no-margin">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= __('admin_entry') ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($entries_list as $entry): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php $count = count(Entries::fetchAll($entry['slug'], 'slug', 'ASC')) ?>
|
||||
<a href="<?php if ($count > 0): ?><?= Http::getBaseUrl() ?>/admin/entries/?entry=<?= $entry['slug'] ?><?php else: ?><?= Http::getBaseUrl() ?>/admin/entries/edit?entry=<?= $entry['slug'] ?><?php endif ?>">
|
||||
<?php if (isset($entry['fieldset'])): ?>
|
||||
<?php if (Filesystem::has(PATH['themes'] . '/' . Registry::get('settings.theme') . '/fieldsets/' . $entry['fieldset'] . '.yaml')): ?>
|
||||
<?php $fieldset = YamlParser::decode(Filesystem::read(PATH['themes'] . '/' . Registry::get('settings.theme') . '/fieldsets/' . $entry['fieldset'] . '.yaml')) ?>
|
||||
<?php if (isset($fieldset['default_field'])): ?>
|
||||
<?= $entry[$fieldset['default_field']] ?>
|
||||
<?php else: ?>
|
||||
<?= $entry['slug'] ?>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<?= $entry['slug'] ?>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<?= $entry['slug'] ?>
|
||||
<?php endif ?>
|
||||
</a>
|
||||
<?php if ($count > 0): ?>
|
||||
(<?= $count ?>)
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/entries/edit?entry=<?= $entry['slug'] ?>"><?= __('admin_edit') ?></a>
|
||||
<button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/entries/add?entry=<?= $entry['slug'] ?>"><?= __('admin_add') ?></a>
|
||||
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/entries/duplicate?entry=<?= $entry['slug'] ?>&token=<?= Token::generate() ?>"><?= __('admin_duplicate') ?></a>
|
||||
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/entries/rename?entry=<?= $entry['slug'] ?>"><?= __('admin_rename') ?></a>
|
||||
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/entries/move?entry=<?= $entry['slug'] ?>"><?= __('admin_move') ?></a>
|
||||
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/<?= $entry['slug'] ?>" target="_blank"><?= __('admin_preview') ?></a>
|
||||
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/entries/type?entry=<?= $entry['slug'] ?>"><?= __('admin_type') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/entries/delete?entry=<?= $entry['slug'] ?>&entry_current=<?= Http::get('entry') ?>&token=<?= Token::generate() ?>"><?= __('admin_delete') ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
<?php Themes::view('admin/views/partials/content-end')->display() ?>
|
||||
<?php Themes::view('admin/views/partials/footer')->display() ?>
|
@@ -11,7 +11,7 @@
|
||||
<input type="hidden" name="name_current" value="{{name_current}}">
|
||||
<div class="form-group">
|
||||
<label for="title">{{ tr('admin_parent_entry') }}</label>
|
||||
<select class="form-control" name="fieldset">
|
||||
<select class="form-control" name="parent_entry">
|
||||
{% for key, value in entries_list %}
|
||||
<option value="{{ key }}" {% if key == entry_parent %}selected{% endif %}>{{ value }}</option>
|
||||
{% endfor %}
|
||||
|
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
namespace Flextype;
|
||||
use Flextype\Component\{Registry\Registry, Http\Http, Form\Form, Token\Token};
|
||||
use function Flextype\Component\I18n\__;
|
||||
?>
|
||||
|
||||
<?php
|
||||
Themes::view('admin/views/partials/head')->display();
|
||||
Themes::view('admin/views/partials/navbar')
|
||||
->assign('links', [
|
||||
'entries' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries',
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_move' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries/move',
|
||||
'title' => __('admin_move'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
])
|
||||
->assign('entry', $entry)
|
||||
->display();
|
||||
Themes::view('admin/views/partials/content-start')->display();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?= Form::open() ?>
|
||||
<?= Form::hidden('token', Token::generate()) ?>
|
||||
<?= Form::hidden('entry_path_current', $entry_path_current) ?>
|
||||
<?= Form::hidden('entry_parent_current', $entry_parent) ?>
|
||||
<?= Form::hidden('name_current', $name_current) ?>
|
||||
<div class="form-group">
|
||||
<?= Form::label('parent_entry', __('admin_parent_entry')) ?>
|
||||
<?= Form::select('parent_entry', $entries_list, $entry_parent, array('class' => 'form-control')) ?>
|
||||
</div>
|
||||
<?= Form::submit('move_entry', __('admin_save'), ['class' => 'btn btn-black btn-fill btn-wd']) ?>
|
||||
<?= Form::close() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php Themes::view('admin/views/partials/content-end')->display() ?>
|
||||
<?php Themes::view('admin/views/partials/footer')->display() ?>
|
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
namespace Flextype;
|
||||
|
||||
use Flextype\Component\Registry\Registry;
|
||||
use Flextype\Component\Http\Http;
|
||||
use Flextype\Component\Form\Form;
|
||||
use Flextype\Component\Token\Token;
|
||||
use function Flextype\Component\I18n\__;
|
||||
|
||||
Themes::view('admin/views/partials/head')->display();
|
||||
Themes::view('admin/views/partials/navbar')
|
||||
->assign('links', [
|
||||
'entries' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries',
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_add' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries/rename',
|
||||
'title' => __('admin_rename'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
])
|
||||
->assign('entry', $entry)
|
||||
->display();
|
||||
Themes::view('admin/views/partials/content-start')->display();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?= Form::open() ?>
|
||||
<?= Form::hidden('token', Token::generate()) ?>
|
||||
<?= Form::hidden('entry_path_current', $entry_path_current) ?>
|
||||
<?= Form::hidden('entry_parent', $entry_parent) ?>
|
||||
<?= Form::hidden('name_current', $name_current) ?>
|
||||
<div class="form-group">
|
||||
<?= Form::label('name', __('admin_name'), ['for' => 'entryName']) ?>
|
||||
<?= Form::input('name', $name_current, ['class' => 'form-control', 'id' => 'entryName', 'required', 'data-validation' => 'length required', 'data-validation-allowing' => '-_', 'data-validation-length' => 'min1', 'data-validation-error-msg' => __('admin_error_title_empty_input')]) ?>
|
||||
</div>
|
||||
<?= Form::submit('rename_entry', __('admin_save'), ['class' => 'btn btn-black btn-fill btn-wd']) ?>
|
||||
<?= Form::close() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php Themes::view('admin/views/partials/content-end')->display() ?>
|
||||
<?php Themes::view('admin/views/partials/footer')->display() ?>
|
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
namespace Flextype;
|
||||
use Flextype\Component\{Registry\Registry, Http\Http, Form\Form, Token\Token};
|
||||
use function Flextype\Component\I18n\__;
|
||||
?>
|
||||
|
||||
<?php
|
||||
Themes::view('admin/views/partials/head')->display();
|
||||
Themes::view('admin/views/partials/navbar')
|
||||
->assign('links', [
|
||||
'entries' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries',
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_move' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries/move',
|
||||
'title' => __('admin_type'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
])
|
||||
->assign('entry', Http::get('entry'))
|
||||
->display();
|
||||
Themes::view('admin/views/partials/content-start')->display();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?= Form::open() ?>
|
||||
<?= Form::hidden('token', Token::generate()) ?>
|
||||
<?= Form::hidden('entry', Http::get('entry')) ?>
|
||||
<div class="form-group">
|
||||
<?= Form::label('fieldset', __('admin_type')) ?>
|
||||
<?= Form::select('fieldset', $fieldsets, $fieldset, ['class' => 'form-control']) ?>
|
||||
</div>
|
||||
<?= Form::submit('type_entry', __('admin_save'), ['class' => 'btn btn-black btn-fill btn-wd']) ?>
|
||||
<?= Form::close() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php Themes::view('admin/views/partials/content-end')->display() ?>
|
||||
<?php Themes::view('admin/views/partials/footer')->display() ?>
|
Reference in New Issue
Block a user