Set the min. height of sortable entries in em's.

master
Pacman Ghost 6 years ago
parent 4e6939e218
commit 366eedca48
  1. 7
      vasl_templates/webapp/static/main.js
  2. 2
      vasl_templates/webapp/static/sortable.js

@ -4,6 +4,7 @@ gValidTemplateIds = [] ;
gVehicleOrdnanceListings = {} ;
gWebChannelHandler = null ;
gEmSize = null ;
var _NATIONALITY_SPECIFIC_BUTTONS = {
"russian": [ "mol", "mol-p" ],
@ -318,6 +319,12 @@ $(document).ready( function () {
} ) ;
}
// figure out how many pixels an em is
var $em = $( "<span>M</span>" ) ;
$("body").append( $em ) ;
gEmSize = $em.width() ;
$em.remove() ;
// add some dummy links for the test suite to edit templates
if ( getUrlParam( "edit_template_links" ) ) {
$("button.generate").each( function() {

@ -171,7 +171,7 @@ $.fn.sortable2 = function( action, args )
if ( $entries.length === 0 )
return ;
var available_height = $sortable2.parent().height() ;
var max_height = Math.max( available_height/$entries.length, 20 ) ;
var max_height = Math.max( available_height/$entries.length, 2*gEmSize ) ;
$entries.each( function() {
$(this).css({ "max-height": Math.ceil(max_height)+"px", "overflow-y": "hidden" }) ;
// check for overflow

Loading…
Cancel
Save