Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first stab at complete set

  • Loading branch information...
commit c6d263d4676c62704ace83ff003fa1605f8e3c1f 1 parent ad5aa01
@mfeif mfeif authored
Showing with 718 additions and 147 deletions.
  1. +22 −0 autocomplete_input.mako
  2. +12 −0 checkbox.mako
  3. +22 −0 checkbox_choice.mako
  4. +43 −0 checked_input.mako
  5. +24 −0 checked_password.mako
  6. +19 −0 dateinput.mako
  7. +38 −0 dateparts.mako
  8. +27 −0 file_upload.mako
  9. +76 −85 form.mako
  10. +4 −0 hidden.mako
  11. +30 −0 mapping.mako
  12. +29 −43 mapping_item.mako
  13. +10 −0 password.mako
  14. +22 −0 radio_choice.mako
  15. +6 −0 readonly/checkbox.mako
  16. +14 −0 readonly/checkbox_choice.mako
  17. +7 −0 readonly/checked_input.mako
  18. +4 −0 readonly/checked_password.mako
  19. +9 −0 readonly/dateparts.mako
  20. +12 −0 readonly/file_upload.mako
  21. +27 −0 readonly/form.mako
  22. +22 −0 readonly/mapping.mako
  23. +12 −0 readonly/mapping_item.mako
  24. +4 −0 readonly/password.mako
  25. +15 −0 readonly/radio_choice.mako
  26. +17 −0 readonly/richtext.mako
  27. +12 −0 readonly/select.mako
  28. +12 −0 readonly/sequence.mako
  29. +8 −0 readonly/sequence_item.mako
  30. +2 −0  readonly/textarea.mako
  31. +2 −0  readonly/textinput.mako
  32. +21 −0 richtext.mako
  33. +14 −0 select.mako
  34. +59 −0 sequence.mako
  35. +31 −0 sequence_item.mako
  36. +13 −0 textarea.mako
  37. +17 −19 textinput.mako
