Commit b115561b authored by Antonin's avatar Antonin

User stuff

parent 8860fab9
ACL
---
- contact-adherents/
- Mise à jour du breadcrumb login en ligne (changement du titre des pages)
- Lien de connexion / inscription
- Tester droits + médias privés
- Partie privée
- Page liens
- Changement mail et validation
- 404 ?
- Sitemap
......@@ -16,5 +22,5 @@ ACL
- Mail (site + info adhérants)
- Wysiwyg
- Filtre des pages dans le menu par défaut
- Captcha sur les commentaires
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
{% extends 'base.html.twig' %}
{% block body %}
Homepage.
{% endblock %}
......@@ -18,10 +18,10 @@ sonata_admin:
object_permissions: [VIEW, EDIT, DELETE, UNDELETE, OPERATOR, MASTER, OWNER]
title: "Amicale du Combat Libre"
title_logo: %sonata_admin.logo_title%
title_logo: "/favicon-white.png"
options:
html5_validate: false # does not use html5 validation
pager_links: 5 # pager max links to display
pager_links: 10 # pager max links to display
templates:
# default global templates
......
#
# more information can be found here http://sonata-project.org/bundles/user
#
parameters:
sonata.user.profile.form.type.class: Application\Sonata\UserBundle\Form\Type\ProfileType
# Enable Doctrine to map the provided entities
doctrine:
orm:
......@@ -30,16 +34,13 @@ sonata_user:
profile:
dashboard:
blocks:
- { position: left, type: sonata.block.service.text, settings: { content: "<h2>Welcome!</h2> <p>This is a sample user profile dashboard, feel free to override it in the configuration! Want to make this text dynamic? For instance display the user's name? Create a dedicated block and edit the configuration!</p>"} }
- { position: left, type: sonata.order.block.recent_orders, settings: { title: Recent Orders, number: 5, mode: public }}
- { position: left, type: sonata.block.service.text, settings: { content: "<h2>Bienvenue !</h2> <p>Le tableau de bord est un peu vide pour l'instant, mais il se remplira bientôt !</p>"} }
- { position: right, type: sonata.timeline.block.timeline, settings: { max_per_page: 15 }}
- { position: right, type: sonata.news.block.recent_posts, settings: { title: Recent Posts, number: 5, mode: public }}
- { position: right, type: sonata.news.block.recent_comments, settings: { title: Recent Comments, number: 5, mode: public }}
- { position: left, type: sonata.news.block.recent_posts, settings: { title: News Récentes, number: 5, mode: public }}
- { position: left, type: sonata.news.block.recent_comments, settings: { title: Commentaires Récents, number: 5, mode: public }}
menu:
- { route: 'sonata_user_profile_show', label: 'sonata_profile_title', domain: 'SonataUserBundle'}
- { route: 'sonata_user_profile_edit', label: 'link_edit_profile', domain: 'SonataUserBundle'}
- { route: 'sonata_customer_addresses', label: 'link_list_addresses', domain: 'SonataCustomerBundle'}
- { route: 'sonata_order_index', label: 'order_list', domain: 'SonataOrderBundle'}
form:
type: sonata_user_profile
handler: sonata.user.profile.form.handler.default
......@@ -48,3 +49,10 @@ sonata_user:
# Defaults:
- Profile
- Default
services:
sonata.user.profile.form.type:
class: Application\Sonata\UserBundle\Form\Type\ProfileType
tags:
- { name: form.type, alias: sonata_user_profile }
arguments: [%fos_user.model.user.class%]
\ No newline at end of file
This diff is collapsed.
......@@ -29,22 +29,26 @@ class MenuController extends Controller
$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>';
$securityContext = $this->container->get('security.context');
if ($securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
$user = $securityContext->getToken()->getUser();
$this->addToPageList($pagesList, $user->getUsername(), $router->generate('sonata_user_profile_show'), 'glyphicon glyphicon-user');
$this->addToPageList($pagesList, "", $router->generate('sonata_user_security_logout'), 'glyphicon glyphicon-log-out');
} else {
$this->addToPageList($pagesList, "Connexion", $router->generate('sonata_user_security_login'), 'glyphicon glyphicon-log-in');
}
return $this->render('ACLBundle:Default:menu.html.twig', array('pages' => $pagesList));
}
private function addToPageList(&$pagesList, $name, $url)
private function addToPageList(&$pagesList, $name, $url, $icon='')
{
$pagesList[] = array(
'name' => $name,
'url' => $url
'url' => $url,
'icon' => $icon
);
}
}
......@@ -24,6 +24,9 @@ h1, h2, h3{
.h2, h2 {
font-size: 22px;
}
.h3, h3 {
font-size: 18px;
}
#header {
width: 100%;
......@@ -99,7 +102,10 @@ h1.title {
height: 20px;
}
#menu .navbar-brand a:focus, #menu .navbar-brand a:hover {
#menu .navbar-brand a:focus, #menu .navbar-brand a:hover,
h1 a:focus, h1 a:hover,
h2 a:focus, h2 a:hover,
h3 a:focus, h3 a:hover {
text-decoration: none;
}
......
......@@ -13,7 +13,14 @@
<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>
<li>
<a href="{{ p.url }}">
{{ p.name }}
{% if p.icon is not empty %}
<span class="{{ p.icon }}"></span>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
\ No newline at end of file
{% extends "SonataPageBundle::base_layout.html.twig" %}
{% block application_breadcrumb %}
<div class="breadcrumb-container">
<div class="container">
<div class="sonata_breadcrumb">
<ol class="breadcrumb">
<li class=""><a href="/">Accueil</a><div class="sonata_breadcrumb"></div></li>
<li class=""><a href="/contact">Contact</a><div class="sonata_breadcrumb"></div></li>
</ol>
{% block sonata_page_container %}
<div class="breadcrumb-container">
<div class="container">
<div class="sonata_breadcrumb">
<ol class="breadcrumb">
<li class=""><a href="/">Accueil</a><div class="sonata_breadcrumb"></div></li>
<li class=""><a href="/contact">Contact</a><div class="sonata_breadcrumb"></div></li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block sonata_page_container %}
<div class="container">
<h1>Contact</h1>
{% block contact_contents %}{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
......@@ -23,6 +23,7 @@ use Sonata\PageBundle\Model\PageInterface;
use Sonata\PageBundle\Model\PageManagerInterface;
use Sonata\PageBundle\Model\SiteManagerInterface;
use Sonata\CoreBundle\Form\Type\EqualType;
use Sonata\PageBundle\Admin\PageAdmin as BasePageAdmin;
......@@ -34,6 +35,19 @@ use Sonata\PageBundle\Admin\PageAdmin as BasePageAdmin;
class PageAdmin extends BasePageAdmin
{
/**
* Default values to the datagrid.
*
* @var array
*/
protected $datagridValues = array(
'_page' => 1,
'_per_page' => 25,
'inMenu' => array(
'value' => EqualType::TYPE_IS_EQUAL
)
);
/**
* {@inheritdoc}
*/
......
{% extends 'SonataPageBundle::base_layout.html.twig' %}
{% block sonata_page_container %}
{% if page is defined and page.name != 'Accueil' %}
<div class="breadcrumb-container">
<div class="container">
{{ sonata_block_render({ 'type': 'sonata.page.block.breadcrumb'}) }}
</div>
</div>
{% endif %}
<div class="container">
<div class="content">
......
{#
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.
#}
{%- block sonata_page_html_tag -%}
<!DOCTYPE html>
<html {{ sonata_seo_html_attributes() }}>
......@@ -163,15 +153,6 @@ file that was distributed with this source code.
{% endblock %}
{% endblock %}
{% block application_breadcrumb %}
{% if page.name != 'Accueil' %}
<div class="breadcrumb-container">
<div class="container">
{{ sonata_block_render({ 'type': 'sonata.page.block.breadcrumb' }) }}
</div>
</div>
{% endif %}
{% endblock %}
<div id="main-contents">
{% block sonata_page_container %}
......
{% extends 'SonataPageBundle::base_layout.html.twig' %}
{% block sonata_page_container %}
{% if page is defined and page.name != 'Accueil' %}
<div class="breadcrumb-container">
<div class="container">
{{ sonata_block_render({ 'type': 'sonata.page.block.breadcrumb'}) }}
</div>
</div>
{% endif %}
<div class="container">
<div class="content">
......
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="fr" target-language="fr" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>actions.sonata.admin.create</source>
<target>%subject% a créé %target%</target>
</trans-unit>
<trans-unit id="2">
<source>actions.sonata.admin.update</source>
<target>%subject% a modifié %target%</target>
</trans-unit>
<trans-unit id="3">
<source>actions.sonata.admin.delete</source>
<target>%subject% a supprimé %target%</target>
</trans-unit>
<trans-unit id="4">
<source>actions.icon.sonata.admin.create</source>
<target>glyphicon glyphicon-plus-sign</target>
</trans-unit>
<trans-unit id="5">
<source>actions.icon.sonata.admin.update</source>
<target>glyphicon glyphicon-save</target>
</trans-unit>
<trans-unit id="6">
<source>actions.icon.sonata.admin.delete</source>
<target>glyphicon glyphicon-minus-sign</target>
</trans-unit>
</body>
</file>
</xliff>
{% extends sonata_block.templates.block_base %}
{% block block %}
<div class="box box-primary">
<div class="box-heading">
<h3 class="box-title"><i class="glyphicon glyphicon-time"></i> Dernières Actions</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-md-12">
<ul class="timeline list-unstyled">
{% for entry in entries %}
{% if currentDay is not defined or currentDay != entry.createdAt|format_date %}
{% set currentDay = entry.createdAt|format_date %}
<li class="time-label">
<h4 class="bg-info text-center">{{ currentDay }}</h4>
</li>
{% endif %}
{% set subject = entry.getComponent('subject') %}
{% set target = entry.getComponent('target') %}
{% set target_text_component = entry.getComponent('target_text') %}
{% if subject.data %}
{% set subject_text = sonata_timeline_generate_link(subject, entry) %}
{% else %}
{% set subject_text = '<abbr title="reference: ' ~ subject.hash ~ '">element deleted</abbr>' %}
{% endif %}
{% if target.data is defined and target.data is not empty %}
{% set target_text = sonata_timeline_generate_link(target, entry) %}
{% elseif target_text_component %}
{% set target_text = '<abbr title="Element Deleted">'~target_text_component~'</abbr>' %}
{% else %}
{% set target_text = '<abbr title="reference: ' ~ target.hash ~ '">element deleted</abbr>' %}
{% endif %}
{% set verb = "actions."~entry.verb %}
{% set icon = "actions.icon."~entry.verb %}
<li>
<div class="timeline-item">
<p class="timeline-header" style="border-bottom: none;">
<i class="{{ icon|trans({}, "SonataTimelineBundle") }}"></i>
<span class="time label label-default"><i class="glyphicon glyphicon-time"></i> {{ entry.createdAt|format_time }}</span>
{{ verb|trans({'%subject%': subject_text, '%target%': target_text}, "SonataTimelineBundle")|raw }}
</p>
</div>
</li>
{% else %}
Pas d'actions pour l'instant...
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endblock %}
<?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\UserBundle\Block;
use Knp\Menu\ItemInterface;
use Knp\Menu\Provider\MenuProviderInterface;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Sonata\BlockBundle\Block\Service\MenuBlockService;
use Sonata\BlockBundle\Model\BlockInterface;
use Sonata\UserBundle\Menu\ProfileMenuBuilder;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* Class ProfileMenuBlockService
*
* @package Sonata\UserBundle\Block
*
* @author Hugo Briand <briand@ekino.com>
*/
class ProfileMenuBlockService extends MenuBlockService
{
/**
* @var ProfileMenuBuilder
*/
private $menuBuilder;
/**
* Constructor
*
* @param string $name
* @param EngineInterface $templating
* @param MenuProviderInterface $menuProvider
* @param ProfileMenuBuilder $menuBuilder
*/
public function __construct($name, EngineInterface $templating, MenuProviderInterface $menuProvider, ProfileMenuBuilder $menuBuilder)
{
parent::__construct($name, $templating, $menuProvider, array());
$this->menuBuilder = $menuBuilder;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'User Profile Menu';
}
/**
* {@inheritdoc}
*/
public function setDefaultSettings(OptionsResolverInterface $resolver)
{
parent::setDefaultSettings($resolver);
$resolver->setDefaults(array(
'cache_policy' => 'private',
'menu_template' => "SonataBlockBundle:Block:block_side_menu_template.html.twig",
));
}
/**
* {@inheritdoc}
*/
protected function getMenu(BlockContextInterface $blockContext)
{
$settings = $blockContext->getSettings();
$menu = parent::getMenu($blockContext);
if (null === $menu || "" === $menu) {
$menu = $this->menuBuilder->createProfileMenu(
array(
'childrenAttributes' => array('class' => $settings['menu_class']),
'attributes' => array('class' => $settings['children_class']),
)
);
//$menu->setCurrent($settings['current_uri']);
}
return $menu;
}
}
\ No newline at end of file
<?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\UserBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Sonata\UserBundle\Model\UserInterface;
class ProfileType extends AbstractType
{
private $class;
/**
* @param string $class The User class name
*/
public function __construct($class)
{
$this->class = $class;
}
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('firstname', null, array(
'label' => 'form.label_firstname',
'required' => false
))
->add('lastname', null, array(
'label' => 'form.label_lastname',
'required' => false
))
->add('dateOfBirth', 'birthday', array(
'label' => 'form.label_date_of_birth',
'required' => false,
'widget' => 'single_text'
))
->add('locale', 'locale', array(
'label' => 'form.label_locale',
'required' => false
))
->add('timezone', 'timezone', array(
'label' => 'form.label_timezone',
'required' => false
))
->add('phone', null, array(
'label' => 'form.label_phone',
'required' => false
))
;
}
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => $this->class
));
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'sonata_user_profile';
}
}
<?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">
<services>
<service id="sonata.user.block.menu" class="Application\Sonata\UserBundle\Block\ProfileMenuBlockService">
<tag name="sonata.block" />
<argument>sonata.user.block.menu</argument>
<argument type="service" id="templating" />
<argument type="service" id="knp_menu.menu_provider" />
<argument type="service" id="sonata.user.profile.menu_builder" />
</service>
<service id="sonata.user.block.account" class="Sonata\UserBundle\Block\AccountBlockService">
<tag name="sonata.block" />
<argument>sonata.user.block.account</argument>
<argument type="service" id="templating" />
<argument type="service" id="security.context" />
</service>
</services>
</container>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="fos_user_profile_show" pattern="/">
<default key="_controller">SonataUserBundle:ProfileFOSUser1:show</default>
<requirement key="_method">GET</requirement>
</route>
<route id="fos_user_profile_edit_authentication" pattern="/edit-authentication">
<default key="_controller">SonataUserBundle:ProfileFOSUser1:editAuthentication</default>
</route>
<route id="fos_user_profile_edit" pattern="/edit-profile">
<default key="_controller">SonataUserBundle:ProfileFOSUser1:editProfile</default>
</route>
<route id="sonata_user_profile_show" pattern="/">
<default key="_controller">SonataUserBundle:ProfileFOSUser1:show</default>
<requirement key="_method">GET</requirement>
</route>
<route id="sonata_user_profile_edit_authentication" pattern="/edit-authentication">
<default key="_controller">SonataUserBundle:ProfileFOSUser1:editAuthentication</default>
</route>
<route id="sonata_user_profile_edit" pattern="/edit-profile">
<default key="_controller">SonataUserBundle:ProfileFOSUser1:editProfile</default>
</route>
</routes>
<div class="container">
<div class="content">
<h2>{% block sonata_profile_title %}{% trans from 'SonataUserBundle' %}sonata_profile_title{% endtrans %}{% endblock %}</h2>
<div class="sonata-user-show row row-fluid">
<div class="span2 col-lg-2" style="padding: 8px 0;">
{% block sonata_profile_menu %}
{{ sonata_block_render({'type': 'sonata.user.block.menu'}, {'current_uri': app.request.requestUri}) }}
{% endblock %}
</div>
<div class="span10 col-lg-10">
{% include 'SonataCoreBundle:FlashMessage:render.html.twig' %}
{% block sonata_profile_content '' %}
</div>
</div>
</div>
</div>
{#
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.
#}
<div class="row">
<div class="span6 col-lg-6">
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">{{ 'title_user_edit_authentication'|trans({}, 'SonataUserBundle') }}</h3>
</div>
<div class="panel-body">
<form action="{{ path('sonata_user_profile_edit_authentication') }}" method="POST" class="form-horizontal">