1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-29 16:00:15 +02:00

Flextype Box Plugin: Admin #125 #117

- Templates Controller/Views implementation
This commit is contained in:
Awilum
2019-05-28 22:40:07 +03:00
parent 5ab32590b6
commit dceac6700f
4 changed files with 0 additions and 233 deletions

View File

@@ -1,47 +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', [
'templates' => [
'link' => Http::getBaseUrl() . '/admin/templates',
'title' => __('admin_templates'),
'attributes' => ['class' => 'navbar-item']
],
'templates_add' => [
'link' => Http::getBaseUrl() . '/admin/templates/add',
'title' => __('admin_create_new_template'),
'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()); ?>
<div class="form-group">
<?= Form::label('name', __('admin_name'), ['for' => 'templateName']) ?>
<?= Form::input('name', '', ['class' => 'form-control', 'id' => 'templateName', '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">
<?= Form::label('type', __('admin_type'), ['for' => 'templateType']) ?>
<?= Form::select('type', ['template' => __('admin_template'), 'partial' => __('admin_partial')], 'template', ['class' => 'form-control', 'id' => 'templateType']) ?>
</div>
</div>
</div>
<?= Form::submit('create_template', __('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() ?>

View File

@@ -1,50 +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', [
'template' => [
'link' => Http::getBaseUrl() . '/admin/templates/edit?template=' . Http::get('template') . '&type=' . $type,
'title' => __('admin_template'),
'attributes' => ['class' => 'navbar-item active']
]
])
->assign('buttons', [
'save_entry' => [
'link' => 'javascript:;',
'title' => __('admin_save'),
'attributes' => ['class' => 'js-save-form-submit float-right btn']
]
])
->display();
Themes::view('admin/views/partials/content-start')->display();
?>
<div class="row">
<div class="col-12">
<?= Form::open(null, ['id' => 'form']) ?>
<?= Form::hidden('token', Token::generate()) ?>
<?= Form::hidden('action', 'save-form') ?>
<?= Form::hidden('type', $type) ?>
<?= Form::hidden('name', Http::get('template')) ?>
<div class="row">
<div class="col-12">
<div class="form-group">
<?= Form::textarea('template', $template, ['class' => 'form-control', 'style' => 'min-height:500px;', 'id' => 'codeMirrorEditor']) ?>
</div>
</div>
</div>
<?= Form::close() ?>
</div>
</div>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -1,87 +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', [
'templates' => [
'link' => Http::getBaseUrl() . '/admin/templates',
'title' => __('admin_templates'),
'attributes' => ['class' => 'navbar-item active']
]
])
->assign('buttons', [
'entries' => [
'link' => Http::getBaseUrl() . '/admin/templates/add',
'title' => __('admin_create_new_template'),
'attributes' => ['class' => 'float-right btn']
]
])
->display()
?>
<?php Themes::view('admin/views/partials/content-start')->display() ?>
<?php if (count($templates_list) > 0 || count($partials_list) > 0): ?>
<table class="table no-margin">
<thead>
<tr>
<th><?= __('admin_name') ?></th>
<th><?= __('admin_type') ?></th>
<th></th>
</tr>
</thead>
<tbody>
<?php if (count($templates_list) > 0): ?>
<?php foreach ($templates_list as $template): ?>
<tr>
<td>
<a href="<?= Http::getBaseUrl() ?>/admin/templates/edit?template=<?= $template ?>"><?= $template ?></a>
</td>
<td><?= Text::lowercase(__('admin_template')) ?></td>
<td class="text-right">
<div class="btn-group">
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/templates/edit?template=<?= $template ?>"><?= __('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/templates/rename?template=<?= $template ?>"><?= __('admin_rename') ?></a>
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/templates/duplicate?template=<?= $template ?>&token=<?= Token::generate() ?>"><?= __('admin_duplicate') ?></a>
</div>
</div>
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/templates/delete?template=<?= $template ?>&token=<?= Token::generate() ?>"><?= __('admin_delete') ?></a>
</td>
</tr>
<?php endforeach ?>
<?php endif ?>
<?php if (count($partials_list) > 0): ?>
<?php foreach ($partials_list as $partial): ?>
<tr>
<td>
<a href="<?= Http::getBaseUrl() ?>/admin/templates/edit?template=<?= $partial ?>&type=partial"><?= $partial ?></a>
</td>
<td><?= Text::lowercase(__('admin_partial')) ?></td>
<td class="text-right">
<div class="btn-group">
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/templates/edit?template=<?= $partial ?>&type=partial"><?= __('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/templates/rename?template=<?= $partial ?>&type=partial"><?= __('admin_rename') ?></a>
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/templates/duplicate?template=<?= $partial ?>&type=partial&token=<?= Token::generate() ?>"><?= __('admin_duplicate') ?></a>
</div>
</div>
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/templates/delete?template=<?= $partial ?>&type=partial&token=<?= Token::generate() ?>"><?= __('admin_delete') ?></a>
</td>
</tr>
<?php endforeach ?>
<?php endif ?>
</tbody>
</table>
<?php else: ?>
<?php endif ?>
<?php Themes::view('admin/views/partials/content-end')->display() ?>
<?php Themes::view('admin/views/partials/footer')->display() ?>

View File

@@ -1,49 +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', [
'templates' => [
'link' => Http::getBaseUrl() . '/admin/templates',
'title' => __('admin_templates'),
'attributes' => ['class' => 'navbar-item']
],
'templates_add' => [
'link' => Http::getBaseUrl() . '/admin/templates/rename?template=' . $name_current,
'title' => __('admin_rename'),
'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('name_current', $name_current) ?>
<?= Form::hidden('type_current', $type) ?>
<div class="form-group">
<?= Form::label('name', __('admin_name'), ['for' => 'templateName']) ?>
<?= Form::input('name', $name_current, ['class' => 'form-control', 'id' => 'templateName', 'required', 'data-validation' => 'length required', 'data-validation-allowing' => '-_', 'data-validation-length' => 'min1', 'data-validation-error-msg' => __('admin_template_error_title_empty_input')]) ?>
</div>
<div class="form-group">
<?= Form::label('type', __('admin_type'), ['for' => 'templateType']) ?>
<?= Form::select('type', ['template' => __('admin_template'), 'partial' => __('admin_partial')], $type, ['class' => 'form-control', 'id' => 'templateType']) ?>
</div>
<?= Form::submit('rename_template', __('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() ?>