# HG changeset patch # User cavaliet # Date 1372154538 -7200 # Node ID 1fb6cb2267403cd3214cd4dea2dc4a0630e878c9 # Parent b4377a741714da16a90b3f7daaa8b9108590e8c6 modif from integ and version number to 0.1.11 diff -r b4377a741714 -r 1fb6cb226740 src/metadatacomposer/__init__.py --- a/src/metadatacomposer/__init__.py Tue Jun 25 10:46:42 2013 +0200 +++ b/src/metadatacomposer/__init__.py Tue Jun 25 12:02:18 2013 +0200 @@ -1,4 +1,4 @@ -VERSION = (0, 1, 10, "final", 0) +VERSION = (0, 1, 11, "final", 0) def get_version(): diff -r b4377a741714 -r 1fb6cb226740 src/metadatacomposer/static/metadatacomposer/js/edition.js --- a/src/metadatacomposer/static/metadatacomposer/js/edition.js Tue Jun 25 10:46:42 2013 +0200 +++ b/src/metadatacomposer/static/metadatacomposer/js/edition.js Tue Jun 25 12:02:18 2013 +0200 @@ -239,6 +239,7 @@ }); + /* Chapter */ //edit @@ -857,10 +858,12 @@ var tplDiapo = getTemplate('#tpl-slideshow-row'); dataView.limitLength = function(){ return function(text, render) { - if(render(text).length > lengthStringDiapo){ - return render(text).substr(0,lengthStringDiapo) + '...'; + + var renderText = nl2br(render(text)); + if(renderText.length > lengthStringDiapo){ + return renderText.substr(0,lengthStringDiapo) + '...'; }else{ - return render(text); + return renderText; } } } @@ -879,10 +882,12 @@ html = currentAnnotation.content.images[index][name]; input.val(html); $(this).find('span').replaceWith(input); - input.focus().keypress(function(e){ - code = (e.keyCode ? e.keyCode : e.which); - if (code == 13) $(this).blur(); - }); + if(name == 'title'){ + input.focus().keypress(function(e){ + code = (e.keyCode ? e.keyCode : e.which); + if (code == 13) $(this).blur(); + }); + } }); $(document).on('blur', '.title-slideshow-row input, .description-slideshow-row textarea', function(){ @@ -893,6 +898,7 @@ if(newValue.length>lengthStringDiapo){ newValue = newValue.substr(0,lengthStringDiapo) + '...'; } + newValue = nl2br(newValue, true) var span = $('').html(newValue); $(this).replaceWith(span); @@ -1347,6 +1353,11 @@ /* Utilitys */ +function nl2br (str) { + var breakTag = '
'; + return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2'); +} + Array.prototype.move = function (old_index, new_index) { if (new_index >= this.length) { var k = new_index - this.length;