Problem/Motivation

Steps to reproduce:
1) open admin/structure/views/view/user_admin_people
2) scroll down to "Preview" area
3) hover over title and content - no contextual menu appears, but checking markup there's a links

Proposed resolution

Make sure contextual links works in view preview

Remaining tasks

User interface changes

API changes

Data model changes

Files: 

Comments

finnsky’s picture

FileSize
2.78 KB
FAILED: [[SimpleTest]]: [PHP 5.5 MySQL] 100,845 pass(es), 3 fail(s), and 0 exception(s). View

Hello world! Looks like HTML was wrong, I compared it with frontpage view with contextual links. Now it's has same HTML. Also should be added 'data-contextual-id' attribute.

andypost’s picture

Status: Active » Needs review
andypost’s picture

+++ b/core/modules/views_ui/templates/views-ui-container.html.twig
@@ -4,7 +4,6 @@
- * - attributes: HTML attributes to apply to the container element.

@@ -12,4 +11,4 @@
-<div{{ attributes }}>{{ children }}</div>
+<div class="contextual-region">{{ children }}</div>

+++ b/core/modules/views_ui/templates/views-ui-view-preview-section.html.twig
@@ -7,6 +7,7 @@
+ * - attributes: HTML attributes to apply to the container element.

@@ -15,6 +16,6 @@
-  <div class="contextual">{{ links }}</div>
+  <div {{ attributes }}>{{ links }}</div>

+++ b/core/modules/views_ui/views_ui.module
@@ -137,7 +137,6 @@ function views_ui_preprocess_views_view(&$variables) {
-          '#attributes' => array('class' => array('contextual-region')),

wtf with attributes?
they should be added dynamically if contextual module enabled

Status: Needs review » Needs work

The last submitted patch, 1: 2539664.patch, failed testing.

lauriii’s picture

  1. +++ b/core/modules/views_ui/templates/views-ui-container.html.twig
    @@ -12,4 +11,4 @@
    +<div class="contextual-region">{{ children }}</div>
    

    Attributes variable should be still printed. You can use attributes.addClass() to add classes.

  2. +++ b/core/modules/views_ui/templates/views-ui-view-preview-section.html.twig
    @@ -15,6 +16,6 @@
    +  <div {{ attributes }}>{{ links }}</div>
    

    When attributes variable is being used, no additional space is needed before it

finnsky’s picture

FileSize
1.66 KB

hello all! Template fixes added. Buttons appear. We still need to set correct data-contextual-id attribute here: core\modules\views_ui\views_ui.theme.inc:513.

finnsky’s picture

Also I found that in default template parent .contextual-region class not added. This should be reason of JS error
Uncaught TypeError: Cannot read property 'top' of undefined contextual.js?v=8.0.0-dev:116

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.