diff -u b/src/DiffLayoutBase.php b/src/DiffLayoutBase.php --- b/src/DiffLayoutBase.php +++ b/src/DiffLayoutBase.php @@ -103,6 +103,7 @@ */ protected function buildRevisionLink(EntityInterface $revision) { $entity_type_id = $revision->getEntityTypeId(); + if ($revision instanceof EntityRevisionLogInterface || $revision instanceof NodeInterface) { $revision_log = ''; @@ -112,15 +113,34 @@ elseif ($revision instanceof NodeInterface) { $revision_log = $revision->revision_log->value; } - $revision_date = $this->date->format($revision->getRevisionCreationTime(), 'short'); + //Creating author URL. + $user_id = $revision->getRevisionUserId(); $revision_author = $revision->getRevisionUser(); + $revision_author_url = $this->t('@author', [ + '@author' => Link::fromTextAndUrl($revision_author->getDisplayName(), Url::fromUri(\Drupal::request()->getUriForPath('/user/' . $user_id)))->toString(), + ]); + //Creating revision date URL. $route_name = $entity_type_id != 'node' ? "entity.$entity_type_id.revisions_diff" : 'entity.node.revision'; - $revision_link = $this->t('@date' . ' - ' . $revision_author->getDisplayName() . ' - ' . $revision_log, [ + $revision_date = $this->date->format($revision->getRevisionCreationTime(), 'short'); + $revision_date_url = $this->t('@date', [ '@date' => Link::fromTextAndUrl($revision_date, Url::fromRoute($route_name, [ $entity_type_id => $revision->id(), $entity_type_id . '_revision' => $revision->getRevisionId(), - ]))->toString(), + ]))->toString(), ]); + + $revision_link = ' +
+
'; + $revision_link.=$revision_date_url; + $revision_link.='
+
'; + $revision_link.=$revision_author_url; + $revision_link.='
+
'; + $revision_link.=$revision_log; + $revision_link.='
+
'; } else { $revision_link = Link::fromTextAndUrl($revision->label(), $revision->toUrl('revision'))->toString(); diff -u b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php --- b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php +++ b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php @@ -209,13 +209,13 @@ '#type' => 'table', '#header' => $diff_header, '#rows' => $diff_rows, + '#weight' => 10, '#empty' => $this->t('No visible changes'), '#attributes' => [ 'class' => ['diff'], '#type' => 'table', '#header' => $diff_header, '#rows' => $diff_rows, - '#weight' => 10, '#empty' => $this->t('No visible changes'), '#attributes' => [ 'class' => ['diff'], diff -u b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php --- b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php +++ b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php @@ -174,7 +174,6 @@ ]; $build['diff_revisions'][] = [ '#markup' => $this->buildRevisionLink($left_revision), - '#suffix' => '
', ]; $build['diff_revisions'][] = [ '#markup' => $this->buildRevisionLink($right_revision), diff -u b/src/Tests/DiffRevisionTest.php b/src/Tests/DiffRevisionTest.php --- b/src/Tests/DiffRevisionTest.php +++ b/src/Tests/DiffRevisionTest.php @@ -95,7 +95,8 @@ $diff_row = $rows[1]->td; $comment = $head[0]->th[1]; // Assert the revision comment. - $this->assertEqual((string) $comment, ' - ' . $this->loggedInUser->getDisplayName() . ' - Revision 2 comment'); + $this->assertEqual((string) $comment, ' + '); // Assert changes made to the body, text 1 changed to 2. $this->assertEqual((string) ($diff_row[0]), '1'); $this->assertEqual((string) ($diff_row[1]), '-'); only in patch2: unchanged: --- a/css/diff.general.css +++ b/css/diff.general.css @@ -20,3 +20,37 @@ display: inline-table; padding: 0 1em 0 0; } +.comparation-flex-container { + display: flex; + -webkit-flex-flow: row wrap; + flex-flow: row wrap; + justify-content: flex-start; + width: 50%; +} +.comparation-flex-item-date { + flex-basis: auto; + min-width: 0; +} +.comparation-flex-item-author { + flex-basis: 30%; + padding-left: 1.5em; + min-width: 15%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + text-align: center; +} +.comparation-flex-item-message { + flex-basis: 40%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + min-width: 15%; + padding-left: 20px; + padding-bottom: 5px; +} +@media screen and (min-width: 300px) and (max-width: 920px) { + .comparation-flex-container { + width: 80%; + } +} only in patch2: unchanged: --- a/src/Form/RevisionOverviewForm.php +++ b/src/Form/RevisionOverviewForm.php @@ -244,7 +244,7 @@ class RevisionOverviewForm extends FormBase { $links['revert'] = [ 'title' => $this->t('Revert'), 'url' => $has_translations ? - Url::fromRoute('node.revision_revert_translation_confirm', ['node' => $node->id(), 'node_revision' => $vid, 'langcode' => $langcode]) : + Url::fromRoute('c', ['node' => $node->id(), 'node_revision' => $vid, 'langcode' => $langcode]) : Url::fromRoute('node.revision_revert_confirm', ['node' => $node->id(), 'node_revision' => $vid]), ]; }