[gen] Added params Type.swidth and Type.sheight to allow for different sizes for the search widgets.

This commit is contained in:
Gaetan Delannay 2013-02-19 09:57:02 +01:00
parent 24089ef674
commit f6b2afc423
9 changed files with 59 additions and 50 deletions

View file

@ -23,14 +23,16 @@
<label tal:content="python: _(widget['labelId'])"></label><br>&nbsp;&nbsp;
<tal:from define="fromName python: '%s*float' % widgetName">
<label tal:attributes="for fromName" tal:content="python: _('search_from')"></label>
<input type="text" size="4"
<input type="text"
tal:attributes="name fromName; maxlength maxChars;
value python: widget['sdefault'][0]"/>
value python: widget['sdefault'][0];
size widget/swidth"/>
</tal:from>
<tal:to define="toName python: '%s_to' % name">
<label tal:attributes="for toName" tal:content="python: _('search_to')"></label>
<input type="text" size="4"
<input type="text"
tal:attributes="name toName; maxlength maxChars;
value python: widget['sdefault'][1]"/>
value python: widget['sdefault'][1];
size widget/swidth"/>
</tal:to><br/>
</metal:search>

View file

@ -23,14 +23,16 @@
<label tal:content="python: _(widget['labelId'])"></label><br>&nbsp;&nbsp;
<tal:from define="fromName python: '%s*int' % widgetName">
<label tal:attributes="for fromName" tal:content="python: _('search_from')"></label>
<input type="text" size="4"
<input type="text"
tal:attributes="name fromName; maxlength maxChars;
value python: widget['sdefault'][0]"/>
value python: widget['sdefault'][0];
size widget/swidth"/>
</tal:from>
<tal:to define="toName python: '%s_to' % name">
<label tal:attributes="for toName" tal:content="python: _('search_to')"></label>
<input type="text" size="4"
<input type="text"
tal:attributes="name toName; maxlength maxChars;
value python: widget['sdefault'][1]"/>
value python: widget['sdefault'][1];
size widget/swidth"/>
</tal:to><br/>
</metal:search>

View file

@ -158,7 +158,8 @@
<tal:comment replace="nothing">The search icon if field is queryable</tal:comment>
<a tal:condition="python: objs and appyType['queryable']"
tal:attributes="href python: '%s/ui/search?className=%s&ref=%s:%s' % (tool.absolute_url(), linkedPortalType, contextObj.UID(), appyType['name'])">
<img src="search.gif" tal:attributes="title python: _('search_title')"/></a>
<img tal:attributes="title python: _('search_title');
src string: $appUrl/ui/search.gif"/></a>
</div>
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
@ -265,12 +266,12 @@
<label tal:attributes="for andName" tal:content="python: _('search_and')"></label><br/>
</tal:operator>
<tal:comment replace="nothing">The list of values</tal:comment>
<select tal:attributes="name widgetName; size widget/height" multiple="multiple">
<select tal:attributes="name widgetName; size widget/sheight" multiple="multiple">
<tal:option repeat="v python: tool.getSearchValues(name, className)">
<option tal:define="uid python: v[0];
title python: tool.getReferenceLabel(name, v[1], className)"
tal:attributes="value uid; title title"
tal:content="python: tool.truncateValue(title, widget)">
tal:attributes="value uid; title title"
tal:content="python: tool.truncateValue(title, widget['swidth'])">
</option>
</tal:option>
</select>

View file

@ -47,7 +47,7 @@
tal:attributes="value python: possibleValue[0];
selected python:contextObj.fieldValueSelected(name, possibleValue[0], rawValue);
title python: possibleValue[1]"
tal:content="python:tool.truncateValue(possibleValue[1], widget)"></option>
tal:content="python:tool.truncateValue(possibleValue[1], widget['width'])"></option>
</select>
</tal:choice>
<tal:line condition="python: isOneLine and not isSelect">
@ -94,7 +94,7 @@
<tal:simpleSearch condition="not: widget/isSelect">
<input type="text" tal:define="maxChars python: test(widget['maxChars'], widget['maxChars'], '')"
tal:attributes="name python: '%s*string-%s' % (widgetName, widget['transform']);
maxlength maxChars; size widget/width;
maxlength maxChars; size widget/swidth;
style python: 'text-transform:%s' % widget['transform'];
value widget/sdefault"/>
</tal:simpleSearch>
@ -113,11 +113,11 @@
</tal:operator>
<tal:comment replace="nothing">The list of values</tal:comment>
<select tal:define="preSelected widget/sdefault"
tal:attributes="name widgetName; size widget/height" multiple="multiple">
tal:attributes="name widgetName; size widget/sheight" multiple="multiple">
<option tal:repeat="v python:tool.getPossibleValues(name, withTranslations=True, withBlankValue=False, className=className)"
tal:attributes="value python:v[0]; title python: v[1];
selected python: v[0] in preSelected"
tal:content="python: tool.truncateValue(v[1], widget)">
tal:content="python: tool.truncateValue(v[1], widget['swidth'])">
</option>
</select>
</tal:selectSearch><br/>