Update to Drupal 8.0.5. For more information, see https://www.drupal.org/node/2679347
This commit is contained in:
parent
2a9f1f148d
commit
fd3b12cf27
251 changed files with 5439 additions and 957 deletions
|
@ -12,7 +12,7 @@
|
|||
*
|
||||
* Text search input: input.views-filter-text
|
||||
* Target table: input.views-filter-text[data-table]
|
||||
* Source text: .views-table-filter-text-source
|
||||
* Source text: [data-drupal-selector="views-table-filter-text-source"]
|
||||
*
|
||||
* @type {Drupal~behavior}
|
||||
*
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
function showViewRow(index, row) {
|
||||
var $row = $(row);
|
||||
var $sources = $row.find('.views-table-filter-text-source');
|
||||
var $sources = $row.find('[data-drupal-selector="views-table-filter-text-source"]');
|
||||
var textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
|
||||
$row.closest('tr').toggle(textMatch);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
|
||||
namespace Drupal\views_ui\ParamConverter;
|
||||
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\ParamConverter\EntityConverter;
|
||||
use Drupal\Core\ParamConverter\AdminPathConfigEntityConverter;
|
||||
use Drupal\Core\Routing\AdminContext;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Drupal\Core\ParamConverter\ParamConverterInterface;
|
||||
use Drupal\user\SharedTempStoreFactory;
|
||||
|
@ -30,7 +32,7 @@ use Drupal\views_ui\ViewUI;
|
|||
* Views UI and loaded from the views temp store, but it will not touch the
|
||||
* value for {bar}.
|
||||
*/
|
||||
class ViewUIConverter extends EntityConverter implements ParamConverterInterface {
|
||||
class ViewUIConverter extends AdminPathConfigEntityConverter implements ParamConverterInterface {
|
||||
|
||||
/**
|
||||
* Stores the tempstore factory.
|
||||
|
@ -47,8 +49,18 @@ class ViewUIConverter extends EntityConverter implements ParamConverterInterface
|
|||
* @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
|
||||
* The factory for the temp store object.
|
||||
*/
|
||||
public function __construct(EntityManagerInterface $entity_manager, SharedTempStoreFactory $temp_store_factory) {
|
||||
parent::__construct($entity_manager);
|
||||
public function __construct(EntityManagerInterface $entity_manager, SharedTempStoreFactory $temp_store_factory, ConfigFactoryInterface $config_factory = NULL, AdminContext $admin_context = NULL) {
|
||||
// The config factory and admin context are new arguments due to changing
|
||||
// the parent. Avoid an error on updated sites by falling back to getting
|
||||
// them from the container.
|
||||
// @todo Remove in 8.2.x in https://www.drupal.org/node/2674328.
|
||||
if (!$config_factory) {
|
||||
$config_factory = \Drupal::configFactory();
|
||||
}
|
||||
if (!$admin_context) {
|
||||
$admin_context = \Drupal::service('router.admin_context');
|
||||
}
|
||||
parent::__construct($entity_manager, $config_factory, $admin_context);
|
||||
|
||||
$this->tempStoreFactory = $temp_store_factory;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,9 @@ class HandlerTest extends UITestBase {
|
|||
/**
|
||||
* Overrides \Drupal\views\Tests\ViewTestBase::viewsData().
|
||||
*
|
||||
* Adds a relationship for the uid column.
|
||||
* Adds:
|
||||
* - a relationship for the uid column.
|
||||
* - a dummy field with no help text.
|
||||
*/
|
||||
protected function viewsData() {
|
||||
$data = parent::viewsData();
|
||||
|
@ -79,6 +81,12 @@ class HandlerTest extends UITestBase {
|
|||
)
|
||||
);
|
||||
|
||||
// Create a dummy field with no help text.
|
||||
$data['views_test_data']['no_help'] = $data['views_test_data']['name'];
|
||||
$data['views_test_data']['no_help']['field']['title'] = t('No help');
|
||||
$data['views_test_data']['no_help']['field']['real field'] = 'name';
|
||||
unset($data['views_test_data']['no_help']['help']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -246,6 +254,23 @@ class HandlerTest extends UITestBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that no missing help text is shown.
|
||||
*
|
||||
* @see \Drupal\views\EntityViewsData
|
||||
*/
|
||||
public function testErrorMissingHelp() {
|
||||
// Test that the error message is not shown for entity fields but an empty
|
||||
// description field is shown instead.
|
||||
$this->drupalGet('admin/structure/views/nojs/add-handler/test_node_view/default/field');
|
||||
$this->assertNoText('Error: missing help');
|
||||
$this->assertRaw('<td class="description"></td>', 'Empty description found');
|
||||
|
||||
// Test that no error message is shown for other fields.
|
||||
$this->drupalGet('admin/structure/views/nojs/add-handler/test_view_empty/default/field');
|
||||
$this->assertNoText('Error: missing help');
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that fields only appear once.
|
||||
*
|
||||
|
|
|
@ -21,7 +21,7 @@ class PreviewTest extends UITestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = array('test_preview', 'test_preview_error', 'test_pager_full', 'test_mini_pager');
|
||||
public static $testViews = array('test_preview', 'test_preview_error', 'test_pager_full', 'test_mini_pager', 'test_click_sort');
|
||||
|
||||
/**
|
||||
* Tests contextual links in the preview form.
|
||||
|
@ -270,6 +270,32 @@ class PreviewTest extends UITestBase {
|
|||
$this->assertText('Unable to preview due to validation errors.', 'Preview error text found.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the link to sort in the preview form.
|
||||
*/
|
||||
public function testPreviewSortLink() {
|
||||
|
||||
// Get the preview.
|
||||
$this->getPreviewAJAX('test_click_sort', 'page_1', 0);
|
||||
|
||||
// Test that the header label is present.
|
||||
$elements = $this->xpath('//th[contains(@class, :class)]/a', array(':class' => 'views-field views-field-name'));
|
||||
$this->assertTrue(!empty($elements), 'The header label is present.');
|
||||
|
||||
// Verify link.
|
||||
$this->assertLinkByHref('preview/page_1?_wrapper_format=drupal_ajax&order=name&sort=desc', 0, 'The output URL is as expected.');
|
||||
|
||||
// Click link to sort.
|
||||
$this->clickPreviewLinkAJAX($elements[0]['href'], 0);
|
||||
|
||||
// Test that the header label is present.
|
||||
$elements = $this->xpath('//th[contains(@class, :class)]/a', array(':class' => 'views-field views-field-name is-active'));
|
||||
$this->assertTrue(!empty($elements), 'The header label is present.');
|
||||
|
||||
// Verify link.
|
||||
$this->assertLinkByHref('preview/page_1?_wrapper_format=drupal_ajax&order=name&sort=asc', 0, 'The output URL is as expected.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the preview form and force an AJAX preview update.
|
||||
*
|
||||
|
|
89
core/modules/views_ui/src/Tests/TranslatedViewTest.php
Normal file
89
core/modules/views_ui/src/Tests/TranslatedViewTest.php
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\views_ui\Tests\TranslatedStringTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\views_ui\Tests;
|
||||
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
* Tests that translated strings in views UI don't override original strings.
|
||||
*
|
||||
* @group views_ui
|
||||
*/
|
||||
class TranslatedViewTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = [
|
||||
'config_translation',
|
||||
'views_ui',
|
||||
];
|
||||
|
||||
/**
|
||||
* Languages to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $langcodes = [
|
||||
'fr',
|
||||
];
|
||||
|
||||
/**
|
||||
* Administrator user for tests.
|
||||
*
|
||||
* @var \Drupal\user\UserInterface
|
||||
*/
|
||||
protected $adminUser;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$permissions = [
|
||||
'administer site configuration',
|
||||
'administer views',
|
||||
'translate configuration',
|
||||
'translate interface',
|
||||
];
|
||||
|
||||
// Create and login user.
|
||||
$this->adminUser = $this->drupalCreateUser($permissions);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Add languages.
|
||||
foreach ($this->langcodes as $langcode) {
|
||||
ConfigurableLanguage::createFromLangcode($langcode)->save();
|
||||
}
|
||||
$this->resetAll();
|
||||
$this->rebuildContainer();
|
||||
}
|
||||
|
||||
public function testTranslatedStrings() {
|
||||
$translation_url = 'admin/structure/views/view/files/translate/fr/add';
|
||||
$edit_url = 'admin/structure/views/view/files';
|
||||
|
||||
// Check origial string.
|
||||
$this->drupalGet($edit_url);
|
||||
$this->assertTitle('Files (File) | Drupal');
|
||||
|
||||
// Translate the label of the view.
|
||||
$this->drupalGet($translation_url);
|
||||
$edit = [
|
||||
'translation[config_names][views.view.files][label]' => 'Fichiers',
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save translation'));
|
||||
|
||||
// Check if the label is translated.
|
||||
$this->drupalGet($edit_url, ['language' => \Drupal::languageManager()->getLanguage('fr')]);
|
||||
$this->assertTitle('Files (File) | Drupal');
|
||||
$this->assertNoText('Fichiers');
|
||||
}
|
||||
|
||||
}
|
|
@ -93,6 +93,19 @@ class ViewEditTest extends UITestBase {
|
|||
// Test that the display ID has not been changed.
|
||||
$this->drupalGet('admin/structure/views/view/test_view/edit/test_1');
|
||||
$this->assertLink(t('test_1'));
|
||||
|
||||
// Test that validation does not run on cancel.
|
||||
$this->drupalGet('admin/structure/views/view/test_view');
|
||||
// Delete the field to cause an error on save.
|
||||
$fields = [];
|
||||
$fields['fields[age][removed]'] = 1;
|
||||
$fields['fields[id][removed]'] = 1;
|
||||
$fields['fields[name][removed]'] = 1;
|
||||
$this->drupalPostForm('admin/structure/views/nojs/rearrange/test_view/default/field', $fields, t('Apply'));
|
||||
$this->drupalPostForm(NULL, array(), 'Save');
|
||||
$this->drupalPostForm(NULL, array(), t('Cancel'));
|
||||
$this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed.');
|
||||
$this->assertUrl('admin/structure/views', array(), 'Redirected back to the view listing page..');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -227,6 +227,7 @@ class ViewEditForm extends ViewFormBase {
|
|||
'#type' => 'submit',
|
||||
'#value' => $this->t('Cancel'),
|
||||
'#submit' => array('::cancel'),
|
||||
'#limit_validation_errors' => array(),
|
||||
);
|
||||
if ($this->entity->isLocked()) {
|
||||
$actions['submit']['#access'] = FALSE;
|
||||
|
|
|
@ -103,9 +103,14 @@ class ViewListBuilder extends ConfigEntityListBuilder {
|
|||
'data' => array(
|
||||
'#plain_text' => $view->get('description'),
|
||||
),
|
||||
'class' => array('views-table-filter-text-source'),
|
||||
'data-drupal-selector' => 'views-table-filter-text-source',
|
||||
),
|
||||
'tag' => array(
|
||||
'data' => array(
|
||||
'#plain_text' => $view->get('tag'),
|
||||
),
|
||||
'data-drupal-selector' => 'views-table-filter-text-source',
|
||||
),
|
||||
'tag' => $view->get('tag'),
|
||||
'path' => array(
|
||||
'data' => array(
|
||||
'#theme' => 'item_list',
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
<h3 class="views-ui-view-title views-table-filter-text-source">{{ view.label }}</h3>
|
||||
<h3 class="views-ui-view-title" data-drupal-selector="views-table-filter-text-source">{{ view.label }}</h3>
|
||||
<div class="views-ui-view-displays">
|
||||
{% if displays %}
|
||||
{% trans %}
|
||||
|
@ -24,5 +24,5 @@
|
|||
</div>
|
||||
<div class="views-ui-view-machine-name">
|
||||
{{ 'Machine name:'|t }}
|
||||
<span class="views-table-filter-text-source">{{ view.id }}</span>
|
||||
<span data-drupal-selector="views-table-filter-text-source">{{ view.id }}</span>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
services:
|
||||
paramconverter.views_ui:
|
||||
class: Drupal\views_ui\ParamConverter\ViewUIConverter
|
||||
arguments: ['@entity.manager', '@user.shared_tempstore']
|
||||
arguments: ['@entity.manager', '@user.shared_tempstore', '@config.factory', '@router.admin_context']
|
||||
tags:
|
||||
- { name: paramconverter, priority: 10 }
|
||||
lazy: true
|
||||
|
|
Reference in a new issue