Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 5e76512b authored by Arnaud Bey's avatar Arnaud Bey
Browse files

lexicon parameters UI

parent 50fe8352
......@@ -3,8 +3,10 @@
namespace LexiconBundle\Manager;
use Doctrine\ORM\EntityManagerInterface;
use LexiconBundle\Entity\Language;
use JMS\DiExtraBundle\Annotation as DI;
use LexiconBundle\Entity\Language;
use MagicWordBundle\Form\Type\LanguageType;
use Symfony\Component\HttpFoundation\Request;
/**
* @DI\Service("lexicon_manager.language")
......@@ -12,15 +14,18 @@ use JMS\DiExtraBundle\Annotation as DI;
class LanguageManager
{
private $em;
private $formFactory;
/**
* @DI\InjectParams({
* "em" = @DI\Inject("doctrine.orm.entity_manager"),
* "formFactory" = @DI\Inject("form.factory"),
* })
*/
public function __construct($em)
public function __construct($em, $formFactory)
{
$this->em = $em;
$this->formFactory = $formFactory;
}
public function create($languageProperty)
......@@ -36,4 +41,24 @@ class LanguageManager
return $language;
}
public function getWordLengthForm(Language $language)
{
$form = $this->formFactory->createBuilder(LanguageType::class, $language)->getForm()->createView();
return $form;
}
public function handleForm(Language $language, Request $request)
{
$form = $this->formFactory->createBuilder(LanguageType::class, $language)->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
$this->em->persist($language);
$this->em->flush();
}
return;
}
}
......@@ -21,6 +21,36 @@ class AdministrationController extends Controller
return $this->render('MagicWordBundle:Administration:index.html.twig');
}
/**
* @Route("/administration/{id}/index", name="index_language")
*/
public function indexLanguageAction(Language $language)
{
return $this->render('MagicWordBundle:Administration:index-language.html.twig', ['language' => $language]);
}
/**
* @Route("/administration/{id}/parameters", name="language_parameters")
* @Method("GET")
*/
public function parametersLanguageAction(Language $language)
{
$form = $this->get('lexicon_manager.language')->getWordLengthForm($language);
return $this->render('MagicWordBundle:Administration:language-edit.html.twig', ['form' => $form, 'language' => $language]);
}
/**
* @Route("/administration/{id}/parameters", name="language_parameters_submit")
* @Method("POST")
*/
public function parametersLanguageSubmitAction(Language $language, Request $request)
{
$this->get('lexicon_manager.language')->handleForm($language, $request);
return $this->redirectToRoute('index_language', ['id' => $language->getId()]);
}
/**
* @Route("/administration/{id}/wordlengths", name="wordlengths")
*/
......@@ -28,7 +58,7 @@ class AdministrationController extends Controller
{
$wordlengths = $this->getDoctrine()->getRepository(WordLength::class)->findByLanguage($language);
return $this->render('MagicWordBundle:Administration:wordlength.html.twig', ['wordlengths' => $wordlengths]);
return $this->render('MagicWordBundle:Administration:wordlength.html.twig', ['wordlengths' => $wordlengths, 'language' => $language]);
}
/**
......@@ -38,7 +68,7 @@ class AdministrationController extends Controller
{
$combopoints = $this->getDoctrine()->getRepository(ComboPoints::class)->findByLanguage($language);
return $this->render('MagicWordBundle:Administration:combopoints.html.twig', ['combopoints' => $combopoints]);
return $this->render('MagicWordBundle:Administration:combopoints.html.twig', ['combopoints' => $combopoints, 'language' => $language]);
}
/**
......@@ -91,7 +121,7 @@ class AdministrationController extends Controller
{
$letters = $this->getDoctrine()->getRepository('LexiconBundle:Letter')->findBy(["language" => $language], ["value" => "ASC"]);
return $this->render('MagicWordBundle:Administration:letterslanguage.html.twig', ['letters' => $letters]);
return $this->render('MagicWordBundle:Administration:letterslanguage.html.twig', ['letters' => $letters, 'language' => $language]);
}
/**
......@@ -117,17 +147,6 @@ class AdministrationController extends Controller
}
/**
* @Route("/administration/general_parameters", name="general_parameters")
* @Method("GET")
*/
public function generalParametersAction()
{
$generalParameters = $this->get('mw_manager.administration')->getGeneralParameters();
return $this->render('MagicWordBundle:Administration:general-parameters.html.twig', ['generalParameters' => $generalParameters]);
}
/**
* @Route("/administration/general_parameters_edit", name="general_parameters_edit")
* @Method("GET")
......@@ -148,6 +167,6 @@ class AdministrationController extends Controller
{
$this->get('mw_manager.administration')->handleGeneralParametersForm($request);
return $this->redirectToRoute('general_parameters');
return $this->redirectToRoute('admin_index');
}
}
<?php
namespace MagicWordBundle\Form\Type;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
class LanguageType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('value', TextType::class, [
'attr' => array('class' => 'form-control'),
'label' => 'name',
]);
$builder->add('minBigram', IntegerType::class, [
'attr' => array('class' => 'form-control'),
'label' => 'minBigram',
]);
$builder->add('save', SubmitType::class, array(
'attr' => array('class' => 'btn btn-secondary btn-sm mt-2'),
'label' => 'save',
'translation_domain' => 'messages',
));
$builder->setMethod('POST');
}
public function getName()
{
return 'language_parameters';
}
}
......@@ -120,7 +120,7 @@ language: Langue
lemma_info: 'Infos sur le lemme'
lemma: Lemme
letsgo: "C'est parti !"
letterlanguagepoints: Points par lettre et par langue
letterlanguagepoints: Points par lettre
link: Accès via le lien uniquement
masculine: masculin
massive_end: 'Récapitulatif partie massive'
......@@ -218,4 +218,4 @@ weight: Poids
wiktionary_def: Définition wiktionary
word_length: Longueur de la forme
wordbox: Wordbox
wordlengthpoints: Points bonus longueur de forme
wordlengthpoints: Points longueur de forme
......@@ -3,11 +3,17 @@
{% block title %}{{ 'combopoints' | trans }}{% endblock %}
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item"><a href="{{path('index_language', {id: combopoints.language.id})}}">{{combopoints.language.value}}</a></li>
<li class="breadcrumb-item"><a href="{{ path('combopoints', {'id': combopoints.language.id}) }}"> {{ "combopoints" | trans }}</a></li>
<li class="breadcrumb-item active"> Longueur {{ combopoints.length }} </li>
</ol>
</nav>
<div class="card">
<div class="card-header">
{% include "MagicWordBundle:Common:backtohome.html.twig" %}
{{ "combopoints" | trans }} - {{ combopoints.length }}
</div>
<div class="card-body">
{{ form(form) }}
</div>
......
......@@ -2,11 +2,16 @@
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item"><a href="{{path('index_language', {id: language.id})}}">{{language.value}}</a></li>
<li class="breadcrumb-item active"> {{ "combopoints" | trans }}</li>
</ol>
</nav>
<div class="card">
<div class="card-header">
{% include "MagicWordBundle:Common:backtohome.html.twig" %}
{{ "combopoints" | trans }}
</div>
<ul class="list-group list-group-flush">
{% for combopoint in combopoints %}
<li class="list-group-item">
......
......@@ -3,11 +3,15 @@
{% block title %}{{ 'letterlanguagepoints' | trans }}{% endblock %}
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ "general_parameters" | trans}}</li>
</ol>
</nav>
<div class="card">
<div class="card-header">
{% include "MagicWordBundle:Common:backtohome.html.twig" %}
{{ "general_parameters" | trans}}
</div>
<div class="card-body">
{{ form(form) }}
</div>
......
......@@ -3,23 +3,36 @@
{% block title %}{{ 'letterlanguagepoints' | trans }}{% endblock %}
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ "general_parameters" | trans}}</li>
</ol>
</nav>
<div class="card">
<div class="card-header">
{% include "MagicWordBundle:Common:backtohome.html.twig" %}
{{ "general_parameters" | trans}}
<span class="float-right">
<a class="btn btn-sm btn-outline-secondary" href="{{ path('general_parameters_edit') }}">
<i class="fas fa-edit" aria-hidden="true"></i>
{{ "edit" | trans }}
</a>
</span>
</div>
<div class="card-body">
<a class="btn btn-sm btn-outline-secondary mb-2" href="{{ path('general_parameters_edit') }}">
<i class="fas fa-edit" aria-hidden="true"></i>
{{ "edit" | trans }}
</a>
<h4> {{ "homeText" | trans}} </h4>
<i class="fa fa-quote-left" aria-hidden="true"></i>
{{ generalParameters.homeText | raw }}
<i class="fa fa-quote-right" aria-hidden="true"></i>
<hr/>
<h4> {{ "footer" | trans}} </h4>
<i class="fa fa-quote-left" aria-hidden="true"></i>
{{ generalParameters.footer | raw }}
<i class="fa fa-quote-right" aria-hidden="true"></i>
<hr/>
<h4> {{ "selfRegistration" | trans}} </h4>
{{ generalParameters.selfRegistration ? "oui" : "non" }}
</div>
......
{% extends '::base.html.twig' %}
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item active" aria-current="page">{{language.value}}</li>
</ol>
</nav>
<div class="row">
<div class="col-sm-4 mb-2">
<div class="card">
<div class="card-body">
<p class="text-center">
<i class="fa fa-cogs fa-3x" aria-hidden="true"></i> {{ "parameters" | trans | upper }}
</p>
<p>
Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla
</p>
<a class="btn btn-primary"href="{{ path('language_parameters', {'id': language.id}) }}">Editer</a>
</div>
</div>
</div>
<div class="col-sm-4 mb-2">
<div class="card">
<div class="card-body">
<p class="text-center">
<i class="fa fa-star fa-3x" aria-hidden="true"></i> {{ "wordlengthpoints" | trans | upper }}
</p>
<p>
Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla
</p>
<a class="btn btn-primary"href="{{ path('wordlengths', {'id': language.id}) }}">Editer</a>
</div>
</div>
</div>
<div class="col-sm-4 mb-2">
<div class="card">
<div class="card-body">
<p class="text-center">
<i class="fa fa-star fa-3x" aria-hidden="true"></i> {{ "letterlanguagepoints" | trans | upper }}
</p>
<p>
Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla
</p>
<a class="btn btn-primary"href="{{ path('letters', {'id': language.id}) }}">Editer</a>
</div>
</div>
</div>
<div class="col-sm-4 mb-2">
<div class="card">
<div class="card-body">
<p class="text-center">
<i class="fa fa-star fa-3x" aria-hidden="true"></i> {{ "combopoints" | trans | upper }}
</p>
<p>
Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla
</p>
<a class="btn btn-primary"href="{{ path('combopoints', {'id': language.id}) }}">Editer</a>
</div>
</div>
</div>
</div>
{% endblock %}
......@@ -4,43 +4,56 @@
{% set languages = get_languages() %}
<div class="card">
<div class="card-header">
{% include "MagicWordBundle:Common:backtohome.html.twig" %}
Administration
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item active" aria-current="page">Administration</li>
</ol>
</nav>
<div class="row">
<div class="col-sm-4 mb-2">
<div class="card">
<div class="card-body">
<p class="text-center">
<i class="fa fa-star fa-4x" aria-hidden="true"></i> {{ "general_parameters" | trans | upper }}
</p>
<p>
Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla
</p>
<a class="btn btn-primary" href="{{ path('general_parameters_edit') }}">{{ 'general_parameters' | trans }}</a>
</div>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<a href="{{ path('general_parameters') }}">
{{ "general_parameters" | trans }}
</a>
</li>
<li class="list-group-item">
{{ "letterlanguagepoints" | trans }} :
{% for language in languages %}
<a href="{{ path('letters', {'id': language.id}) }}">
{{ language.value }}
</a>
{% endfor %}
</li>
<li class="list-group-item">
{{ "wordlengthpoints" | trans }} :
{% for language in languages %}
<a href="{{ path('wordlengths', {'id': language.id}) }}">
{{ language.value }}
</a>
{% endfor %}
</li>
<li class="list-group-item">
{{ "combopoints" | trans }} :
</div>
<div class="col-sm-4 mb-2">
<div class="card">
<div class="card-body">
<p class="text-center">
<i class="fas fa-running fa-4x" aria-hidden="true"></i> {{'Lexiques'|upper}}
</p>
<p>
Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla
</p>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Editer
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
{% for language in languages %}
<a href="{{ path('combopoints', {'id': language.id}) }}">
{{ language.value }}
</a>
<a class="dropdown-item" href="{{ path('index_language', {id: language.id}) }}">
{{ language.value | trans }}
</a>
{% endfor %}
</li>
</div>
</div>
</div>
</div>
</div>
</ul>
</div>
{% endblock %}
{% extends '::base.html.twig' %}
{% block title %}{{ 'combopoints' | trans }}{% endblock %}
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item"><a href="{{path('index_language', {id: language.id})}}">{{language.value}}</a></li>
<li class="breadcrumb-item active"> Paramètres </li>
</ol>
</nav>
<div class="card">
<div class="card-body">
{{ form(form) }}
</div>
</div>
{% endblock %}
......@@ -3,11 +3,18 @@
{% block title %}{{ 'letterlanguagepoints' | trans }}{% endblock %}
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item"><a href="{{path('index_language', {id: letter.language.id})}}">{{letter.language.value}}</a></li>
<li class="breadcrumb-item"><a href="{{ path('letters', {'id': letter.language.id}) }}"> {{ "letterlanguagepoints" | trans }}</a></li>
<li class="breadcrumb-item active"> Lettre "{{ letter.value }}" </li>
</ol>
</nav>
<div class="card">
<div class="card-header">
{% include "MagicWordBundle:Common:backtohome.html.twig" %}
{{ letter.language.value | trans }} - {{ letter.value |upper}}
</div>
<div class="card-body">
{{ form(form) }}
</div>
......
......@@ -2,11 +2,16 @@
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item"><a href="{{path('index_language', {id: language.id})}}">{{language.value}}</a></li>
<li class="breadcrumb-item active"> {{ "letterlanguagepoints" | trans }}</li>
</ol>
</nav>
<div class="card">
<div class="card-header">
{% include "MagicWordBundle:Common:backtohome.html.twig" %}
{{ "letterlanguagepoints" | trans }}
</div>
<ul class="list-group">
{% for letter in letters %}
<li class="list-group-item">
......
......@@ -3,11 +3,18 @@
{% block title %}{{ 'wordlengthpoints' | trans }}{% endblock %}
{% block body -%}
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="background-color: #fff;">
<li class="breadcrumb-item"><a href="{{path('home')}}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{{path('admin_index')}}">Administration</a></li>
<li class="breadcrumb-item"><a href="{{path('index_language', {id: wordlength.language.id})}}">{{wordlength.language.value}}</a></li>
<li class="breadcrumb-item"><a href="{{ path('wordlengths', {'id': wordlength.language.id}) }}"> {{ "wordlengthpoints" | trans }}</a></li>
<li class="breadcrumb-item active"> Longueur {{ wordlength.length }} </li>
</ol>
</nav>
<div class="card">
<div class="card-header">
{% include "MagicWordBundle:Common:backtohome.html.twig" %}
{{ "wordlengthpoints" | trans }} - {{ wordlength.length }}
</div>
<div class="card-body">
{{ form(form) }}
</div>
......