Commit c661eb28 authored by StryKaizer's avatar StryKaizer Committed by borisson_

Issue #2712511 by StryKaizer: Change admin controller routing for better site builder UX

parent e45dc7f7
......@@ -225,10 +225,10 @@ class IntegrationTest extends WebTestBase {
*/
protected function setShowAmountOfResults($facet_id, $show = TRUE) {
$facet_display_page = '/admin/config/search/facets/' . $facet_id . '/display';
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
// Go to the facet edit page and make sure "edit facet %facet" is present.
$this->drupalGet($facet_display_page);
$this->drupalGet($facet_edit_page);
$this->assertResponse(200);
// Configure the text for empty results behavior.
......@@ -289,10 +289,10 @@ class IntegrationTest extends WebTestBase {
protected function setEmptyBehaviorFacetText($facet_name) {
$facet_id = $this->convertNameToMachineName($facet_name);
$facet_display_page = '/admin/config/search/facets/' . $facet_id . '/display';
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
// Go to the facet edit page and make sure "edit facet %facet" is present.
$this->drupalGet($facet_display_page);
$this->drupalGet($facet_edit_page);
$this->assertResponse(200);
// Configure the text for empty results behavior.
......@@ -312,8 +312,8 @@ class IntegrationTest extends WebTestBase {
protected function setOptionShowOnlyWhenFacetSourceVisible($facet_name) {
$facet_id = $this->convertNameToMachineName($facet_name);
$facet_display_page = '/admin/config/search/facets/' . $facet_id . '/display';
$this->drupalGet($facet_display_page);
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
$this->drupalGet($facet_edit_page);
$this->assertResponse(200);
$edit = [
......@@ -388,7 +388,7 @@ class IntegrationTest extends WebTestBase {
// Make sure that the redirection to the display page is correct.
$this->assertRaw(t('Facet %name has been created.', ['%name' => $facet_name]));
$this->assertUrl('admin/config/search/facets/' . $facet_id . '/display');
$this->assertUrl('admin/config/search/facets/' . $facet_id . '/edit');
$this->drupalGet('admin/config/search/facets');
}
......@@ -402,12 +402,12 @@ class IntegrationTest extends WebTestBase {
* The name of the facet.
*/
public function editFacetCheck($facet_id, $facet_name) {
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/settings';
// Go to the facet edit page and make sure "edit facet %facet" is present.
$this->drupalGet($facet_edit_page);
$this->assertResponse(200);
$this->assertRaw($this->t('Edit facet @facet', ['@facet' => $facet_name]));
$this->assertRaw($this->t('Facet settings for @facet facet', ['@facet' => $facet_name]));
// Change the facet name to add in "-2" to test editing of a facet works.
$form_values = ['name' => $facet_name . ' - 2'];
......@@ -419,7 +419,7 @@ class IntegrationTest extends WebTestBase {
// Make sure the "-2" suffix is still on the facet when editing a facet.
$this->drupalGet($facet_edit_page);
$this->assertRaw($this->t('Edit facet @facet', ['@facet' => $facet_name . ' - 2']));
$this->assertRaw($this->t('Facet settings for @facet facet', ['@facet' => $facet_name . ' - 2']));
// Edit the form and change the facet's name back to the initial name.
$form_values = ['name' => $facet_name];
......
entity.facets_facet.display_form:
title: 'Configure facet display'
route_name: 'entity.facets_facet.display_form'
group: facets_facet
\ No newline at end of file
entity.facets_facet.edit_form:
title: 'Edit facet'
route_name: 'entity.facets_facet.edit_form'
group: facets_facet
......@@ -2,7 +2,8 @@ entity.facets_facet.edit_form:
title: 'Edit'
route_name: entity.facets_facet.edit_form
base_route: entity.facets_facet.edit_form
entity.facets_facet.display:
title: 'Display'
route_name: entity.facets_facet.display_form
base_route: entity.facets_facet.edit_form
\ No newline at end of file
entity.facets_facet.settings_form:
title: 'Facet settings'
route_name: entity.facets_facet.settings_form
base_route: entity.facets_facet.edit_form
......@@ -35,10 +35,10 @@ entity.facets_facet.delete_form:
requirements:
_entity_access: 'facets_facet.delete'
entity.facets_facet.display_form:
path: '/admin/config/search/facets/{facets_facet}/display'
entity.facets_facet.settings_form:
path: '/admin/config/search/facets/{facets_facet}/settings'
defaults:
_entity_form: 'facets_facet.display'
_entity_form: 'facets_facet.settings'
requirements:
_entity_access: 'facets_facet.edit'
......
......@@ -15,9 +15,9 @@ use Drupal\facets\FacetInterface;
* "storage" = "Drupal\Core\Config\Entity\ConfigEntityStorage",
* "list_builder" = "Drupal\facets\FacetListBuilder",
* "form" = {
* "default" = "Drupal\facets\Form\FacetForm",
* "default" = "Drupal\facets\Form\FacetSettingsForm",
* "edit" = "Drupal\facets\Form\FacetForm",
* "display" = "Drupal\facets\Form\FacetDisplayForm",
* "settings" = "Drupal\facets\Form\FacetSettingsForm",
* "delete" = "Drupal\facets\Form\FacetDeleteConfirmForm",
* },
* },
......@@ -52,7 +52,7 @@ use Drupal\facets\FacetInterface;
* "canonical" = "/admin/config/search/facets",
* "add-form" = "/admin/config/search/facets/add-facet",
* "edit-form" = "/admin/config/search/facets/{facets_facet}/edit",
* "display-form" = "/admin/config/search/facets/{facets_facet}/display",
* "settings-form" = "/admin/config/search/facets/{facets_facet}/settings",
* "delete-form" = "/admin/config/search/facets/{facets_facet}/delete",
* }
* )
......
......@@ -36,11 +36,11 @@ class FacetListBuilder extends ConfigEntityListBuilder {
'url' => $entity->toUrl('edit-form'),
);
}
if ($entity->access('update') && $entity->hasLinkTemplate('display-form')) {
$operations['display'] = array(
'title' => $this->t('Display'),
if ($entity->access('update') && $entity->hasLinkTemplate('settings-form')) {
$operations['settings'] = array(
'title' => $this->t('Facet settings'),
'weight' => 20,
'url' => $entity->toUrl('display-form'),
'url' => $entity->toUrl('settings-form'),
);
}
if ($entity->access('delete') && $entity->hasLinkTemplate('delete-form')) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -182,20 +182,17 @@ class IntegrationTest extends WebTestBase {
// Add a new facet.
$this->addFacet($facet_name);
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/settings';
// Go to the facet edit page and make sure "edit facet %facet" is present.
$this->drupalGet($facet_edit_page);
$this->assertResponse(200);
$this->assertRaw($this->t('Edit facet @facet', ['@facet' => $facet_name]));
$this->assertRaw($this->t('Facet settings for @facet facet', ['@facet' => $facet_name]));
// Change the machine name to a new name and check that the redirected page
// is the correct url.
$form = ['id' => $new_facet_id];
$this->drupalPostForm($facet_edit_page, $form, $this->t('Save'));
$expected_url = '/admin/config/search/facets/' . $new_facet_id . '/edit';
$this->assertUrl($expected_url);
}
/**
......@@ -210,7 +207,6 @@ class IntegrationTest extends WebTestBase {
$facet_add_page = '/admin/config/search/facets/add-facet';
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
$facet_display_page = '/admin/config/search/facets/' . $facet_id . '/display';
$this->drupalGet($facet_add_page);
$this->assertResponse(200);
......@@ -236,7 +232,7 @@ class IntegrationTest extends WebTestBase {
$url = Url::fromUserInput('/search-api-test-fulltext', ['query' => ['f[0]' => 'ab_facet:item']]);
$this->assertUrl($url);
$this->drupalGet($facet_display_page);
$this->drupalGet($facet_edit_page);
$this->drupalPostForm(NULL, ['facet_settings[url_alias]' => 'llama'], $this->t('Save'));
$this->drupalGet('search-api-test-fulltext');
......@@ -336,7 +332,7 @@ class IntegrationTest extends WebTestBase {
public function testAndOrFacet() {
$facet_name = 'test & facet';
$facet_id = 'test_facet';
$facet_edit_page = 'admin/config/search/facets/' . $facet_id . '/display';
$facet_edit_page = 'admin/config/search/facets/' . $facet_id . '/edit';
$this->drupalLogin($this->adminUser);
$this->addFacet($facet_name);
......@@ -412,7 +408,7 @@ class IntegrationTest extends WebTestBase {
public function testExcludeFacet() {
$facet_name = 'test & facet';
$facet_id = 'test_facet';
$facet_edit_page = 'admin/config/search/facets/' . $facet_id . '/display';
$facet_edit_page = 'admin/config/search/facets/' . $facet_id . '/edit';
$this->addFacet($facet_name);
$this->createFacetBlock($facet_id);
......@@ -463,7 +459,7 @@ class IntegrationTest extends WebTestBase {
$this->addFacet($facet_name, 'keywords');
$this->createFacetBlock($facet_id);
$this->drupalGet($facet_edit_page . '/display');
$this->drupalGet($facet_edit_page . '/edit');
$edit = ['facet_settings[show_only_one_result]' => TRUE];
$this->drupalPostForm(NULL, $edit, $this->t('Save'));
......@@ -554,7 +550,7 @@ class IntegrationTest extends WebTestBase {
protected function setEmptyBehaviorFacetText($facet_name) {
$facet_id = $this->convertNameToMachineName($facet_name);
$facet_display_page = '/admin/config/search/facets/' . $facet_id . '/display';
$facet_display_page = '/admin/config/search/facets/' . $facet_id . '/edit';
// Go to the facet edit page and make sure "edit facet %facet" is present.
$this->drupalGet($facet_display_page);
......@@ -578,8 +574,8 @@ class IntegrationTest extends WebTestBase {
protected function setOptionShowOnlyWhenFacetSourceVisible($facet_name) {
$facet_id = $this->convertNameToMachineName($facet_name);
$facet_display_page = '/admin/config/search/facets/' . $facet_id . '/display';
$this->drupalGet($facet_display_page);
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
$this->drupalGet($facet_edit_page);
$this->assertResponse(200);
$edit = [
......@@ -657,7 +653,7 @@ class IntegrationTest extends WebTestBase {
// Make sure that the redirection to the display page is correct.
$this->assertRaw(t('Facet %name has been created.', ['%name' => $facet_name]));
$this->assertUrl('admin/config/search/facets/' . $facet_id . '/display');
$this->assertUrl('admin/config/search/facets/' . $facet_id . '/edit');
$this->drupalGet('admin/config/search/facets');
}
......@@ -704,12 +700,12 @@ class IntegrationTest extends WebTestBase {
protected function editFacet($facet_name) {
$facet_id = $this->convertNameToMachineName($facet_name);
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/settings';
// Go to the facet edit page and make sure "edit facet %facet" is present.
$this->drupalGet($facet_edit_page);
$this->assertResponse(200);
$this->assertRaw($this->t('Edit facet @facet', ['@facet' => $facet_name]));
$this->assertRaw($this->t('Facet settings for @facet facet', ['@facet' => $facet_name]));
// Change the facet name to add in "-2" to test editing of a facet works.
$form_values = ['name' => $facet_name . ' - 2'];
......@@ -721,7 +717,7 @@ class IntegrationTest extends WebTestBase {
// Make sure the "-2" suffix is still on the facet when editing a facet.
$this->drupalGet($facet_edit_page);
$this->assertRaw($this->t('Edit facet @facet', ['@facet' => $facet_name . ' - 2']));
$this->assertRaw($this->t('Facet settings for @facet facet', ['@facet' => $facet_name . ' - 2']));
// Edit the form and change the facet's name back to the initial name.
$form_values = ['name' => $facet_name];
......
......@@ -43,7 +43,7 @@ class ProcessorIntegrationTest extends WebTestBase {
// Go to the processors form and check that the count limit processor is not
// checked.
$this->drupalGet('admin/config/search/facets/' . $facet_id . '/display');
$this->drupalGet('admin/config/search/facets/' . $facet_id . '/edit');
$this->assertNoFieldChecked('edit-facet-settings-count-limit-status');
$form = ['facet_settings[count_limit][status]' => TRUE];
......@@ -94,7 +94,7 @@ class ProcessorIntegrationTest extends WebTestBase {
public function testProcessorIntegration() {
$facet_name = "Vicuña";
$facet_id = "vicuna";
$this->editForm = 'admin/config/search/facets/' . $facet_id . '/display';
$this->editForm = 'admin/config/search/facets/' . $facet_id . '/edit';
$this->createFacet($facet_name, $facet_id, 'keywords');
$this->createFacetBlock($facet_id);
......@@ -119,7 +119,7 @@ class ProcessorIntegrationTest extends WebTestBase {
public function testSortingWidgets() {
$facet_name = "Huacaya alpaca";
$facet_id = "huacaya_alpaca";
$this->editForm = 'admin/config/search/facets/' . $facet_id . '/display';
$this->editForm = 'admin/config/search/facets/' . $facet_id . '/edit';
$this->createFacet($facet_name, $facet_id, 'keywords');
$this->createFacetBlock($facet_id);
......
......@@ -232,7 +232,7 @@ class WidgetIntegrationTest extends WebTestBase {
$id = 'links_widget';
$name = '>.Facet &* Links';
$facet_add_page = 'admin/config/search/facets/add-facet';
$facet_edit_page = 'admin/config/search/facets/' . $id . '/display';
$facet_edit_page = 'admin/config/search/facets/' . $id . '/edit';
$this->drupalGet($facet_add_page);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment