source: products/quintagroup.ploneformgen.readonlystringfield/branches/dahoste/quintagroup/ploneformgen/readonlystringfield/skins/readonlystringfield/readonlystring.pt @ 2827

Last change on this file since 2827 was 2827, checked in by dahoste, 9 years ago

Small tweak to skin template to inject a CSS classname ('readonly') when the field instance being rendered is in fact readonly, to allow for visual styling of the element to clearly reflect the status. Note that this change has no effect if it is not partnered with a CSS stylesheet that assigns properties to the 'readonly' class (or a selector that includes it).

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1<html xmlns="http://www.w3.org/1999/xhtml"
2      xmlns:tal="http://xml.zope.org/namespaces/tal"
3      xmlns:metal="http://xml.zope.org/namespaces/metal"
4      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
5      i18n:domain="plone">
6  <head><title></title></head>
7  <body>
8
9    <!-- Readonly String Widgets -->
10    <metal:view_macro define-macro="view"
11            tal:define="kssClassesView context/@@kss_field_decorator_view;
12                        getKssClasses nocall:kssClassesView/getKssClassesInlineEditable;">
13        <span metal:define-macro="string-field-view"
14            tal:define="kss_class python:getKssClasses(fieldName,
15                              templateId='readonlystring', macro='string-field-view');"
16            tal:attributes="class kss_class;
17                            id string:parent-fieldname-$fieldName">
18            <span metal:define-slot="inside"
19                  tal:replace="accessor">string</span>
20        </span>
21    </metal:view_macro>
22
23    <metal:define define-macro="edit">
24      <metal:use use-macro="field_macro | here/widgets/field/macros/edit">
25        <input metal:fill-slot="widget_body"
26               type="text"
27               name=""
28               class="blurrable firstToFocus"
29               id=""
30               value=""
31               size="30"
32               readonly="1"
33               tal:define="editable python:path('request/%s_editable|nothing' % fieldName);
34                           readonly python:not editable and '1' or None;"
35               tal:attributes="name fieldName;
36                               id fieldName;
37                               value value;
38                               size widget/size;
39                               maxlength widget/maxlength;
40                               readonly readonly;
41                               class python: readonly and 'blurrable firstToFocus readonly' or 'blurrable firstToFocus'"
42               />
43      </metal:use>
44    </metal:define>
45
46    <div metal:define-macro="search">
47      <div metal:use-macro="here/readonlystring/macros/edit">
48      </div>
49    </div>
50
51  </body>
52
53</html>
54
Note: See TracBrowser for help on using the repository browser.