add button to show and hide metas (admin)

This commit is contained in:
Simon Vieille 2022-04-12 22:26:07 +02:00
parent ff1c4204fb
commit aa7a280ce0
Signed by: deblan
GPG key ID: 03383D15A1D31745
4 changed files with 55 additions and 0 deletions

View file

@ -101,6 +101,7 @@ class PageAdminController extends CrudController
->setForm('edit', Type::class, [])
->setForm('filter', FilterType::class)
->setView('form', '@Core/site/page_admin/_form.html.twig')
->setView('edit', '@Core/site/page_admin/edit.html.twig')
->setAction('index', 'new', false)
->setAction('index', 'show', false)

View file

@ -14,6 +14,7 @@ require('./modules/password.js')()
require('./modules/tooltip.js')()
require('./modules/tinymce.js')()
require('./modules/editorjs.js')()
require('./modules/grapesjs.js')()
require('./modules/panel.js')()
require('./modules/choices.js')()
require('./modules/checkbox-checker.js')()
@ -25,3 +26,4 @@ require('./modules/batch.js')()
require('./modules/file-manager.js')()
require('./modules/file-picker.js')()
require('./modules/analytics.js')()
require('./modules/page.js')()

View file

@ -0,0 +1,41 @@
const $ = require('jquery')
const doExpandCollapse = (stmt) => {
stmt = (stmt == 1)
const button = $('#page-form-expand')
const mainForm = $('#page-main-form')
const metasForm = $('#page-metas-form')
mainForm
.toggleClass('col-md-8', !stmt)
.toggleClass('col-md-12', stmt)
metasForm
.toggleClass('d-none', stmt)
button
.children()
.toggleClass('fa-expand-arrows-alt', !stmt)
.toggleClass('fa-compress-arrows-alt', stmt)
localStorage.setItem('pageFormExpandStmt', stmt ? 1 : null)
}
const initExpander = () => {
const button = $('#page-form-expand')
if (button.length) {
doExpandCollapse(localStorage.getItem('pageFormExpandStmt'))
button.click(() => {
doExpandCollapse(button.children().hasClass('fa-expand-arrows-alt'))
})
}
}
module.exports = () => {
$(() => {
initExpander()
})
}

View file

@ -0,0 +1,11 @@
{% extends '@Core/admin/crud/edit.html.twig' %}
{% block header %}
{{ parent() }}
<div class="float-right">
<button class="btn btn-sm btn-light mr-2 mt-2" id="page-form-expand">
<span class="fa fa-expand-arrows-alt"></span>
</button>
</div>
{% endblock %}