[gen] Ref.numbered: when clicking on the number, it gets selected automatically: when hitting then 'enter' key it has the same effect as clickin on the 'move' image.

This commit is contained in:
Gaetan Delannay 2014-07-31 17:04:08 +02:00
parent 302d54c7ce
commit fdb8b92fcb
2 changed files with 8 additions and 4 deletions

View file

@ -404,7 +404,7 @@ class File(Field):
info.copyFile(self.name, value, dbFolder)
else:
# Cases e, f. Extract file name, content and MIME type.
fileName = None
fileName = mimeType = None
if len(value) == 2:
fileName, fileContent = value
elif len(value) == 3:

View file

@ -203,13 +203,17 @@ class Ref(Field):
<x if="not changeNumber">:objectIndex+1</x>
<div if="changeNumber" class="dropdownMenu"
var2="id='%s_%d' % (ajaxHookId, objectIndex);
dropdownId='%s_dd' % id"
dropdownId='%s_dd' % id;
imgId='%s_img' % id"
onmouseover=":'toggleDropdown(%s)' % q(dropdownId)"
onmouseout=":'toggleDropdown(%s,%s)' % (q(dropdownId), q('none'))">
<input type="text" size=":numberWidth" id=":id" value=":objectIndex+1"/>
<input type="text" size=":numberWidth" id=":id" value=":objectIndex+1"
onclick="this.select()"
onkeydown=":'if (event.keyCode==13) \
document.getElementById(%s).click()' % q(imgId)"/>
<!-- The menu -->
<div id=":dropdownId" class="dropdown">
<img class="clickable" src=":url('move')" id=":id + '_img'"
<img class="clickable" src=":url('move')" id=":imgId"
title=":_('move_number')"
onclick=":navBaseCall.replace('**v**','%s,%s,{%s:%s,%s:this}' % \
(q(startNumber), q('doChangeOrder'), q('refObjectUid'),