diff --git a/composer.json b/composer.json
index 22f2bc0a9d..e404a26d6a 100644
--- a/composer.json
+++ b/composer.json
@@ -24,9 +24,6 @@
"require-dev": {
"phpunit/phpunit": "^6.4"
},
- "require-dev": {
- "phpunit/phpunit": "^6.4"
- },
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
diff --git a/src/bundle/Controller/SearchController.php b/src/bundle/Controller/SearchController.php
new file mode 100644
index 0000000000..7c83f7d421
--- /dev/null
+++ b/src/bundle/Controller/SearchController.php
@@ -0,0 +1,107 @@
+searchService = $searchService;
+ $this->pagerContentToDataMapper = $pagerContentToDataMapper;
+ }
+
+ /**
+ * Renders the simple search form and search results.
+ *
+ * @param Request $request
+ *
+ * @return Response
+ */
+ public function searchAction(Request $request): Response
+ {
+ $limit = $request->query->getInt('limit', 10);
+ $page = $request->query->getInt('page', 1);
+ $query = $request->query->get('query');
+
+ $form = $this->createForm(SimpleSearchType::class, new SimpleSearchData($limit, $page, $query));
+
+ $form->handleRequest($request);
+
+ if ($form->isSubmitted() && $form->isValid()) {
+
+ /** @var SimpleSearchData $data */
+ $data = $form->getData();
+
+ $query = new Query();
+ $query->filter = new Criterion\LogicalAnd(
+ [
+ new Criterion\Visibility(Criterion\Visibility::VISIBLE),
+ new Criterion\FullText($data->getQuery()),
+ ]
+ );
+ $query->sortClauses[] = new SortClause\DateModified(Query::SORT_ASC);
+
+ $pagerfanta = new Pagerfanta(
+ new ContentSearchAdapter(
+ $query,
+ $this->searchService
+ )
+ );
+
+ $pagerfanta->setMaxPerPage($limit);
+ $pagerfanta->setCurrentPage($page);
+
+ $urlGenerator = $this->get('router');
+
+ $routeGenerator = function ($page) use ($urlGenerator, $data) {
+ return $urlGenerator->generate('ezplatform.search', [
+ 'page' => $page,
+ 'limit' => $data->getLimit(),
+ 'query' => $data->getQuery(),
+ ]);
+ };
+
+ $pagination = (new TwitterBootstrap4View())->render($pagerfanta, $routeGenerator);
+
+ return $this->render('@EzPlatformAdminUi/admin/search/list.html.twig', [
+ 'results' => $this->pagerContentToDataMapper->map($pagerfanta),
+ 'form' => $form->createView(),
+ 'pagination' => $pagination,
+ 'pagerfanta' => $pagerfanta,
+ ]);
+ }
+
+ return $this->render('@EzPlatformAdminUi/admin/search/search.html.twig', [
+ 'form' => $form->createView(),
+ ]);
+ }
+}
diff --git a/src/bundle/Resources/config/routing.yml b/src/bundle/Resources/config/routing.yml
index 0479aa80a2..76d474a11e 100644
--- a/src/bundle/Resources/config/routing.yml
+++ b/src/bundle/Resources/config/routing.yml
@@ -314,3 +314,9 @@ ezplatform.location.swap:
methods: ['POST']
defaults:
_controller: 'EzPlatformAdminUiBundle:Location:swap'
+
+ezplatform.search:
+ path: /search
+ methods: ['GET']
+ defaults:
+ _controller: 'EzPlatformAdminUiBundle:Search:search'
diff --git a/src/bundle/Resources/translations/dashboard.en.yml b/src/bundle/Resources/translations/dashboard.en.yml
index 6ad866b90a..df84c2f91f 100644
--- a/src/bundle/Resources/translations/dashboard.en.yml
+++ b/src/bundle/Resources/translations/dashboard.en.yml
@@ -8,6 +8,7 @@ navigation:
admin:
# Desc: Trash
trash: Trash
+ search: Search
tab:
name:
diff --git a/src/bundle/Resources/translations/search.en.xliff b/src/bundle/Resources/translations/search.en.xliff
new file mode 100644
index 0000000000..72e375327e
--- /dev/null
+++ b/src/bundle/Resources/translations/search.en.xliff
@@ -0,0 +1,96 @@
+
+
+
+
+
+ The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.
+
+
+
+
+ Search results (%total%)
+ key: search.header
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Search
+ key: search.headline
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/search.html.twig
+
+
+
+ search.list
+ key: search.list
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Modified
+ key: search.modified
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Name
+ key: search.name
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Sorry, no results were found for "%query%".
+ key: search.no_result
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ search.perform
+ key: search.perform
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/search.html.twig
+
+
+
+ Check spelling of keywords.
+ key: search.tips.check_spelling
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Try different keywords.
+ key: search.tips.different_keywords
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Try fewer keywords. Reducing keywords result in more matches.
+ key: search.tips.fewer_keywords
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Some helpful search tips:
+ key: search.tips.headline
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Try more general keywords.
+ key: search.tips.more_general_keywords
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Content Type
+ key: search.type
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+ Viewing %viewing% out of %total% sub-items
+ key: search.viewing
+ /../../../../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/admin/search/list.html.twig
+
+
+
+
diff --git a/src/bundle/Resources/views/admin/search/list.html.twig b/src/bundle/Resources/views/admin/search/list.html.twig
new file mode 100644
index 0000000000..616ab07ae1
--- /dev/null
+++ b/src/bundle/Resources/views/admin/search/list.html.twig
@@ -0,0 +1,79 @@
+{% extends "EzPlatformAdminUiBundle::layout.html.twig" %}
+
+{% trans_default_domain 'search' %}
+
+{% block pageTitle %}{% endblock %}
+
+{% block content %}
+
+
+
+ {% block sidebar %}
+ {{ parent() }}
+ {% endblock sidebar %}
+
+
+
+ {% include '@EzPlatformAdminUi/parts/page_title.html.twig' with { title: 'search.headline'|trans|desc('Search'), iconName: 'search' } %}
+
+ {% include '@EzPlatformAdminUi/admin/search/search_form.html.twig' with { form: form } %}
+
+
+
+ {% if results is empty %}
+
+
+
+ {{ 'search.no_result'|trans({'%query%': form.vars.value.query})|desc('Sorry, no results were found for "%query%".') }}
+ |
+
+
+
+
{{ 'search.tips.headline'|trans|desc('Some helpful search tips:') }}
+
+ - {{ 'search.tips.check_spelling'|trans|desc('Check spelling of keywords.') }}
+ - {{ 'search.tips.different_keywords'|trans|desc('Try different keywords.') }}
+ - {{ 'search.tips.more_general_keywords'|trans|desc('Try more general keywords.') }}
+ - {{ 'search.tips.fewer_keywords'|trans|desc('Try fewer keywords. Reducing keywords result in more matches.') }}
+
+
+ {% else %}
+
+
+
+ {{ 'search.name'|trans|desc('Name') }} |
+ {{ 'search.modified'|trans|desc('Modified') }} |
+ {{ 'search.type'|trans|desc('Content Type') }} |
+ |
+
+
+
+ {% for row in results %}
+ {% include '@EzPlatformAdminUi/admin/search/search_table_row.html.twig' with { row: row } %}
+ {% endfor %}
+
+
+
+
{{ 'search.viewing'|trans({'%viewing%': pagerfanta.currentPageResults|length, '%total%': pagerfanta.nbResults})|desc('Viewing %viewing% out of %total% sub-items') }}
+
+
+ {% if pagerfanta.haveToPaginate %}
+ {{ pagination|raw }}
+ {% endif %}
+
+ {% endif %}
+
+
+
+{% endblock %}
+
+{% block title %}{{ 'search.list'|trans }}{% endblock %}
+
+{% block javascripts %}
+ {% javascripts
+ 'bundles/ezplatformadminui/js/scripts/udw/browse.js' %}
+
+ {% endjavascripts %}
+{% endblock %}
diff --git a/src/bundle/Resources/views/admin/search/search.html.twig b/src/bundle/Resources/views/admin/search/search.html.twig
new file mode 100644
index 0000000000..368acd9d58
--- /dev/null
+++ b/src/bundle/Resources/views/admin/search/search.html.twig
@@ -0,0 +1,32 @@
+{% extends "EzPlatformAdminUiBundle::layout.html.twig" %}
+
+{% trans_default_domain 'search' %}
+
+{% block pageTitle %}{% endblock %}
+
+{% block content %}
+
+
+
+ {% block sidebar %}
+ {{ parent() }}
+ {% endblock sidebar %}
+
+
+
+ {% include '@EzPlatformAdminUi/parts/page_title.html.twig' with { title: 'search.headline'|trans|desc('Search'), iconName: 'search' } %}
+
+ {% include '@EzPlatformAdminUi/admin/search/search_form.html.twig' with { form: form } %}
+
+
+
+{% endblock %}
+
+{% block title %}{{ 'search.perform'|trans }}{% endblock %}
+
+{% block javascripts %}
+ {% javascripts
+ 'bundles/ezplatformadminui/js/scripts/udw/browse.js' %}
+
+ {% endjavascripts %}
+{% endblock %}
diff --git a/src/bundle/Resources/views/admin/search/search_form.html.twig b/src/bundle/Resources/views/admin/search/search_form.html.twig
new file mode 100644
index 0000000000..97c2900ae0
--- /dev/null
+++ b/src/bundle/Resources/views/admin/search/search_form.html.twig
@@ -0,0 +1,9 @@
+{{ form_start(form) }}
+
+ {{ form_widget(form.query, {'attr': {'style': 'width: 200px', 'class': 'form-control'} }) }}
+
+
+
+
+
+{{ form_end(form) }}
diff --git a/src/bundle/Resources/views/admin/search/search_table_row.html.twig b/src/bundle/Resources/views/admin/search/search_table_row.html.twig
new file mode 100644
index 0000000000..b0663d60e1
--- /dev/null
+++ b/src/bundle/Resources/views/admin/search/search_table_row.html.twig
@@ -0,0 +1,16 @@
+
+
+ {{ row.name }}
+ |
+ {{ row.modified|date('M d, Y h:iA') }} |
+ {{ row.type }} |
+
+
+ |
+
\ No newline at end of file
diff --git a/src/bundle/Resources/views/admin/trash/list.html.twig b/src/bundle/Resources/views/admin/trash/list.html.twig
index 44232c7db8..2081fd8f76 100644
--- a/src/bundle/Resources/views/admin/trash/list.html.twig
+++ b/src/bundle/Resources/views/admin/trash/list.html.twig
@@ -7,26 +7,11 @@
{% block content %}
-
+
+ {% block sidebar %}
+ {{ parent() }}
+ {% endblock sidebar %}
+
{% include '@EzPlatformAdminUi/parts/page_title.html.twig' with { title: 'trash.headline'|trans|desc('Trash'), iconName: 'trash' } %}
diff --git a/src/bundle/Resources/views/content/locationview.html.twig b/src/bundle/Resources/views/content/locationview.html.twig
index b9adaf9d25..00057ee77a 100644
--- a/src/bundle/Resources/views/content/locationview.html.twig
+++ b/src/bundle/Resources/views/content/locationview.html.twig
@@ -14,26 +14,11 @@
data-parent-content-type-identifier="{{ contentType.identifier }}"
data-parent-content-type-id="{{ contentType.id }}">
-
+
+ {% block sidebar %}
+ {{ parent() }}
+ {% endblock sidebar %}
+