View
22 autocomplete_input.mako
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+ <input type="text"
+ name="${field.name}"
+ value="${cstruct}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}"/>
+ % if field.widget.values:
+ <script type="text/javascript">
+ deform.addCallback(
+ '${field.oid}',
+ function (oid) {
+ $('#' + oid).autocomplete({source: ${values}});
+ $('#' + oid).autocomplete("option", ${options});
+ }
+ );
+ </script>
+ % endif
View
12 checkbox.mako
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+<input type="checkbox"
+ name="${field.name}" value="${field.widget.true_val}"
+ id="${field.oid}"
+ % if cstruct == field.widget.true_val:
+ checked="checked"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+/>
+
View
22 checkbox_choice.mako
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+<input type="hidden" name="__start__" value="${field.name}:sequence"/>
+ <ul class="deformSet">
+ % for index, choice in enumerate(field.widget.values):
+ <li class="deformSet-item">
+ <input
+ % if choice.value in cstruct:
+ checked="checked"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ type="checkbox"
+ name="checkbox"
+ value="${choice.value}"
+ id="${field.oid}-${index}"/>
+ <label for="${field.oid}-${index}">${choice.title}</label>
+ </li>
+ % endfor
+ </ul>
+<input type="hidden" name="__end__" value="${field.name}:sequence"/>
+
View
43 checked_input.mako
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+<input type="hidden" name="__start__" value="${field.name}:mapping"/>
+<ul>
+ <li>
+ <label for="${field.oid}">${subject}</label>
+ <input type="text" name="value" value="${cstruct}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}"/>
+ </li>
+
+ <li>
+ <label for="${field.oid}-confirm">${confirm_subject}</label>
+ <input type="text" name="confirm" value="${confirm}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}-confirm"/>
+ </li>
+</ul>
+ % if field.widget.mask:
+ <script type="text/javascript">
+ deform.addCallback(
+ '${field.oid}',
+ function (oid) {
+ $("#" + oid).mask("${field.widget.mask}",
+ {placeholder:"${field.widget.mask_placeholder}"});
+ $("#" + oid + "-confirm").mask("${field.widget.mask}",
+ {placeholder:"${field.widget.mask_placeholder}"});
+ }
+ );
+
+ </script>
+ % endif
+
+<input type="hidden" name="__end__" value="${field.name}:mapping"/>
View
24 checked_password.mako
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+<input type="hidden" name="__start__" value="${field.name}:mapping"/>
+<ul>
+ <li>
+ <label for="${field.oid}">Password</label>
+ <input type="password" name="value" value="${cstruct}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ id="${field.oid}"/>
+ </li>
+ <li>
+ <label for="${field.oid}-confirm">Confirm Password</label>
+ <input type="password" name="confirm" value="${confirm}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}-confirm"/>
+ </li>
+</ul>
+<input type="hidden" name="__end__" value="${field.name}:mapping"/>
View
19 dateinput.mako
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+ <input type="date"
+ name="${field.name}"
+ value="${cstruct}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}"/>
+ <script type="text/javascript">
+ deform.addCallback(
+ '${field.oid}',
+ function(oid) {
+ $('#' + oid).datepicker({dateFormat: 'yy-mm-dd'});
+ }
+ );
+ </script>
View
38 dateparts.mako
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+<input type="hidden" name="__start__" value="${field.name}:mapping"/>
+<ul class="inline">
+ <li>
+ <label for="${field.oid}">Year</label>
+ <input type="text" name="year" value="${year}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}"/>
+ </li>
+ <li>
+ <label for="${field.oid}-month">Month</label>
+ <input type="text" name="month" value="${month}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}-month"/>
+ </li>
+ <li>
+ <label for="${field.oid}-day">Day</label>
+ <input type="text" name="day" value="${day}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}-day"/>
+ </li>
+</ul>
+<input type="hidden" name="__end__" value="${field.name}:mapping"/>
View
27 file_upload.mako
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+<div class="deformFileupload">
+
+ <input type="hidden" name="__start__" value="${field.name}:mapping"/>
+
+ % if cstruct.get('uid'):
+ <div class="deformReplaces">
+ <input type="hidden" name="uid" value="${cstruct['uid']}"
+ id="${field.oid}-uid"/>
+ <span id="${field.oid}-filename">
+ ${cstruct.get('filename')}
+ </span>
+ </div>
+ % endif
+
+ <input type="file" name="upload"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}"/>
+
+ <input type="hidden" name="__end__" value="${field.name}:mapping"/>
+
+</div>
View
161 form.mako
@@ -1,99 +1,90 @@
+# -*- coding: utf-8 -*-
+<%
+rndr = field.renderer
+tmpl = field.widget.item_template
+%>
<form
- id="${field.formid}"
- action="${field.action}"
- method="${field.method}"
- enctype="multipart/form-data"
- accept-charset="utf-8"
- i18n:domain="deform"
- % if field.css_class:
- class=${field.css_class}
+ id="${field.formid}"
+ action="${field.action}"
+ method="${field.method}"
+ enctype="multipart/form-data"
+ accept-charset="utf-8"
+ i18n:domain="deform"
+ % if field.css_class:
+ class="${field.css_class}
+ % endif
+>
+
+ <fieldset class="deformFormFieldset">
+ % if field.title:
+ <legend>${field.title}</legend>
% endif
- >
-<fieldset class="deformFormFieldset">
-
-% if field.title:
- <legend>${field.title}</legend>
-% endif
-
<input type="hidden" name="_charset_" />
<input type="hidden" name="__formid__" value="${field.formid}"/>
<ul>
-
- % if field.error:
- <li class="errorLi">
- <h3 class="errorMsgLbl" i18n:translate=""
- >There was a problem with your submission</h3>
- <p class="errorMsg" i18n:translate=""
- >Errors have been highlighted below</p>
- </li>
- % endif
-
- % if field.title:
- <li class="section first" tal:condition="field.title">
- <h3>${field.title}</h3>
- % if field.description:
- <div>${field.description}</div>
- % endif
- </li>
+
+ % if field.error:
+ <li class="errorLi">
+ <h3 class="errorMsgLbl" i18n:translate=""
+ >There was a problem with your submission</h3>
+ <p class="errorMsg" i18n:translate=""
+ >Errors have been highlighted below</p>
+ </li>
+ % endif
+
+ % if field.title:
+ <li class="section first">
+ <h3>${field.title}</h3>
+ % if field.description:
+ <div>${field.description}</div>
% endif
-
- <%
- renderer = field.renderer
- template = field.widget.item_template
- %>
-
- % for child in field.children:
- ${renderer(template,field=child,cstruct=cstruct.get(child.name, null))}
- % endfor
-
- <li class="buttons">
- % for button in field.buttons:
- <button
- % if button.disabled:
- disabled=${button.disabled}
- % endif
- id="${field.formid + button.name}"
- name="${button.name}"
- type="${button.type}"
- class="btnText submit"
- value="${button.value}">
- <span>${button.title}</span>
- </button>
- % endfor
- </li>
-
+ </li>
+ % endif
+
+ % for f in field.children:
+ ${rndr(tmpl, field=f, cstruct=cstruct.get(f.name, null))}
+ % endfor
+
+ <li class="buttons">
+ % for button in field.buttons:
+ <button
+ % if button.disabled:
+ disabled="disabled"
+ % endif
+ id="${field.formid+button.name}"
+ name="${button.name}"
+ type="${button.type}"
+ class="btnText submit"
+ value="${button.value}">
+ <span>${button.title}</span>
+ </button>
+ % endfor
+ </li>
+
</ul>
-
-</fieldset>
-<script type="text/javascript" tal:condition="field.use_ajax">
- function deform_ajaxify(response, status, xhr, form, oid, mthd){
- var options = {
- target: '#' + oid,
- replaceTarget: true,
- success: function(response, status, xhr, form){
- deform_ajaxify(response, status, xhr, form, oid);
- }
- };
- var extra_options = ${field.ajax_options};
- var name;
- if (extra_options) {
- for (name in extra_options) {
- options[name] = extra_options[name];
- };
- };
- $('#' + oid).ajaxForm(options);
- if(mthd){
- mthd(response, status, xhr, form);
- }
- }
+ </fieldset>
+
+% if field.use_ajax:
+<script type="text/javascript">
deform.addCallback(
'${field.formid}',
function(oid) {
- deform_ajaxify(null, null, null, null, oid);
- }
- );
+ var options = {
+ target: '#' + oid,
+ replaceTarget: true,
+ };
+ var extra_options = ${field.ajax_options};
+ var name;
+ if (extra_options) {
+ for (name in extra_options) {
+ options[name] = extra_options[name];
+ };
+ };
+ $('#' + oid).ajaxForm(options);
+ });
</script>
+% endif
-</form>
+</form>
View
4 hidden.mako
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+<input type="hidden" name="${field.name}" value="${cstruct}"
+ id="${field.oid}"/>
+
View
30 mapping.mako
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+<%
+rndr = field.renderer
+tmpl = field.widget.item_template
+%>
+<fieldset class="deformMappingFieldset">
+ <!-- mapping -->
+ % if field.title:
+ <legend>${field.title}</legend>
+ % endif
+ <ul>
+ % if field.errormsg:
+ <li class="errorLi">
+ <h3 class="errorMsgLbl">There was a problem with this section</h3>
+ <p class="errorMsg">${field.errormsg}</p>
+ </li>
+ % endif
+ % if field.description:
+ <li class="section">
+ <div>${field.description}</div>
+ </li>
+ % endif
+ <input type="hidden" name="__start__" value="${field.name}:mapping"/>
+ % for f in field.children:
+ ${rndr(tmpl, field=f, cstruct=cstruct.get(f.name, null))}
+ % endfor
+ <input type="hidden" name="__end__" value="${field.name}:mapping"/>
+ </ul>
+ <!-- /mapping -->
+</fieldset>
View
72 mapping_item.mako
@@ -1,48 +1,34 @@
-% if field.widget.hidden:
-<li
- % if not field.error:
- class=${field.error}
- % else:
- class=${field.widget.error_class}
- % endif
+# -*- coding: utf-8 -*-
+<%
+errstr = 'error-%s' % field.oid
+%>
+% if not field.widget.hidden:
+<li
+ % if field.error and field.widget.error_class:
+ class="${field.widget.error_class}"
+ % endif
title="${field.description}"
- id="item-${field.oid}" i18n:domain="deform">
+ id="item-${field.oid}">
% endif
+ <!-- mapping_item -->
+ % if not (field.widget.hidden or field.widget.category == 'structural'):
+ <label class="desc"
+ title="${field.description}"
+ for="${field.oid}"
+ >${field.title}\
+ % if field.required:\
+ <span class="req" id="req-${field.oid}">*</span>\
+ % endif\
+ </label>
+ ${field.serialize(cstruct)}
- <!-- mapping_item -->
- % if not (field.widget.hidden or field.widget.category == 'structural'):
- <label class="desc"
- title="${field.description}"
- for="${field.oid}"
- >${field.title}
-
- %if field.required:
- <span class="req"
- id="req-${field.oid}">*</span>
- % endif
-
- </label>
- % endif
+ % if field.error and not field.widget.hidden:
+ % for index, msg in enumerate(field.error.messages()):
+ <p id=${index==0 and errstr or ('%s-%s' % (errstr, index))}"
+ class="${field.widget.error_class}">${msg}</p>
+ % endfor
+ % endif
- ${field.serialize(cstruct)}
-
- % if field.error and not field.widget.hidden:
- <%
- errstr = 'error-%s' % field.oid
- %>
- % for msg in field.error.messages():
- <p
- % if repeat.msg.index==0:
- id="${errstr}"
- % else:
- id=${'%s-%s' % (errstr, repeat.msg.index)}
- % endif
- class="${field.widget.error_class}" i18n:translate="">${msg}</p>
- % endfor
- % endif
-
- <!-- /mapping_item -->
-
-% if field.widget.hidden:
+ <!-- /mapping_item -->
</li>
-% endif
+% endif
View
10 password.mako
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+<input type="password" name="${field.name}" value="${cstruct}"
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}"/>
+
View
22 radio_choice.mako
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+<ul class="deformSet">
+ <input type="hidden" name="__start__" value="${field.name}:rename"/>
+ % for index, choice in enumerate(field.widget.values):
+ <li class="deformSet-item">
+ <input
+ % if choice.value == cstruct:
+ checked="checked"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ type="radio"
+ name="${field.oid}"
+ value="${choice.value}"
+ id="${field.oid}-${index}"/>
+ <label for="${field.oid}-${index}">${choice.title}</label>
+ </li>
+ % endfor
+ <input type="hidden" name="__end__"/>
+</ul>
+
View
6 readonly/checkbox.mako
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+% if cstruct == field.widget.true_val:
+<span id="${field.oid}">Yes</span>
+% else:
+<em id="${field.oid}">No</em>
+% endif
View
14 readonly/checkbox_choice.mako
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+<div>
+ % for index, choice in enumerate(field.widget.values):
+ <span>${choice.description}</span>
+ <em id="${field.oid}-${index}">
+ % if choice.value in cstruct:
+ Yes
+ % else:
+ No
+ % endif
+ </em>
+ % endfor
+</div>
+
View
7 readonly/checked_input.mako
@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+<div>
+ <div>
+ <span>${subject}</span>
+ <span id="${field.oid}">"${cstruct}"</span>
+ </div>
+</div>
View
4 readonly/checked_password.mako
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+<div>
+ <em> Password not displayed. </em>
+</div>
View
9 readonly/dateparts.mako
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+<div>
+ <span>Year</span>
+ <span id="${field.oid}-year">${year}</span>
+ <span>Month</span>
+ <span id="${field.oid}-month">${month}</span>
+ <span>Day</span>
+ <span id="${field.oid}-day">${day}</span>
+</div>
View
12 readonly/file_upload.mako
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+<div class="fileupload">
+
+ % if cstruct.get('uid'):
+ <div class="replaces">
+ <span>${cstruct.get('filename')}</span>
+ </div>
+ % endif
+
+ <p><em> Read-only. </em></p>
+
+</div>
View
27 readonly/form.mako
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+<%
+rndr = field.renderer
+tmpl = field.widget.readonly_item_template
+%>
+<div class="deform"
+ % if field.name or None:
+ id="${field.name or None}"
+ % endif
+ >
+
+ <div class="deformFormFieldset">
+ % if field.title:
+ <li class="section first">
+ <h3>${field.title}</h3>
+ % if field.description:
+ <div>${field.description}</div>
+ % endif
+ </li>
+ % endif
+
+ </div>
+
+ % for f in field.children:
+ ${rndr(tmpl, field=f, cstruct=cstruct.get(f.name, null))}
+ % endfor
+</div>
View
22 readonly/mapping.mako
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+<%
+rndr = field.renderer
+tmpl = field.widget.readonly_item_template
+%>
+<div class="deformMappingFieldset">
+ <!-- mapping -->
+ % if field.title:
+ <p>${field.title}</p>
+ % endif
+ <ul class="readonly">
+ % if field.description:
+ <li class="section">
+ <div>${field.description}</div>
+ </li>
+ % endif
+ % for f in field.children:
+ ${rndr(tmpl, field=f, cstruct=cstruct.get(f.name, null))}
+ % endfor
+ </ul>
+ <!-- /mapping -->
+</div>
View
12 readonly/mapping_item.mako
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+% if not (field.widget.hidden or field.widget.category == 'structural'):
+<li title="${field.description}">
+ <!-- mapping_item -->
+ % if not (field.widget.hidden or field.widget.category == 'structural'):
+ <p class="desc"
+ title="${field.description}"
+ >${field.title}</p>
+ ${field.serialize(cstruct, readonly=True)}
+ <!-- /mapping_item -->
+</li>
+% endif
View
4 readonly/password.mako
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+<div>
+ <em> Password not displayed. </em>
+</div>
View
15 readonly/radio_choice.mako
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+<ul>
+% for value, description in field.widget.values:
+<li>
+ <span>${description}</span>
+ <em>
+ % if value == cstruct:
+ Selected
+ % else:
+ Not Selected
+ % endif
+ </em>
+</li>
+% endfor
+</ul>
View
17 readonly/richtext.mako
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+<textarea class="tinymce"
+ id="${field.oid}"
+ name="${field.name}">${cstruct}</textarea>
+<script language="javascript"
+ type="text/javascript">
+ tinyMCE.init({
+ height: '${field.widget.height}',
+ mode : 'textareas',
+ readonly : 1,
+ theme : '${field.widget.theme}',
+ theme_advanced_resizing : true,
+ theme_advanced_toolbar_align : 'left',
+ theme_advanced_toolbar_location : 'top',
+ width: '${field.widget.width}'
+ });
+</script>
View
12 readonly/select.mako
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+% for value, description in field.widget.values:
+<p>
+ <span>${description}</span>
+ <em>
+ % if value == cstruct:
+ Selected
+ % else:
+ Not Selected
+ % endif
+ </em>
+</p>
View
12 readonly/sequence.mako
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+<%
+rndr = field.renderer
+tmpl = field.widget.readonly_item_template
+%>
+<div class="deformSeq readonly">
+ <!-- sequence -->
+ % for tup in subfields:
+ ${rndr(tmpl, field=tup[1], cstruct=tup[0])}
+ % endfor
+ <!-- /sequence -->
+</div>
View
8 readonly/sequence_item.mako
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+% if not field.widget.hidden:
+<li title="${field.description}">
+% endif
+ <!-- sequence_item -->
+ ${field.serialize(cstruct, readonly=True)}
+ <!-- /sequence_item -->
+</li>
View
2  readonly/textarea.mako
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+<p id="${field.oid}">${cstruct}</p>
View
2  readonly/textinput.mako
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+<p id="${field.oid}">${cstruct}</p>
View
21 richtext.mako
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+<textarea id="${field.oid}"
+ name="${field.name}">${cstruct}</textarea>
+<script language="javascript"
+ type="text/javascript">
+ deform.addCallback(
+ '${field.oid}',
+ function(oid) {
+ tinyMCE.init({
+ mode : 'exact',
+ elements: oid,
+ height: '${field.widget.height}',
+ width: '${field.widget.width}',
+ theme : '${field.widget.theme}',
+ theme_advanced_resizing : true,
+ theme_advanced_toolbar_align : 'left',
+ theme_advanced_toolbar_location : 'top'
+ });
+ }
+ );
+</script>
View
14 select.mako
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+<select name="${field.name}"
+ id="${field.oid}">
+ % for value, description in field.widget.values:
+ <option
+ % if value == cstruct:
+ selected="selected"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ value="${value}">${description}</option>
+% endfor
+</select>
View
59 sequence.mako
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+<%
+rndr = field.renderer
+tmpl = field.widget.item_template
+item_tmpl = field.widget.item_template
+min_len = field.widget.min_len or 0
+max_len = field.widget.max_len or 100000
+now_len = len(subfields)
+prototype = field.widget.prototype(field)
+%>
+<div class="deformSeq" id="${field.oid}">
+
+ <!-- sequence -->
+
+ <input type="hidden" name="__start__" value="${field.name}:sequence"
+ class="deformProto"
+ prototype="${prototype}" />
+
+ <ul>
+ % for tup in subfields:
+ ${rndr(item_tmpl, field=tup[1], cstruct=tup[0], parent=field)}
+
+ <span class="deformInsertBefore"
+ % if min_len:
+ min_len="$min_len"
+ % endif
+ % if max_len:
+ max_len="$max_len"
+ % endif
+ % if now_len:
+ now_len="$now_len"
+ % endif
+ ></span>
+
+ </ul>
+
+ <a href="#"
+ class="deformSeqAdd"
+ id="${field.oid}-seqAdd"
+ onclick="javascript: return deform.appendSequenceItem(this);">
+ <small id="${field.oid}-addtext">${add_subitem_text}</small>
+ </a>
+
+ <script type="text/javascript">
+ deform.addCallback(
+ '${field.oid}',
+ function(oid) {
+ oid_node = $('#'+ oid);
+ deform.processSequenceButtons(oid_node, ${min_len},
+ ${max_len}, ${now_len});
+ }
+ )
+ </script>
+
+ <input type="hidden" name="__end__" value="${field.name}:sequence"/>
+
+ <!-- /sequence -->
+
+</div>
View
31 sequence_item.mako
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+<%
+errstr = 'error-%s' % field.oid
+%>
+% if not field.widget.hidden:
+<li
+ % if field.error and field.widget.error_class:
+ class="${field.widget.error_class}"
+ % endif
+ title="${field.description}">
+ <!-- sequence_item -->
+
+ % if not field.widget.hidden:
+ <span class="deformClosebutton"
+ id="${field.oid}-close"
+ title="Remove"
+ onclick="javascript:deform.removeSequenceItem(this);"></span>
+ % endif
+
+ ${field.serialize(cstruct)}
+
+ % if field.error and not field.widget.hidden:
+ % for index, msg in enumerate(field.error.messages()):
+ <p id=${index==0 and errstr or ('%s-%s' % (errstr, index))}"
+ class="${field.widget.error_class}">${msg}</p>
+ % endfor
+ % endif
+
+ <!-- /sequence_item -->
+</li>
+% endif
View
13 textarea.mako
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+<textarea
+ % if field.widget.rows:
+ rows="${field.widget.rows}"
+ % endif
+ % if field.widget.cols:
+ cols="${field.widget.cols}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}"
+ name="${field.name}">${cstruct}</textarea>
View
36 textinput.mako
@@ -1,21 +1,19 @@
+# -*- coding: utf-8 -*-
<input type="text" name="${field.name}" value="${cstruct}"
- % if field.widget.size:
- size = ${field.widget.size}
- % endif
-
- % if field.widget.css_class:
- class = ${field.widget.css_class}
- % endif
-
- id="${field.oid}"/>
-
+ % if field.widget.size:
+ size="${field.widget.size}"
+ % endif
+ % if field.widget.css_class:
+ class="${field.widget.css_class}"
+ % endif
+ id="${field.oid}"/>
% if field.widget.mask:
- <script type="text/javascript">
- deform.addCallback(
- '${field.oid}',
- function (oid) {
- $("#" + oid).mask("${field.widget.mask}",
- {placeholder:"${field.widget.mask_placeholder}"});
- });
- </script>
-% endif
+<script type="text/javascript">
+ deform.addCallback(
+ '${field.oid}',
+ function (oid) {
+ $("#" + oid).mask("${field.widget.mask}",
+ {placeholder:"${field.widget.mask_placeholder}"});
+ });
+</script>
+% endif
Please sign in to comment.
Something went wrong with that request. Please try again.