mirror of
https://github.com/flextype/flextype.git
synced 2025-08-27 06:54:31 +02:00
- Fieldsets Controller/Views implementation
This commit is contained in:
@@ -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', [
|
||||
'fieldsets' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/fieldsets',
|
||||
'title' => __('admin_fieldsets'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'fieldsets_add' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/fieldsets/add',
|
||||
'title' => __('admin_create_new_fieldset'),
|
||||
'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('title', __('admin_title'), ['for' => 'fieldsetTitle']) ?>
|
||||
<?= Form::input('title', '', ['class' => 'form-control', 'id' => 'fieldsetTitle', 'required', 'data-validation' => 'length required', 'data-validation-allowing' => '-_', 'data-validation-length' => 'min1', 'data-validation-error-msg' => __('admin_error_title_empty_input')]) ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?= Form::label('name', __('admin_name'), ['for' => 'fieldsetName']) ?>
|
||||
<?= Form::input('name', '', ['class' => 'form-control', 'id' => 'fieldsetName', 'required', 'data-validation' => 'length required', 'data-validation-allowing' => '-_', 'data-validation-length' => 'min1', 'data-validation-error-msg' => __('admin_error_name_empty_input')]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?= Form::submit('create_fieldset', __('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() ?>
|
@@ -0,0 +1,23 @@
|
||||
{% extends "plugins/admin/views/partials/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" id="form">
|
||||
{{ csrf() }}
|
||||
<input type="hidden" id="fieldset-id-current-{{ id }}" name="fieldset-id-current" value="{{ id }}">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="title">{{ tr('admin_title') }}</label>
|
||||
<input type="text" id="fieldsetTitle" name="title" value="" class="form-control" required="required" data-validation="length required" data-validation-length="min1" data-validation-error-msg="{{ tr('admin_error_title_empty_input') }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="id">{{ tr('admin_name') }}</label>
|
||||
<input type="text" id="fieldsetId" name="id" value="" class="form-control" required="required" data-validation="length required" data-validation-length="min1" data-validation-error-msg="{{ tr('admin_error_name_empty_input') }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" id="createFieldset" name="create_fieldset" value="{{ tr('admin_create') }}" class="btn btn-black">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
@@ -1,60 +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', [
|
||||
'fieldsets' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/fieldsets',
|
||||
'title' => __('admin_fieldsets'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
])
|
||||
->assign('buttons', [
|
||||
'entries' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/fieldsets/add',
|
||||
'title' => __('admin_create_new_fieldset'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
]
|
||||
])
|
||||
->display()
|
||||
?>
|
||||
<?php Themes::view('admin/views/partials/content-start')->display() ?>
|
||||
|
||||
<?php if (count($fieldsets_list) > 0): ?>
|
||||
<table class="table no-margin">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= __('admin_name') ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($fieldsets_list as $name => $fieldset): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?= Http::getBaseUrl() ?>/admin/fieldsets/edit?fieldset=<?= $name ?>"><?= $fieldset ?></a>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/fieldsets/edit?fieldset=<?= $name ?>"><?= __('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/fieldsets/rename?fieldset=<?= $name ?>"><?= __('admin_rename') ?></a>
|
||||
<a class="dropdown-item" href="<?= Http::getBaseUrl() ?>/admin/fieldsets/duplicate?fieldset=<?= $name ?>&token=<?= Token::generate() ?>"><?= __('admin_duplicate') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-default" href="<?= Http::getBaseUrl() ?>/admin/fieldsets/delete?fieldset=<?= $name ?>&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() ?>
|
@@ -1,44 +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', [
|
||||
'fieldsets' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/fieldsets',
|
||||
'title' => __('admin_fieldsets'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'fieldsets_add' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/fieldsets/rename?fieldset=' . $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) ?>
|
||||
<div class="form-group">
|
||||
<?= Form::label('name', __('admin_name'), ['for' => 'fieldsetName']) ?>
|
||||
<?= Form::input('name', $name_current, ['class' => 'form-control', 'id' => 'fieldsetName', '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_fieldset', __('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