Fix the switch show more/less

This commit is contained in:
Laurent Destailleur 2017-12-10 19:03:18 +01:00
parent e1f0483b23
commit 2dae21259e
4 changed files with 19 additions and 6 deletions

View File

@ -271,10 +271,23 @@ class DolEditor
$out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid"); $out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'")); // Init status bar. Need lib ext-statusbar var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'")); // Init status bar. Need lib ext-statusbar
var oldNbOfLines = 0
jQuery(".morelines'.$this->htmlname.'").click(function() { jQuery(".morelines'.$this->htmlname.'").click(function() {
console.log("We click on more lines");
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid"); var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
currentline = aceEditor.getOption("maxLines");
if (oldNbOfLines == 0)
{
oldNbOfLines = currentline;
}
console.log("We click on more lines - we have currently "+oldNbOfLines);
if (currentline < 500)
{
aceEditor.setOptions({ maxLines: 500 }); aceEditor.setOptions({ maxLines: 500 });
}
else
{
aceEditor.setOptions({ maxLines: oldNbOfLines });
}
}); });
})'; })';
$out.= '</script>'."\n"; $out.= '</script>'."\n";

View File

@ -774,7 +774,7 @@ SetBankAccount=Define Bank Account
AccountCurrency=Account currency AccountCurrency=Account currency
ViewPrivateNote=View notes ViewPrivateNote=View notes
XMoreLines=%s line(s) hidden XMoreLines=%s line(s) hidden
ShowMoreLines=Show more lines ShowMoreLines=Show more/less lines
PublicUrl=Public URL PublicUrl=Public URL
AddBox=Add box AddBox=Add box
SelectElementAndClick=Select an element and click %s SelectElementAndClick=Select an element and click %s

View File

@ -1901,7 +1901,7 @@ if ($action == 'editmeta' || $action == 'create')
print $formadmin->select_language($pagelang?$pagelang:$langs->defaultlang, 'WEBSITE_LANG', 0, null, '1'); print $formadmin->select_language($pagelang?$pagelang:$langs->defaultlang, 'WEBSITE_LANG', 0, null, '1');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'; print '<tr><td class="tdhtmlheader tdtop">';
print $langs->trans('HtmlHeaderPage'); print $langs->trans('HtmlHeaderPage');
print '</td><td>'; print '</td><td>';
$doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); $doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '');