add button to show and hide metas (admin)
This commit is contained in:
parent
ff1c4204fb
commit
aa7a280ce0
|
@ -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)
|
||||
|
|
|
@ -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')()
|
||||
|
|
41
src/core/Resources/assets/js/modules/page.js
Normal file
41
src/core/Resources/assets/js/modules/page.js
Normal 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()
|
||||
})
|
||||
}
|
11
src/core/Resources/views/site/page_admin/edit.html.twig
Normal file
11
src/core/Resources/views/site/page_admin/edit.html.twig
Normal 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 %}
|
Loading…
Reference in a new issue