Sha256: 46cc44e7c9196367faeae0e6254f7aea0a9bd6fac5eb62c10d0dfecd036dac22

Contents?: true

Size: 1.2 KB

Versions: 130

Compression:

Stored size: 1.2 KB

Contents

<style>
  .image-error:before {
    content: "Sorry, the image below seems to be broken.";
    display: block;
    margin-bottom: 10px;
  }
  .image-error {
    margin: 5px;
    padding: 5px;
    outline: 1px solid red;
  }
</style>

<%= pb_rails("body",
  props: {
    text: "Handle when an image fails to load or a broken link is passed. This is not neccessary most of the time."
  }
) %>

<br>
<br>

<%= pb_rails("body",
  props: {
    text: "Alter the display when the image fails to load:"
  }
) %>

<%= pb_rails("image",
  props: {
    alt: "This is the alt text!",
    on_error: "this.style.color = 'red'",
    rounded: true,
    size: "xs",
    url: "not_a_picture"
  }
) %>

<br>
<br>

<%= pb_rails("body",
  props: {
    text: "Give it an error class:"
  }
) %>

<%= pb_rails("image",
  props: {
    alt: "This is the alt text!",
    on_error: "this.classList.add('image-error')",
    rounded: true,
    size: "xs",
    url: "not_a_picture"
  }
) %>

<br>
<br>

<%= pb_rails("body",
  props: {
   text: "Or hide it completely:"
  }
) %>

<%= pb_rails("image",
  props: {
    alt: "This is the alt text!",
    on_error: "this.style.display = 'none'",
    rounded: true,
    size: "xs",
    url: "not_a_picture",
  }
) %>

Version data entries

130 entries across 130 versions & 1 rubygems

Version Path
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.18.2 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.18.1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.18.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.17.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.16.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.15.1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.15.1.pre.alpha.rubocop.deps app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.15.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.14.1.pre.alpha2 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.14.1.pre.alpha1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.14.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.13.1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.13.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.13.0.pre.node.update app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.12.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.11.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.10.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb
playbook_ui-10.9.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb