Skip to content

Instantly share code, notes, and snippets.

@cheesepaulo
Created May 19, 2017 17:02
Show Gist options
  • Save cheesepaulo/11a10222fc41a0a5d0dc1db2c1fa8769 to your computer and use it in GitHub Desktop.
Save cheesepaulo/11a10222fc41a0a5d0dc1db2c1fa8769 to your computer and use it in GitHub Desktop.
Hide fields from print on rails admin
//Put this file on app/assets/javascripts/rais_admin/custom/ui.js
// Hide elements from print
window.onload = function() {
document.querySelector('div.well').className += ' hidden-print';
document.querySelector('div.navbar-header').className += ' hidden-print';
document.querySelector('ol.breadcrumb').className += ' hidden-print';
document.querySelector('a.navbar-brand').className += ' hidden-print';
document.querySelector('div.col-sm-3').className += ' hidden-print';
document.querySelector('ul.nav-tabs').className += ' hidden-print';
document.querySelector('a.pjax').className += ' hidden-print';
document.querySelector('th.last').className += ' hidden-print';
document.querySelector('th.shrink').className += ' hidden-print';
$('table tbody tr td:last-child').addClass( 'hidden-print' );
$('table tbody tr td:first-child').addClass( 'hidden-print' );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment