Skip to content
Snippets Groups Projects
Unverified Commit b57729b9 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #2817081 by nod_, Baysaa, rensingh99, AndyF, amoebanath, alexpott,...

Issue #2817081 by nod_, Baysaa, rensingh99, AndyF, amoebanath, alexpott, lauriii, andrewmacpherson: Show 'Edit summary' links on multi-value long text field with summary
parent 4313e7f4
Branches
Tags
13 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1896Issue #2940605: Can only intentionally re-render an entity with references 20 times,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!512Issue #3207771: Menu UI node type form documentation points to non-existent function,!485Sets the autocomplete attribute for username/password input field on login form.,!449Issue #2784233: Allow multiple vocabularies in the taxonomy filter,!231Issue #2671162: summary text wysiwyg patch working fine on 9.2.0-dev,!43Resolve #3173180: Add UI for 'loading' html attribute to images,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\text\FunctionalJavascript;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
......@@ -72,6 +73,13 @@ public function testTextSummaryBehavior() {
$this->assertSummaryToggle();
// Repeat test with unlimited cardinality field.
$body_field_storage = FieldStorageConfig::loadByName('node', 'body');
$body_field_storage->setCardinality(-1);
$body_field_storage->save();
$this->assertSummaryToggle();
// Test summary is shown when non-empty.
$node = $this->createNode([
'body' => [
......
......@@ -28,6 +28,17 @@
$fullLabel = $('<label></label>').prependTo($full);
}
// To ensure the summary toggle is shown in case the label is hidden
// (in multivalue fields in particular), show the label but hide
// the original text of the label.
if ($fullLabel.hasClass('visually-hidden')) {
$fullLabel.html(
(index, oldHtml) =>
`<span class="visually-hidden">${oldHtml}</span>`,
);
$fullLabel.removeClass('visually-hidden');
}
// Set up the edit/hide summary link.
const $link = $(
`<span class="field-edit-link"> (<button type="button" class="link link-edit-summary">${Drupal.t(
......
......@@ -19,6 +19,13 @@
$fullLabel = $('<label></label>').prependTo($full);
}
if ($fullLabel.hasClass('visually-hidden')) {
$fullLabel.html(function (index, oldHtml) {
return "<span class=\"visually-hidden\">".concat(oldHtml, "</span>");
});
$fullLabel.removeClass('visually-hidden');
}
var $link = $("<span class=\"field-edit-link\"> (<button type=\"button\" class=\"link link-edit-summary\">".concat(Drupal.t('Hide summary'), "</button>)</span>"));
var $button = $link.find('button');
var toggleClick = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment