Various improvements in widgets rendering.
This commit is contained in:
parent
546caa485d
commit
7cdc3c1ed6
|
@ -202,6 +202,7 @@ class String(Type):
|
||||||
specificReadPermission, specificWritePermission, width,
|
specificReadPermission, specificWritePermission, width,
|
||||||
height, master, masterValue, focus)
|
height, master, masterValue, focus)
|
||||||
self.format = format
|
self.format = format
|
||||||
|
self.isSelect = self.isSelection()
|
||||||
def isSelection(self):
|
def isSelection(self):
|
||||||
'''Does the validator of this type definition define a list of values
|
'''Does the validator of this type definition define a list of values
|
||||||
into which the user must select one or more values?'''
|
into which the user must select one or more values?'''
|
||||||
|
|
|
@ -18,9 +18,9 @@ class ModelClass:
|
||||||
parts of the application model.'''
|
parts of the application model.'''
|
||||||
_appy_attributes = [] # We need to keep track of attributes order.
|
_appy_attributes = [] # We need to keep track of attributes order.
|
||||||
_appy_notinit = ('id', 'type', 'pythonType', 'slaves', 'selfClass',
|
_appy_notinit = ('id', 'type', 'pythonType', 'slaves', 'selfClass',
|
||||||
'phase', 'pageShow') # When creating a new instance of a
|
'phase', 'pageShow', 'isSelect') # When creating a new
|
||||||
# ModelClass, those attributes must not be given in the
|
# instance of a ModelClass, those attributes must not be
|
||||||
# constructor.
|
# given in the constructor.
|
||||||
|
|
||||||
def _appy_addField(klass, fieldName, fieldType, classDescr):
|
def _appy_addField(klass, fieldName, fieldType, classDescr):
|
||||||
exec "klass.%s = fieldType" % fieldName
|
exec "klass.%s = fieldType" % fieldName
|
||||||
|
|
|
@ -115,6 +115,56 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<metal:showDate define-macro="showDateField"
|
||||||
|
tal:define="v python: field.getAccessor(contextObj)()">
|
||||||
|
<span tal:condition="showLabel" tal:content="label" class="appyLabel"></span>
|
||||||
|
<span tal:content="python: v.strftime('%d/%m/') + str(v.year())"></span>
|
||||||
|
<span tal:condition="python: appyType['format'] == 0"
|
||||||
|
tal:content="python: v.strftime('%H:%M')"></span>
|
||||||
|
</metal:showDate>
|
||||||
|
|
||||||
|
<metal:showString define-macro="showStringField"
|
||||||
|
tal:define="v python: field.getAccessor(contextObj)();
|
||||||
|
fmt python: appyType['format'];
|
||||||
|
maxMult python: appyType['multiplicity'][1];
|
||||||
|
severalValues python: (maxMult == None) or (maxMult > 1)">
|
||||||
|
<tal:simpleString condition="python: fmt == 0">
|
||||||
|
<span tal:condition="showLabel" tal:content="label" class="appyLabel"
|
||||||
|
tal:attributes="class python: 'appyLabel ' + contextObj.getCssClasses(appyType, asSlave=False);
|
||||||
|
id python: v"></span>
|
||||||
|
<tal:severalValues condition="severalValues">
|
||||||
|
<ul class="appyList">
|
||||||
|
<tal:items repeat="sv v">
|
||||||
|
<tal:select condition="appyType/isSelect">
|
||||||
|
<li class="appyBullet">
|
||||||
|
<i tal:content="python: tool.translate('%s_%s_list_%s' % (contextObj.meta_type, field.getName(), sv))"></i>
|
||||||
|
</li>
|
||||||
|
</tal:select>
|
||||||
|
<tal:string condition="not: appyType/isSelect">
|
||||||
|
<li class="appyBullet"><i tal:content="sv"></i></li>
|
||||||
|
</tal:string>
|
||||||
|
</tal:items>
|
||||||
|
</ul>
|
||||||
|
</tal:severalValues>
|
||||||
|
<tal:singleValue condition="not: severalValues">
|
||||||
|
<tal:select condition="appyType/isSelect">
|
||||||
|
<span tal:replace="python: tool.translate('%s_%s_list_%s' % (contextObj.meta_type, field.getName(), v))"/>
|
||||||
|
</tal:select>
|
||||||
|
<tal:noSelect condition="not: appyType/isSelect">
|
||||||
|
<span tal:replace="structure v"/>
|
||||||
|
</tal:noSelect>
|
||||||
|
</tal:singleValue>
|
||||||
|
</tal:simpleString>
|
||||||
|
<tal:formattedString condition="python: appyType['format'] != 0">
|
||||||
|
<fieldset>
|
||||||
|
<legend tal:condition="showLabel" tal:content="label"></legend>
|
||||||
|
<span tal:condition="python: appyType['format'] == 1"
|
||||||
|
tal:replace="structure python: v.replace('\n', '<br>')"/>
|
||||||
|
<span tal:condition="python: appyType['format'] == 2" tal:replace="structure v"/>
|
||||||
|
</fieldset>
|
||||||
|
</tal:formattedString>
|
||||||
|
</metal:showString>
|
||||||
|
|
||||||
<div metal:define-macro="showArchetypesField"
|
<div metal:define-macro="showArchetypesField"
|
||||||
tal:define="field fieldDescr/atField|widgetDescr/atField;
|
tal:define="field fieldDescr/atField|widgetDescr/atField;
|
||||||
appyType fieldDescr/appyType|widgetDescr/appyType;
|
appyType fieldDescr/appyType|widgetDescr/appyType;
|
||||||
|
@ -136,26 +186,22 @@
|
||||||
<metal:editMacro use-macro="python:contextObj.widget(field.getName(), mode='edit', use_label=showLabel)" />
|
<metal:editMacro use-macro="python:contextObj.widget(field.getName(), mode='edit', use_label=showLabel)" />
|
||||||
</tal:editField>
|
</tal:editField>
|
||||||
<tal:viewField tal:condition="not: isEdit">
|
<tal:viewField tal:condition="not: isEdit">
|
||||||
<tal:defField>
|
<tal:fileField condition="python: (appyType['type'] == 'File')">
|
||||||
<tal:fileField condition="python: (appyType['type'] == 'File')">
|
<span tal:condition="showLabel" tal:content="label"></span>
|
||||||
<span tal:condition="showLabel" tal:content="label"></span>
|
<metal:viewField use-macro="python: contextObj.widget(field.getName(), 'view', use_label=0)"/>
|
||||||
<metal:viewField use-macro="python: contextObj.widget(field.getName(), 'view', use_label=0)"/>
|
</tal:fileField>
|
||||||
</tal:fileField>
|
<tal:date condition="python: appyType['type'] == 'Date'">
|
||||||
<tal:simpleField condition="python: (appyType['type'] in ('Integer', 'Float', 'Date', 'Boolean')) or (appyType['type'] == 'String' and (appyType['format'] == 0))">
|
<metal:showDate use-macro="here/skyn/macros/macros/showDateField"/>
|
||||||
<span tal:condition="showLabel" tal:content="label"
|
</tal:date>
|
||||||
tal:attributes="class python: 'appyLabel ' + contextObj.getCssClasses(appyType, asSlave=False);
|
<tal:string condition="python: appyType['type'] == 'String'">
|
||||||
id python: field.getAccessor(contextObj)()"></span>
|
<metal:showString use-macro="here/skyn/macros/macros/showStringField"/>
|
||||||
<metal:viewField use-macro="python: contextObj.widget(field.getName(), 'view', use_label=0)"/>
|
</tal:string>
|
||||||
</tal:simpleField>
|
<tal:simpleField condition="python: (appyType['type'] in ('Integer', 'Float', 'Boolean'))">
|
||||||
<tal:formattedString condition="python: (appyType['type'] == 'String' and (appyType['format'] != 0))">
|
<span tal:condition="showLabel" tal:content="label"
|
||||||
<fieldset tal:define="value python:field.getAccessor(contextObj)()">
|
tal:attributes="class python: 'appyLabel ' + contextObj.getCssClasses(appyType, asSlave=False);
|
||||||
<legend tal:condition="showLabel" tal:content="label"></legend>
|
id python: field.getAccessor(contextObj)()"></span>
|
||||||
<span tal:condition="python: appyType['format'] == 1"
|
<metal:viewField use-macro="python: contextObj.widget(field.getName(), 'view', use_label=0)"/>
|
||||||
tal:replace="structure python: value.replace('\n', '<br>')"/>
|
</tal:simpleField>
|
||||||
<span tal:condition="python: appyType['format'] == 2" tal:replace="structure value"/>
|
|
||||||
</fieldset>
|
|
||||||
</tal:formattedString>
|
|
||||||
</tal:defField>
|
|
||||||
</tal:viewField>
|
</tal:viewField>
|
||||||
</tal:showField>
|
</tal:showField>
|
||||||
|
|
||||||
|
@ -291,9 +337,8 @@
|
||||||
username actor/username|nothing"
|
username actor/username|nothing"
|
||||||
tal:content="python:fullname or username or actorid"/>
|
tal:content="python:fullname or username or actorid"/>
|
||||||
<td tal:content="python:toLocalizedTime(items['time'],long_format=True)"/>
|
<td tal:content="python:toLocalizedTime(items['time'],long_format=True)"/>
|
||||||
<td> <tal:comment condition="rhComments" tal:content="rhComments"/>
|
<td><tal:comment condition="rhComments" tal:content="structure rhComments"/>
|
||||||
<tal:noComment condition="not: rhComments" i18n:translate="no_comments" i18n:domain="plone"/>
|
<tal:noComment condition="not: rhComments" i18n:translate="no_comments" i18n:domain="plone"/></td>
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</metal:block>
|
</metal:block>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -6,6 +6,16 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.appyList {
|
||||||
|
line-height: 0;
|
||||||
|
margin: 0 0 0.5em 1.2em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.appyBullet {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.appyPod {
|
.appyPod {
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +25,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.appyFocus {
|
.appyFocus {
|
||||||
color: red;
|
color: #900101;
|
||||||
}
|
}
|
||||||
|
|
||||||
#importedElem {
|
#importedElem {
|
||||||
|
|
Loading…
Reference in a new issue