Something really weird is going on. Devel's Switch User block contains a list of links with usernames. Some of these usernames are formatted in the % style, i.e. with <em class="placeholder">. This works fine in the normal block, but not in the Dashboard!

In the Dashboard, the same HTML is sent, but the <em> tag (including the username inside!) is removed, presumably by some JavaScript. When I look at this in Firebug, then the <a> tag is empty!

The HTML looks like this (reformatted for readability):

<ul class="links">
  <li class="1 first">
    <a href="/devel/switch/Sysadmin?destination=admin/dashboard" title="This user can switch back.">
      <em class="placeholder">Sysadmin</em>
    </a>
  </li>
  <li class="32">
    <a href="/devel/switch/Webmaster?destination=admin/dashboard" title="This user can switch back.">
      <em class="placeholder">Webmaster</em>
    </a>
  </li>
  <li class="30">
    <a href="/devel/switch/Account?destination=admin/dashboard" title="Caution: this user will be unable to switch back.">Account</a>
  </li>
  <li class="33 last">
    <a href="/devel/switch?destination=admin/dashboard" title="Caution: the anonymous user will be unable to switch back.">Anonymous</a>
  </li>
</ul>

I see that the 'placeholder' class has some special use in dashboard.js, but this conflicts with established usage.

Dashboard.module should probably use 'dashboard-placeholder' instead.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

asimmonds’s picture

Status: Active » Needs review
FileSize
1022 bytes

I thought I had already opened a issue on this a while back, apparently not..

I changed the placeholder usage to block-placeholder, as that is what is used in dashboard.css. Please try the attached patch.

salvis’s picture

The patch fixes my issue. It looks reasonable but I don't know jQuery well enough to really understand what it does.

The 'block-placeholder' class was already mentioned in the setupDrawer() function before this patch, so the patch probably has other effects besides avoiding the conflict with the pre-existing 'placeholder' class. Someone else needs to check whether that is correct.

sun.core’s picture

Priority: Major » Normal

Quite an edge-case. Can and should be fixed, but doesn't qualify as major.

stevector’s picture

This bug also affects usage of t() with %variable. It was reported again because Views uses t() in that manner in views_handler_field_date.inc

#1141562: Dashboard removes markup generated by t()

Because t() is such a common function is it appropriate to escalate the priority of this issue?

fredcy’s picture

This bug also affects views_watchdog which formats watchdog.message and watchdog.variables using the t() function and generates HTML with 'placeholder' class values.

jmking’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

I don't know about you guys, but I'm getting pretty tired of applying this patch on every core update. ;)

I think we have enough people here confirming this patch works correctly to mark this as RTBC

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
18.31 KB
18.52 KB

I tested this patch and it messes up the styling in the case where the dashboard has an empty region (see attached screenshots).

Seems like this would need to be fixed with a new class (such as "dashboard-placeholder" which was originally suggested in this issue) rather than switching to an existing class that already has a different purpose.

jmking’s picture

Status: Needs work » Needs review
FileSize
867 bytes

Nice catch, David_Rothstein

Here's a new patch with the approach proposed by the OP instead.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

I tested #8. It corrects the issue that David_Rothstein shows in #7. Empty regions in the dashboard now have the class .dashboard-placeholder.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: drupal-dashboard_placeholder-908822-8.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: drupal-dashboard_placeholder-908822-8.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: drupal-dashboard_placeholder-908822-8.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: drupal-dashboard_placeholder-908822-8.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: drupal-dashboard_placeholder-908822-8.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: drupal-dashboard_placeholder-908822-8.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

  • David_Rothstein committed a6d70dd on 7.x
    Issue #908822 by jmking, asimmonds | salvis: Fixed Dashboard discards...
David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x - thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.