civicrm / org.civicrm.shoreditch

Other
45 stars 59 forks source link

Contact images broken by contact-summary.js when using Drupal 'seven' theme. #374

Open michael-chaplin-gmcvo opened 5 years ago

michael-chaplin-gmcvo commented 5 years ago

CiviCRM 5.11.0 Shoreditch 0.1-alpha28 (required for Mosaico) Using 'Seven' as the CiviCRM admin theme. Contact images are briefly displayed on eg civicrm/contact/view?reset=1&cid=22437 contact-summary.js is still loaded from sites/default/files/civicrm/extensions/org.civicrm.shoreditch-0.1-alpha28/js/contact-summary.js?r=zQ7oF

It appears to move the contact image from < div id="crm-contact-thumbnail" > to further up the page where it is now invisible (probably because of CSS).

If the js is blocked the image shows in the correct postion.

Upperholme commented 5 years ago

I'm seeing this issue with 5.10.x (and earlier versions) using Adminimal as the CiviCRM theme. The contact-summary.js file is getting loaded even though I'm only using Shoreditch for Mosaico.

samuelsov commented 5 years ago

I confirm the problem. We are using adminimal as the CiviCRM theme and Shoreditch for Mosaico only.

Caused by https://github.com/civicrm/org.civicrm.shoreditch/issues/215

Upperholme commented 5 years ago

"If the js is blocked the image shows in the correct position." How might I achieve this?

michael-chaplin-gmcvo commented 5 years ago

In Chrome, inspect => network tab. Filter so that only JS shows in list. Reload page => now have list of JS resources Right click contact-summary.js and use 'Block request URL' Reload page (but contact-summary.js is blocked from loading)

jmcclelland commented 5 years ago

I just pushed a patch so that the contact summary javascript is only pulled in if the site is configured to use shoreditch throughout civicrm.

deepak-srivastava commented 4 years ago

Similar problem with us. Images don't appear at all.

If we block the js/contact-summary.js file from loading OR comment out the code in the js file, image gets displayed fine.

image

image

Site Info: Drupal 8 CiviCRM 5.27.4 org.civicrm.shoreditch 1.0.0-beta.1

jitendrapurohit commented 3 years ago

Can replicate the same error on

Drupal 9.2.6 CiviCRM 5.41.1 shoreditch 1.0.0-beta.9

The reason seems to be the body class missing from D8 CiviCRM, eg, I see page-civicrm-contact-view class is added on the body of contact summary page in civi. This class is used to customise most of display in custom-civicrm.css

Since the class is missing from D9 sites, none of these css style work.

A quick workaround is to add

Civi::resources()->addScript('cj("body").addClass("page-civicrm-contact-view");');

on contact summary pages.