diff --git a/assets/app.js b/assets/app.js index 71efa05..95ba467 100644 --- a/assets/app.js +++ b/assets/app.js @@ -44,6 +44,8 @@ if (location.pathname.includes('login')) { if (! location.pathname.includes('login')) { const vocabs = document.querySelector('#vocabs'); + const userMenu = document.querySelector('.dropdown-trigger'); + document.querySelector('#for-vocabs').addEventListener('click', function () { vocabs.classList.toggle('is-hidden'); @@ -55,4 +57,8 @@ if (! location.pathname.includes('login')) { this.firstElementChild.classList.add('fa-angle-right'); } }); + + userMenu.addEventListener('click', function () { + document.querySelector('.dropdown').classList.toggle('is-active'); + }); } \ No newline at end of file diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 877eb25..4b88a05 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -1,7 +1,7 @@ # see https://symfony.com/doc/current/reference/configuration/framework.html framework: secret: '%env(APP_SECRET)%' - #csrf_protection: true + csrf_protection: true # Note that the session will be started ONLY if you read or write from it. session: true @@ -12,5 +12,8 @@ framework: when@test: framework: test: true + form: + csrf_protection: + enabled: true session: storage_factory_id: session.storage.factory.mock_file diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 43632b6..c0b46ab 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -19,6 +19,9 @@ security: login_path: app_login check_path: app_login enable_csrf: true + logout: + path: /logout + target: app_login lazy: true provider: app_user_provider diff --git a/templates/base.html.twig b/templates/base.html.twig index ee542bf..c397cb3 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -14,7 +14,7 @@ <body> {% block body %}{% endblock %} </body> - <footer class="footer"> + <footer class="footer pb-5"> <div class="content has-text-centered"> <p><strong><a href="/about">About</a></strong></p> <p><strong><a href="/credits">Credits</a> </strong></p> @@ -23,5 +23,5 @@ <a href="https://ispc.cnr.it">CNR-ISPC</a> - <a href="http://www.studilefili.unimi.it/ecm/home">UniMi</a> </p> </div> - </footer> + </footer> </html> diff --git a/templates/data_entry.html.twig b/templates/data_entry.html.twig new file mode 100644 index 0000000..73af565 --- /dev/null +++ b/templates/data_entry.html.twig @@ -0,0 +1,213 @@ +{% extends 'base.html.twig' %} + +{% block body %} + +<nav class="navbar has-background-light"> + <div class="navbar-start"> + <a href="/" class="navbar-item"> + <strong>ArCOA Data Entry</strong> + </a> + </div> + {% if app.user %} + <div class="navbar-end"> + <div class="navbar-item"> + <div class="buttons dropdown is-right"> + <div class="dropdown-trigger"> + <a class="button is-primary"> + <span class="icon"> + <i class="fa fa-user-circle"></i> + </span> + <span class="pl-3"> + {{ app.user.firstname }} {{ app.user.lastname }} + </span> + </a> + </div> + <div class="dropdown-menu" role="menu"> + <div class="dropdown-content"> + <a href="/profile" class="dropdown-item"> + <span class="icon is-small"> + <i class="fa fa-user"></i> + </span> + <span class="pl-2">Profile</span> + </a> + {% if 'ROLE_ADMIN' in app.user.roles %} + <a href="/admin" class="dropdown-item"> + <span class="icon is-small"> + <i class="fa fa-cogs"></i> + </span> + <span class="pl-2">Admin</span> + </a> + {% endif %} + <hr class="dropdown-divider" /> + <a href="/logout" class="button is-link is-fullwidth"> + <span class="icon is-small"> + <i class="fa fa-sign-out"></i> + </span> + <span class="has-text-centered"> Logout</span> + </a> + </div> + </div> + </div> + </div> + {% endif %} +</nav> +<div class="columns mb-0"> + <div class="column is-one-fifth arcoa-menu mb-0"> + <aside class="menu pl-4"> + <p class="menu-label has-text-white mt-3 pt-5 pl-5 is-size-6"> + Vocabularies + <span class="icon is-clickable pl-4" id="for-vocabs"> + <i class="fa fa-angle-right"></i> + </span> + </p> + <ul class="pl-6 is-hidden has-text-white" id="vocabs"> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Access rights + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Civilization + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Copyright + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Document format + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Document type + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Functional context + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Language + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + License + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Medium + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Object class + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Object type + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Period + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Script + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + Text type + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + 3D execution + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + 3D condition + </a> + </li> + <li> + <a> + <span class="icon pr-3"> + <i class="fa fa-plus"></i> + </span> + 3D reference + </a> + </li> + </ul> + <p class="menu-label has-text-white mt-3 pt-5 pl-5 is-size-6"> + Records + <span class="icon is-clickable pl-4" id="for-records"> + <i class="fa fa-angle-right"></i> + </span> + </p> + </aside> + </div> + <div class="column mt-6 mb-6"> + {% block rightpanel %}{% endblock %} + </div> +</div> +{% endblock %} \ No newline at end of file diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index aacddf5..60bca47 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -1,63 +1,32 @@ -{% extends 'base.html.twig' %} +{% extends 'data_entry.html.twig' %} {% block title %}Home | ArCOA{% endblock %} -{% block body %} - -<div class="columns mb-0"> - <div class="column is-one-fifth arcoa-menu mb-0"> - <aside class="menu"> - <p class="menu-label has-text-white mt-3 pt-5 pl-5 is-size-6"> - Vocabularies - <span class="icon is-clickable pl-4" id="for-vocabs"> - <i class="fa fa-angle-right"></i> - </span> - </p> - <ul class="pl-6 is-hidden has-text-white" id="vocabs"> - <li><a>Access rights</a></li> - <li><a>Civilization</a></li> - <li><a>Copyright</a></li> - <li><a>Document format</a></li> - <li><a>Document type</a></li> - <li><a>Functional context</a></li> - <li><a>Language</a></li> - <li><a>License</a></li> - <li><a>Medium</a></li> - <li><a>Object class</a></li> - <li><a>Object type</a></li> - <li><a>Period</a></li> - <li><a>Script</a></li> - <li><a>Text type</a></li> - </ul> - </aside> +{% block rightpanel %} + <div class="has-text-centered"> + <img width="200px" src="{{ asset('img/Logo-ArCOA-def.png') }}" /> </div> - <div class="column mt-6 mb-6"> - <div class="has-text-centered"> - <img width="200px" src="{{ asset('img/Logo-ArCOA-def.png') }}" /> - </div> - <h1 class="is-size-1 mt-6 mb-6 has-text-centered">ArCOA Digital Archive</h1> - <h2 class="is-size-3 mb-3 has-text-centered">Archivi e Collezioni dell'Oriente Antico</h2> - <h2 class="is-size-3 mb-6 has-text-centered">Archives and Collections of the Ancient Near East</h2> + <h1 class="is-size-1 mt-6 mb-6 has-text-centered">ArCOA Digital Archive</h1> + <h2 class="is-size-3 mb-3 has-text-centered">Archivi e Collezioni dell'Oriente Antico</h2> + <h2 class="is-size-3 mb-6 has-text-centered">Archives and Collections of the Ancient Near East</h2> - <div class="columns" style="max-width: 35vw; margin: 0 auto;"> - <div class="column mt-6 mb-5"> - <div class="card content p-4 is-clickable"> - <h3 class="is-size-5 has-text-centered">Resources</h3> - <figure class="figure has-text-centered"> - <img src="{{ asset('img/media.png') }}" width="120px" /> - </figure> - </div> + <div class="columns" style="max-width: 35vw; margin: 0 auto;"> + <div class="column mt-6 mb-5"> + <div class="card content p-4 is-clickable"> + <h3 class="is-size-5 has-text-centered">Resources</h3> + <figure class="figure has-text-centered"> + <img src="{{ asset('img/media.png') }}" width="120px" /> + </figure> </div> - <div class="column mt-6 mb-5"> - <div class="card content p-4 is-clickable"> - <h3 class="is-size-5 has-text-centered">Guide</h3> - <figure class="figure has-text-centered"> - <img src="{{ asset('img/guide.png') }}" width="120px"/> - </figure> - </div> + </div> + <div class="column mt-6 mb-5"> + <div class="card content p-4 is-clickable"> + <h3 class="is-size-5 has-text-centered">Guide</h3> + <figure class="figure has-text-centered"> + <img src="{{ asset('img/guide.png') }}" width="120px"/> + </figure> </div> </div> </div> -</div> {% endblock %}