mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
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:
parent
08141fddee
commit
29e3c74bd7
@ -42,4 +42,11 @@ class AdminController extends Controller {
|
|||||||
return $this->render('ChillMainBundle:Admin:layout_permissions.html.twig');
|
return $this->render('ChillMainBundle:Admin:layout_permissions.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function configurationWarningsAction()
|
||||||
|
{
|
||||||
|
$alertManager = $this->get('chill_main.configuration_alert_manager');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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)
|
public function advancedSearchAction($name, Request $request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -144,7 +162,8 @@ class SearchController extends Controller
|
|||||||
return $this->render('ChillMainBundle:Search:advanced_search.html.twig',
|
return $this->render('ChillMainBundle:Search:advanced_search.html.twig',
|
||||||
[
|
[
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'name' => $name
|
'name' => $name,
|
||||||
|
'title' => $search->getAdvancedSearchTitle()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,10 @@ chill_main_search:
|
|||||||
chill_main_advanced_search:
|
chill_main_advanced_search:
|
||||||
path: /{_locale}/search/advanced/{name}
|
path: /{_locale}/search/advanced/{name}
|
||||||
defaults: { _controller: ChillMainBundle:Search:advancedSearch }
|
defaults: { _controller: ChillMainBundle:Search:advancedSearch }
|
||||||
|
|
||||||
|
chill_main_advanced_search_list:
|
||||||
|
path: /{_locale}/search/advanced
|
||||||
|
defaults: { _controller: ChillMainBundle:Search:advancedSearchList }
|
||||||
|
|
||||||
login:
|
login:
|
||||||
path: /login
|
path: /login
|
||||||
|
@ -108,5 +108,12 @@ services:
|
|||||||
- "@security.token_storage"
|
- "@security.token_storage"
|
||||||
- "@chill.main.scope_repository"
|
- "@chill.main.scope_repository"
|
||||||
- "@chill.main.helper.translatable_string"
|
- "@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:
|
tags:
|
||||||
- { name: form.type }
|
- { name: form.type }
|
4
Resources/translations/admin.fr.yml
Normal file
4
Resources/translations/admin.fr.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
welcome_message_raw: |
|
||||||
|
<p>Dans l'interface d'administration, vous pouvez configurer votre instance selon vos besoins.</p>
|
||||||
|
|
||||||
|
|
17
Resources/views/Admin/index.html.twig
Normal file
17
Resources/views/Admin/index.html.twig
Normal 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 %}
|
@ -17,10 +17,14 @@
|
|||||||
{% extends "ChillMainBundle::layout.html.twig" %}
|
{% extends "ChillMainBundle::layout.html.twig" %}
|
||||||
|
|
||||||
|
|
||||||
{% block title 'Advanced search for %name%'|trans({ '%name%' : name }) %}
|
{% block title title|trans %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<div style="margin-right: 2em; margin-left: 2em;">
|
||||||
|
|
||||||
|
<h1>{{ title|trans }}</h1>
|
||||||
|
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
|
|
||||||
{% for f in form %}
|
{% for f in form %}
|
||||||
@ -28,9 +32,7 @@
|
|||||||
{{ form_row(f) }}
|
{{ form_row(f) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
{{ form_widget(form.submit, { 'attr' : { 'class': 'sc-button bt-create change-icon' } } ) }}
|
{{ form_widget(form.submit, { 'attr' : { 'class': 'sc-button bt-create change-icon' } } ) }}
|
||||||
@ -39,4 +41,6 @@
|
|||||||
|
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -59,6 +59,19 @@ class SearchProvider
|
|||||||
|
|
||||||
return $this->searchServices;
|
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
|
* parse the search string to extract domain and terms
|
||||||
|
Loading…
x
Reference in New Issue
Block a user