Permalink
Browse files

first stab at complete set

  • Loading branch information...
1 parent ad5aa01 commit c6d263d4676c62704ace83ff003fa1605f8e3c1f @mfeif mfeif committed Jun 30, 2011
View
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+<input type="hidden" name="${field.name}" value="${cstruct}"
+ id="${field.oid}"/>
+
Oops, something went wrong.

0 comments on commit c6d263d

Please sign in to comment.