Commit e56fb863 authored by Antonin's avatar Antonin

Multiples changements.

    - Amélioration du design
    - Ajout du menu
parent af2f712d
ACL
---
- Pages dans le menu (automatique ?)
- Liens accueil (heading && barre menu)
- Animation de démarage seulement la première fois (session ? Cookie ?)
- Problème small devices titre + menu barre
- Nettoyage (commentaires, code non utilisé, indentation, orga css)
- Validation (html, css, bonnes pratiques, sitemap, etc)
- Traductions manquantes (admin + )
- Autopublish ?
......@@ -15,6 +10,7 @@ ACL
- Mail (site + info adhérants)
- Wysiwyg
- Filtre des pages dans le menu par défaut
Mail
----
......
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20151116163134 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE page__page ADD inMenu TINYINT(1) NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE page__page DROP inMenu');
}
}
......@@ -166,4 +166,4 @@ sonata_admin:
# - bundles/sonataformatter/markitup/sets/markdown/set.js
# - bundles/sonataformatter/markitup/sets/html/set.js
# - bundles/sonataformatter/markitup/sets/textile/set.js
# - bundles/sonatapage/sonata-page.back.js
# - bundles/sonatapage/sonata-page.back.js
\ No newline at end of file
......@@ -163,6 +163,8 @@ sonata_page:
not_found: [404] # render 404 page with "not_found" key (name generated: _page_internal_error_{key})
fatal: [500] # so you can use the same page for different http errors or specify specific page for each error
direct_publication: true
# Enable Doctrine to map the provided entities
doctrine:
orm:
......
<?php
namespace ACL\Bundle\ACLBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Application\Sonata\PageBundle\Entity\Page;
class MenuController extends Controller
{
public function listAction(Request $request)
{
$em = $this->getDoctrine()->getRepository('ApplicationSonataPageBundle:Page');
$query = $em->createQueryBuilder('p')
->where('p.inMenu = :inMenu')
->setParameter('inMenu', true)
->orderBy('p.position', 'ASC')
->getQuery();
$results = $query->getResult();
$pagesList = array();
foreach ($results as $page) {
$this->addToPageList($pagesList, $page->getTitle(), $page->getUrl());
}
$router = $this->get('router');
$this->addToPageList($pagesList, "Blog", $router->generate('sonata_news_home'));
$this->addToPageList($pagesList, "Contact", $router->generate('mremi_contact_form'));
// echo '<pre>';
// var_dump($pagesList);
// echo '</pre>';
return $this->render('ACLBundle:Default:menu.html.twig', array('pages' => $pagesList));
}
private function addToPageList(&$pagesList, $name, $url)
{
$pagesList[] = array(
'name' => $name,
'url' => $url
);
}
}
......@@ -14,14 +14,37 @@ a:hover, a:focus {
width: 100%;
height: 50vh;
min-height: 300px;
max-height: 550px;
background: url(/img/banner.jpg) no-repeat center;
-webkit-background-size: cover;
background-size: cover;
}
#header .logo {
display: block;
width: 100%;
height: 100%;
background: url(/img/logo.png) no-repeat center;
-webkit-background-size: contain;
background-size: contain;
}
.sonata-page-top-bar {
margin-top: 50px;
}
@media (max-width: 991px) {
h1.title {
font-size: 46px!important;
margin-top: 80px!important;
}
}
h1.title {
margin-top: 20vh;
font-size: 56px;
text-align: center;
color: #211;
......@@ -63,6 +86,12 @@ h1.title {
#menu a {
font-weight: bold;
padding-left: 10px;
padding-right: 10px;
}
#menu .glyphicon-menu-hamburger {
font-size: 22px;
}
#menu .navbar-brand img{
......@@ -76,14 +105,18 @@ h1.title {
background-color: transparent;
border: none;
}
#menu.affix-top .icon-bar {
background-color: white;
}
#menu.affix-top a{
color: white;
text-shadow: 0px 0px 2px rgba(0,0,0, 0.5);
background-color: transparent;
border: none;
font-weight: bold;
padding: 8px;
margin: 7px;
padding: 8px 5px 7px 5px;
margin: 7px 5px 7px 5px;
}
#menu.affix-top a:hover{
border-bottom: 1px solid white;
......@@ -97,7 +130,7 @@ h1.title {
}
#menu.affix-top .navbar-brand{
visibility: hidden;
display: none;
}
#menu.affix-top .navbar-left {
......@@ -171,4 +204,52 @@ h1.title {
.recent_posts article:last-of-type {
border-bottom: none;
padding-bottom: 5px;
}
.recent_posts article h3 {
display: inline;
font-size: 16px;
}
.recent_posts article .contents {
margin-top: 10px;
}
/* Menu collapsing point change */
@media (max-width: 991px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar-text {
float: none;
margin: 15px 0;
}
/* since 3.1.0 */
.navbar-collapse.collapse.in {
display: block!important;
}
.collapsing {
overflow: hidden!important;
}
}
\ No newline at end of file
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><img src="{{ asset('img/logo-simple.png')}}" alt="Logo ACL"></a>
<h2 class="navbar-brand"><a href="/">L'Amicale Du Combat Libre</a></h2>
</div>
<div class="navbar-right collapse navbar-collapse">
<ul id="menuList" class="nav navbar-nav">
{% for p in pages %}
<li><a href="{{ p.url }}">{{ p.name }}</a></li>
{% endfor %}
</ul>
</div>
\ No newline at end of file
......@@ -19,12 +19,12 @@ file that was distributed with this source code.
<article>
<div>
<span class="label label-default">{{ post.publicationDateStart | format_date }}</span>
<a href="{{ url('sonata_news_view', { 'permalink': sonata_news_permalink(post) }) }}">
<h3><a href="{{ url('sonata_news_view', { 'permalink': sonata_news_permalink(post) }) }}">
{{ post.title }} - {{'archive_author'|trans({'%author%': post.author }, 'SonataNewsBundle') }}
</a>
</a></h3>
</div>
<div>
<p>{{ post.content|raw }}</p>
<div class="contents">
{{ post.content|raw }}
</div>
</article>
{% else %}
......
<?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Application\Sonata\PageBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\PageBundle\Model\PageInterface;
use Sonata\PageBundle\Model\PageManagerInterface;
use Sonata\PageBundle\Model\SiteManagerInterface;
use Sonata\PageBundle\Admin\PageAdmin as BasePageAdmin;
/**
* Admin definition for the Page class
*
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*/
class PageAdmin extends BasePageAdmin
{
/**
* {@inheritdoc}
*/
protected function configureShowFields(ShowMapper $showMapper)
{
$showMapper
->add('site')
->add('routeName')
->add('pageAlias')
->add('type')
->add('enabled')
->add('decorate')
->add('name')
->add('slug')
->add('customUrl')
->add('edited')
->add('inMenu')
;
}
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('hybrid', 'text', array('template' => 'SonataPageBundle:PageAdmin:field_hybrid.html.twig'))
->addIdentifier('name')
->add('type')
->add('pageAlias')
->add('site')
->add('decorate', null, array('editable' => true))
->add('enabled', null, array('editable' => true))
->add('edited', null, array('editable' => true))
->add('inMenu', null, array('editable' => true))
;
}
/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('site')
->add('name')
->add('type', null, array('field_type' => 'sonata_page_type_choice'))
->add('pageAlias')
->add('parent')
->add('edited')
->add('inMenu')
->add('hybrid', 'doctrine_orm_callback', array(
'callback' => function($queryBuilder, $alias, $field, $data) {
if (in_array($data['value'], array('hybrid', 'cms'))) {
$queryBuilder->andWhere(sprintf('%s.routeName %s :routeName', $alias, $data['value'] == 'cms' ? '=' : '!='));
$queryBuilder->setParameter('routeName', PageInterface::PAGE_ROUTE_CMS_NAME);
}
},
'field_options' => array(
'required' => false,
'choices' => array(
'hybrid' => $this->trans('hybrid'),
'cms' => $this->trans('cms'),
)
),
'field_type' => 'choice'
))
;
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
// define group zoning
$formMapper
->with($this->trans('form_page.group_main_label'), array('class' => 'col-md-6'))->end()
->with($this->trans('form_page.group_seo_label'), array('class' => 'col-md-6'))->end()
->with($this->trans('form_page.group_advanced_label'), array('class' => 'col-md-6'))->end()
;
if (!$this->getSubject() || (!$this->getSubject()->isInternal() && !$this->getSubject()->isError())) {
$formMapper
->with($this->trans('form_page.group_main_label'))
->add('url', 'text', array('attr' => array('readonly' => 'readonly')))
->end()
;
}
if ($this->hasSubject() && !$this->getSubject()->getId()) {
$formMapper
->with($this->trans('form_page.group_main_label'))
->add('site', null, array('required' => true, 'read_only' => true))
->end()
;
}
$formMapper
->with($this->trans('form_page.group_main_label'))
->add('name')
->add('enabled', null, array('required' => false))
->add('inMenu', null, array('required' => false))
->add('position')
->end()
;
if ($this->hasSubject() && !$this->getSubject()->isInternal()) {
$formMapper
->with($this->trans('form_page.group_main_label'))
->add('type', 'sonata_page_type_choice', array('required' => false))
->end()
;
}
$formMapper
->with($this->trans('form_page.group_main_label'))
->add('templateCode', 'sonata_page_template', array('required' => true))
->end()
;
if (!$this->getSubject() || ($this->getSubject() && $this->getSubject()->getParent()) || ($this->getSubject() && !$this->getSubject()->getId())) {
$formMapper
->with($this->trans('form_page.group_main_label'))
->add('parent', 'sonata_page_selector', array(
'page' => $this->getSubject() ?: null,
'site' => $this->getSubject() ? $this->getSubject()->getSite() : null,
'model_manager' => $this->getModelManager(),
'class' => $this->getClass(),
'required' => false,
'filter_choice' => array('hierarchy' => 'root'),
), array(
'admin_code' => $this->getCode(),
'link_parameters' => array(
'siteId' => $this->getSubject() ? $this->getSubject()->getSite()->getId() : null
)
))
->end()
;
}
if (!$this->getSubject() || !$this->getSubject()->isDynamic()) {
$formMapper
->with($this->trans('form_page.group_main_label'))
->add('pageAlias', null, array('required' => false))
->add('target', 'sonata_page_selector', array(
'page' => $this->getSubject() ?: null,
'site' => $this->getSubject() ? $this->getSubject()->getSite() : null,
'model_manager' => $this->getModelManager(),
'class' => $this->getClass(),
'filter_choice' => array('request_method' => 'all'),
'required' => false
), array(
'admin_code' => $this->getCode(),
'link_parameters' => array(
'siteId' => $this->getSubject() ? $this->getSubject()->getSite()->getId() : null
)
))
->end()
;
}
if (!$this->getSubject() || !$this->getSubject()->isHybrid()) {
$formMapper
->with($this->trans('form_page.group_seo_label'))
->add('slug', 'text', array('required' => false))
->add('customUrl', 'text', array('required' => false))
->end()
;
}
$formMapper
->with($this->trans('form_page.group_seo_label'), array('collapsed' => true))
->add('title', null, array('required' => false))
->add('metaKeyword', 'textarea', array('required' => false))
->add('metaDescription', 'textarea', array('required' => false))
->end()
;
if ($this->hasSubject() && !$this->getSubject()->isCms()) {
$formMapper
->with($this->trans('form_page.group_advanced_label'), array('collapsed' => true))
->add('decorate', null, array('required' => false))
->end()
;
}
$formMapper
->with($this->trans('form_page.group_advanced_label'), array('collapsed' => true))
->add('javascript', null, array('required' => false))
->add('stylesheet', null, array('required' => false))
->add('rawHeaders', null, array('required' => false))
->end()
;
$formMapper->setHelps(array(
'name' => $this->trans('help_page_name')
));
}
}
......@@ -28,6 +28,11 @@ class Page extends BasePage
*/
protected $id;
/**
* @var boolean $inMenu
*/
protected $inMenu;
/**
* Get id
*
......@@ -37,4 +42,18 @@ class Page extends BasePage
{
return $this->id;
}
/**
* Get if the page is in menu
*
* @return bool
*/
public function getInMenu()
{
return $this->inMenu;
}
public function setInMenu($inMenu) {
$this->inMenu = $inMenu;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<!-- PAGE -->
<parameter key="sonata.page.admin.page.class">Application\Sonata\PageBundle\Admin\PageAdmin</parameter>
<parameter key="sonata.page.admin.page.controller">SonataPageBundle:PageAdmin</parameter>
<parameter key="sonata.page.admin.page.translation_domain">SonataPageBundle</parameter>
<!-- SITE -->
<parameter key="sonata.page.admin.site.class">Sonata\PageBundle\Admin\SiteAdmin</parameter>
<parameter key="sonata.page.admin.site.controller">SonataPageBundle:SiteAdmin</parameter>
<parameter key="sonata.page.admin.site.translation_domain">%sonata.page.admin.page.translation_domain%</parameter>
<!-- BLOCK -->
<parameter key="sonata.page.admin.block.class">Sonata\PageBundle\Admin\BlockAdmin</parameter>
<parameter key="sonata.page.admin.block.controller">SonataPageBundle:BlockAdmin</parameter>
<parameter key="sonata.page.admin.block.translation_domain">%sonata.page.admin.page.translation_domain%</parameter>
<!-- SHARED BLOCK -->
<parameter key="sonata.page.admin.shared_block.class">Sonata\PageBundle\Admin\SharedBlockAdmin</parameter>
<parameter key="sonata.page.admin.shared_block.controller">%sonata.page.admin.block.controller%</parameter>
<parameter key="sonata.page.admin.shared_block.translation_domain">%sonata.page.admin.page.translation_domain%</parameter>
<!-- SNAPSHOT -->
<parameter key="sonata.page.admin.snapshot.class">Sonata\PageBundle\Admin\SnapshotAdmin</parameter>
<parameter key="sonata.page.admin.snapshot.controller">SonataPageBundle:SnapshotAdmin</parameter>
<parameter key="sonata.page.admin.snapshot.translation_domain">%sonata.page.admin.page.translation_domain%</parameter>
</parameters>
<services>
<service id="sonata.page.admin.page" class="%sonata.page.admin.page.class%">
<tag name="sonata.admin" manager_type="orm" group="sonata_page" label_catalogue="%sonata.page.admin.page.translation_domain%" label="page" label_translator_strategy="sonata.admin.label.strategy.underscore"/>
<argument />
<argument>%sonata.page.admin.page.entity%</argument>
<argument>%sonata.page.admin.page.controller%</argument>
<call method="addChild">
<argument type="service" id="sonata.page.admin.block" />
</call>
<call method="addChild">
<argument type="service" id="sonata.page.admin.snapshot" />
</call>
<call method="setPageManager">
<argument type="service" id="sonata.page.manager.page" />
</call>
<call method="setCacheManager">
<argument type="service" id="sonata.cache.manager" />
</call>
<call method="setSiteManager">
<argument type="service" id="sonata.page.manager.site" />
</call>
<call method="setTranslationDomain">
<argument>%sonata.page.admin.page.translation_domain%</argument>
</call>
<call method="setTemplates">
<argument type="collection">
<argument key="list">SonataPageBundle:PageAdmin:list.html.twig</argument>
</argument>
</call>
</service>
<service id="sonata.page.admin.block" class="%sonata.page.admin.block.class%">
<tag name="sonata.admin" manager_type="orm" show_in_dashboard="false" group="sonata_page" label_catalogue="%sonata.page.admin.page.translation_domain%" label="block" label_translator_strategy="sonata.admin.label.strategy.underscore"/>
<argument />
<argument>%sonata.page.admin.block.entity%</argument>
<argument>%sonata.page.admin.block.controller%</argument>
<call method="setCacheManager">
<argument type="service" id="sonata.cache.manager" />
</call>
<call method="setBlockManager">
<argument type="service" id="sonata.block.manager" />
</call>
<call method="setTranslationDomain">
<argument>%sonata.page.admin.block.translation_domain%</argument>
</call>
<call method="setContainerBlockTypes">
<argument>%sonata.block.container.types%</argument>
</call>
<call method="setFormTheme">
<argument type="collection">
<argument>SonataPageBundle:Form:form_admin_fields.html.twig</argument>
<argument>SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig</argument>
</argument>
</call>
</service>
<service id="sonata.page.admin.shared_block" class="%sonata.page.admin.shared_block.class%">
<tag name="sonata.admin" manager_type="orm" show_in_dashboard="true" group="sonata_page" label_catalogue="%sonata.page.admin.page.translation_domain%" label="shared_block" label_translator_strategy="sonata.admin.label.strategy.underscore"/>
<argument />
<argument>%sonata.page.admin.block.entity%</argument>
<argument>%sonata.page.admin.shared_block.controller%</argument>
<call method="setCacheManager">
<argument type="service" id="sonata.cache.manager" />
</call>
<call method="setBlockManager">
<argument type="service" id="sonata.block.manager" />
</call>
<call method="setTranslationDomain">
<argument>%sonata.page.admin.shared_block.translation_domain%</argument>
</call>
<call method="setContainerBlockTypes">
<argument>%sonata.block.container.types%</argument>
</call>
<call method="setFormTheme">
<argument type="collection">
<argument>SonataPageBundle:Form:form_admin_fields.html.twig</argument>
<argument>SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig</argument>
</argument>
</call>
</service>
<service id="sonata.page.admin.snapshot" class="%sonata.page.admin.snapshot.class%">
<tag name="sonata.admin" manager_type="orm" group="sonata_page" label_catalogue="%sonata.page.admin.snapshot.translation_domain%" label="snapshot" show_in_dashboard="false" label_translator_strategy="sonata.admin.label.strategy.underscore"/>
<argument />
<argument>%sonata.page.admin.snapshot.entity%</argument>
<argument>%sonata.page.admin.snapshot.controller%</argument>
<call method="setCacheManager">
<argument type="service" id="sonata.cache.manager" />
</call>