[gen] Improvements in the rendering of buttons throughout the web UI. [gen] Ref field and Search: added param 'showActions' allowing to show or not the range of icons and buttons below or besides every tied or queried object.

This commit is contained in:
Gaetan Delannay 2015-01-19 15:44:09 +01:00
parent a905aaa139
commit 34cafcdbc1
10 changed files with 171 additions and 163 deletions

View file

@ -228,24 +228,21 @@ class ToolWrapper(AbstractWrapper):
class=":(not currentSearch and (currentClass==className) and \
(currentPage=='query')) and \
'current' or ''">::_(className + '_plural')</a>
</div>
<!-- Create instances of this class -->
<form if="ztool.userMayCreate(rootClass) and \
('form' in ztool.getCreateMeans(rootClass))" class="addForm"
var2="target=ztool.getLinksTargetInfo(rootClass)"
action=":'%s/do' % toolUrl" target=":target.target">
<input type="hidden" name="action" value="Create"/>
<input type="hidden" name="className" value=":className"/>
<input type="hidden" name="popup"
value=":(inPopup or (target.target != '_self')) and '1' or '0'"/>
<input type="submit" class="buttonSmall button"
var="label=_('query_create')" value=":label"
onclick=":target.openPopup"
style=":'%s; %s' % (url('add', bg=True), \
ztool.getButtonWidth(label))"/>
</form>
<form if="ztool.userMayCreate(rootClass) and \
('form' in ztool.getCreateMeans(rootClass))" class="addForm"
var2="target=ztool.getLinksTargetInfo(rootClass)"
action=":'%s/do' % toolUrl" target=":target.target">
<input type="hidden" name="action" value="Create"/>
<input type="hidden" name="className" value=":className"/>
<input type="hidden" name="popup"
value=":(inPopup or (target.target != '_self')) and '1' or '0'"/>
<input var="label=_('query_create');
css=ztool.getButtonCss(label)" type="submit" class=":css"
value=":label" onclick=":target.openPopup"
style=":url('add', bg=True)"/>
</form>
</div>
<!-- Searches -->
<x if="ztool.advancedSearchEnabledFor(rootClass)">
<!-- Live search -->
@ -365,7 +362,8 @@ class ToolWrapper(AbstractWrapper):
if="sub">::zobj.highlight(sub)</span>
<!-- Actions -->
<div if="not inPopup and zobj.mayAct()">
<div if="not inPopup and uiSearch.showActions and zobj.mayAct()"
style=":'display:%s; margin-bottom:2px' % uiSearch.showActions">
<!-- Edit -->
<a if="zobj.mayEdit()"
var2="navInfo='search.%s.%s.%d.%d' % \
@ -453,15 +451,13 @@ class ToolWrapper(AbstractWrapper):
</table>
<!-- The button for selecting objects and closing the popup. -->
<div if="inPopup and cbShown" align=":dleft">
<input type="button" class="button"
var="label=_('object_link_many')"
value=":label"
<input type="button"
var="label=_('object_link_many'); css=ztool.getButtonCss(label)"
value=":label" class=":css" style=":url('linkMany', bg=True)"
onclick=":'onSelectObjects(%s,%s,%s,%s,%s,%s,%s)' % \
(q(rootHookId), q(uiSearch.initiator.url), \
q(uiSearch.initiatorMode), q(sortKey), q(sortOrder), \
q(filterKey), q(filterValue))"
style=":'%s; %s' % (url('linkMany', bg=True), \
ztool.getButtonWidth(label))"/>
q(filterKey), q(filterValue))"/>
</div>
<!-- Init checkboxes if present. -->
<script if="checkboxes">:'initCbs(%s)' % q(checkboxesId)</script>
@ -622,10 +618,9 @@ class ToolWrapper(AbstractWrapper):
<!-- Submit button -->
<p align=":dright"><br/>
<input type="submit" class="button" var="label=_('search_button')"
value=":label"
style=":'%s; %s' % (url('search', bg=True), \
ztool.getButtonWidth(label))"/>
<input var="label=_('search_button');
css=ztool.getButtonCss(label, small=False)" type="submit"
class=":css" value=":label" style=":url('search', bg=True)"/>
</p>
</form>
</x>''', template=AbstractWrapper.pxTemplate, hook='content')

View file

@ -465,46 +465,46 @@ class AbstractWrapper(object):
<!-- Previous -->
<x if="previousPage and pageInfo.showPrevious"
var2="label=_('page_previous');
buttonWidth=ztool.getButtonWidth(label)">
css=ztool.getButtonCss(label, small=False)">
<!-- Button on the edit page -->
<x if="isEdit">
<input type="button" class="button" value=":label"
<input type="button" class=":css" value=":label"
onclick="submitAppyForm('previous')"
style=":'%s; %s' % (url('previous', bg=True), buttonWidth)"/>
style=":url('previous', bg=True)"/>
<input type="hidden" name="previousPage" value=":previousPage"/>
</x>
<!-- Button on the view page -->
<input if="not isEdit" type="button" class="button" value=":label"
style=":'%s; %s' % (url('previous', bg=True), buttonWidth)"
<input if="not isEdit" type="button" class=":css" value=":label"
style=":url('previous', bg=True)"
onclick=":'goto(%s)' % q(zobj.getUrl(page=previousPage, \
inPopup=inPopup))"/>
</x>
<!-- Save -->
<input if="isEdit and pageInfo.showSave"
type="button" class="button" onclick="submitAppyForm('save')"
var2="label=_('object_save')" value=":label"
style=":'%s; %s' % (url('save', bg=True), \
ztool.getButtonWidth(label))" />
<input if="isEdit and pageInfo.showSave" type="button"
var2="label=_('object_save');
css=ztool.getButtonCss(label, small=False)"
class=":css" onclick="submitAppyForm('save')"
value=":label" style=":url('save', bg=True)" />
<!-- Cancel -->
<input if="isEdit and pageInfo.showCancel"
type="button" class="button" onclick="submitAppyForm('cancel')"
var2="label=_('object_cancel')" value=":label"
style=":'%s; %s' % (url('cancel', bg=True), \
ztool.getButtonWidth(label))"/>
<input if="isEdit and pageInfo.showCancel" type="button"
var2="label=_('object_cancel');
css=ztool.getButtonCss(label, small=False)"
class=":css" onclick="submitAppyForm('cancel')" value=":label"
style=":url('cancel', bg=True)"/>
<x if="not isEdit"
var2="locked=zobj.isLocked(user, page);
editable=pageInfo.showOnEdit and pageInfo.showEdit and \
mayAct and zobj.mayEdit()">
<!-- Edit -->
<input type="button" class="button" if="editable and not locked"
var="label=_('object_edit')" value=":label"
style=":'%s; %s' % (url('edit', bg=True), \
ztool.getButtonWidth(label))"
<input if="editable and not locked" type="button"
var="label=_('object_edit');
css=ztool.getButtonCss(label, small=False)"
value=":label" class=":css" style=":url('edit', bg=True)"
onclick=":'goto(%s)' % q(zobj.getUrl(mode='edit', page=page, \
inPopup=inPopup))"/>
<!-- Locked -->
<a if="editable and locked">
<img style="cursor: help"
<img class="help"
var="lockDate=ztool.formatDate(locked[1]);
lockMap={'user':ztool.getUserName(locked[0]), \
'date':lockDate};
@ -516,26 +516,24 @@ class AbstractWrapper(object):
onclick=":'onUnlockPage(%s,%s)' % (q(zobj.id), q(page))"/></a>
</x>
<!-- Delete -->
<input if="not isEdit and not inPopup and zobj.mayDelete()"
type="button" class="button"
onclick=":'onDeleteObject(%s)' % q(zobj.id)"
var2="label=_('object_delete')" value=":label"
style=":'%s; %s' % (url('delete', bg=True), \
ztool.getButtonWidth(label))"/>
<input if="not isEdit and not inPopup and zobj.mayDelete()" type="button"
var2="label=_('object_delete');
css=ztool.getButtonCss(label, small=False)"
value=":label" class=":css" style=":url('delete', bg=True)"
onclick=":'onDeleteObject(%s)' % q(zobj.id)"/>
<!-- Next -->
<x if="nextPage and pageInfo.showNext"
var2="label=_('page_next');
buttonWidth=ztool.getButtonWidth(label)">
css=ztool.getButtonCss(label, small=False)">
<!-- Button on the edit page -->
<x if="isEdit">
<input type="button" class="button" onclick="submitAppyForm('next')"
style=":'%s; %s' % (url('next', bg=True), buttonWidth)"
value=":label"/>
<input type="button" class=":css" onclick="submitAppyForm('next')"
style=":url('next', bg=True)" value=":label"/>
<input type="hidden" name="nextPage" value=":nextPage"/>
</x>
<!-- Button on the view page -->
<input if="not isEdit" type="button" class="button" value=":label"
style=":'%s; %s' % (url('next', bg=True), buttonWidth)"
<input if="not isEdit" type="button" class=":css" value=":label"
style=":url('next', bg=True)"
onclick=":'goto(%s)' % q(zobj.getUrl(page=nextPage, \
inPopup=inPopup))"/>
</x>