mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 05:02:50 +08:00
trim long words in reports [fixes SCI-105]
This commit is contained in:
parent
77f00bf3a7
commit
28fa00c30c
2 changed files with 22 additions and 3 deletions
|
@ -47,7 +47,7 @@ function initializeHandsonTable(el) {
|
|||
});
|
||||
el.handsontable("getInstance").loadData(data);
|
||||
el.handsontable("getInstance").sort(3, order);
|
||||
|
||||
|
||||
// "Hack" to disable user sorting rows by clicking on
|
||||
// header elements
|
||||
el.handsontable("getInstance")
|
||||
|
@ -1185,3 +1185,17 @@ initializeAddContentsModal();
|
|||
initializeSidebarNavigation();
|
||||
initializeUnsavedWorkDialog();
|
||||
initializeTutorial();
|
||||
|
||||
$(document).change(function(){
|
||||
setTimeout(function(){
|
||||
$(".report-nav-link").each( function(){
|
||||
truncateLongString( $(this), 30);
|
||||
console.log($(this));
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
$(document).ready(function(){
|
||||
$(".report-nav-link").each( function(){
|
||||
truncateLongString( $(this), 30);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,15 +4,20 @@
|
|||
function truncateLongString( el, chars ) {
|
||||
var input = $.trim(el.text());
|
||||
|
||||
var html = "";
|
||||
if( el.children().hasClass("glyphicon") ){
|
||||
html = el.children()[0];
|
||||
}
|
||||
|
||||
if( input.length >= chars){
|
||||
var newText = el.text().slice(0, chars);
|
||||
for( var i = newText.length; i > 0; i--){
|
||||
if(newText[i] === ' '){
|
||||
if(newText[i] === ' ' && i > 10){
|
||||
newText = newText.slice(0, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
el.text(newText + '...');
|
||||
el.html(html.outerHTML + newText + '...' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue