mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 23:54:43 +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").loadData(data);
|
||||||
el.handsontable("getInstance").sort(3, order);
|
el.handsontable("getInstance").sort(3, order);
|
||||||
|
|
||||||
// "Hack" to disable user sorting rows by clicking on
|
// "Hack" to disable user sorting rows by clicking on
|
||||||
// header elements
|
// header elements
|
||||||
el.handsontable("getInstance")
|
el.handsontable("getInstance")
|
||||||
|
@ -1185,3 +1185,17 @@ initializeAddContentsModal();
|
||||||
initializeSidebarNavigation();
|
initializeSidebarNavigation();
|
||||||
initializeUnsavedWorkDialog();
|
initializeUnsavedWorkDialog();
|
||||||
initializeTutorial();
|
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 ) {
|
function truncateLongString( el, chars ) {
|
||||||
var input = $.trim(el.text());
|
var input = $.trim(el.text());
|
||||||
|
|
||||||
|
var html = "";
|
||||||
|
if( el.children().hasClass("glyphicon") ){
|
||||||
|
html = el.children()[0];
|
||||||
|
}
|
||||||
|
|
||||||
if( input.length >= chars){
|
if( input.length >= chars){
|
||||||
var newText = el.text().slice(0, chars);
|
var newText = el.text().slice(0, chars);
|
||||||
for( var i = newText.length; i > 0; i--){
|
for( var i = newText.length; i > 0; i--){
|
||||||
if(newText[i] === ' '){
|
if(newText[i] === ' ' && i > 10){
|
||||||
newText = newText.slice(0, i);
|
newText = newText.slice(0, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
el.text(newText + '...');
|
el.html(html.outerHTML + newText + '...' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue