advanced search (bis)

Ce commit contient des modifications qui sont peut-être dans un autre commit d'une
autre branche.
This commit is contained in:
Julien Fastré 2018-04-04 09:46:30 +02:00
parent 08141fddee
commit 29e3c74bd7
8 changed files with 80 additions and 5 deletions

View File

@ -42,4 +42,11 @@ class AdminController extends Controller {
return $this->render('ChillMainBundle:Admin:layout_permissions.html.twig');
}
public function configurationWarningsAction()
{
$alertManager = $this->get('chill_main.configuration_alert_manager');
}
}

View File

@ -106,6 +106,24 @@ class SearchController extends Controller
);
}
public function advancedSearchListAction(Request $request)
{
/* @var $variable Chill\MainBundle\Search\SearchProvider */
$searchProvider = $this->get('chill.main.search_provider');
$advancedSearchProviders = $searchProvider
->getHasAdvancedFormSearchServices();
if(\count($advancedSearchProviders) === 1) {
\reset($advancedSearchProviders);
return $this->redirectToRoute('chill_main_advanced_search', [
'name' => \key($advancedSearchProviders)
]);
}
return $this->render('ChillMainBundle:Search:choose_list.html.twig');
}
public function advancedSearchAction($name, Request $request)
{
try {
@ -144,7 +162,8 @@ class SearchController extends Controller
return $this->render('ChillMainBundle:Search:advanced_search.html.twig',
[
'form' => $form->createView(),
'name' => $name
'name' => $name,
'title' => $search->getAdvancedSearchTitle()
]);
}

View File

@ -66,6 +66,10 @@ chill_main_search:
chill_main_advanced_search:
path: /{_locale}/search/advanced/{name}
defaults: { _controller: ChillMainBundle:Search:advancedSearch }
chill_main_advanced_search_list:
path: /{_locale}/search/advanced
defaults: { _controller: ChillMainBundle:Search:advancedSearchList }
login:
path: /login

View File

@ -108,5 +108,12 @@ services:
- "@security.token_storage"
- "@chill.main.scope_repository"
- "@chill.main.helper.translatable_string"
tags:
- { name: form.type }
chill.main.form.advanced_search_type:
class: Chill\MainBundle\Form\AdvancedSearchType
arguments:
- "@chill.main.search_provider"
tags:
- { name: form.type }

View File

@ -0,0 +1,4 @@
welcome_message_raw: |
<p>Dans l'interface d'administration, vous pouvez configurer votre instance selon vos besoins.</p>

View File

@ -0,0 +1,17 @@
{% extends "ChillMainBundle::Admin/layoutWithVerticalMenu.html.twig" %}
{% block admin_content %}
<h1>{{ 'Administration interface'|trans }}</h1>
{{ 'welcome_message_raw'|trans|raw }}
<div>
<h2>{{ 'Configuration alerts'|trans }}</h2>
<p>{{ 'Here you can check the configuration of your instance.'|trans }}</p>
{{ chill_widget('configuration_warnings', {}) }}
</div>
{% endblock %}

View File

@ -17,10 +17,14 @@
{% extends "ChillMainBundle::layout.html.twig" %}
{% block title 'Advanced search for %name%'|trans({ '%name%' : name }) %}
{% block title title|trans %}
{% block content %}
<div style="margin-right: 2em; margin-left: 2em;">
<h1>{{ title|trans }}</h1>
{{ form_start(form) }}
{% for f in form %}
@ -28,9 +32,7 @@
{{ form_row(f) }}
{% endif %}
{% endfor %}
<ul class="record_actions">
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'sc-button bt-create change-icon' } } ) }}
@ -39,4 +41,6 @@
{{ form_end(form) }}
</div>
{% endblock %}

View File

@ -59,6 +59,19 @@ class SearchProvider
return $this->searchServices;
}
public function getHasAdvancedFormSearchServices()
{
//sort the array
uasort($this->hasAdvancedFormSearchServices, function(SearchInterface $a, SearchInterface $b) {
if ($a->getOrder() == $b->getOrder()) {
return 0;
}
return ($a->getOrder() < $b->getOrder()) ? -1 : 1;
});
return $this->hasAdvancedFormSearchServices;
}
/**
* parse the search string to extract domain and terms