-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/collective/z3cform/norobots/plone_forms/simpleform-with-macro.pt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
xmlns:metal="http://xml.zope.org/namespaces/metal" | ||
xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
lang="en" | ||
metal:use-macro="context/@@main_template/macros/master" | ||
xml:lang="en" | ||
i18n:domain="plone" | ||
> | ||
|
||
<body> | ||
<metal:main fill-slot="content"> | ||
|
||
|
||
<metal:block fill-slot="content-core"> | ||
|
||
<form enctype="multipart/form-data" | ||
data-pat-autotoc="levels: legend; section: fieldset; className: autotabs" | ||
tal:attributes=" | ||
id view/form_instance/id; | ||
action view/form_instance/action; | ||
method view/form_instance/method; | ||
" | ||
> | ||
|
||
<div> | ||
<tal:field tal:replace="structure view/form_instance/widgets/fullname/@@ploneform-render-widget" /> | ||
</div> | ||
|
||
<div metal:use-macro="container/norobots_macro/macros/norobots_macro"> | ||
Norobots Macro goes here | ||
</div> | ||
|
||
<div class="formControls" | ||
tal:condition="view/form_instance/actions/values|nothing" | ||
> | ||
<tal:block repeat="action view/form_instance/actions/values"> | ||
<input type="submit" | ||
tal:replace="structure action/render" | ||
/> | ||
</tal:block> | ||
</div> | ||
|
||
|
||
<tal:block tal:condition="view/form_instance/enableCSRFProtection|nothing" | ||
tal:replace="structure context/@@authenticator/authenticator" | ||
/> | ||
|
||
</form> | ||
|
||
|
||
</metal:block> | ||
|
||
|
||
|
||
</metal:main> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from collective.z3cform.norobots.i18n import norobotsMessageFactory as _ | ||
from plone.z3cform.layout import FormWrapper | ||
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile | ||
from z3c.form import button | ||
from z3c.form import field | ||
from z3c.form import form | ||
from zope import schema | ||
from zope.interface import Interface | ||
|
||
|
||
class ISimpleForm(Interface): | ||
fullname = schema.TextLine( | ||
title=_("Name"), | ||
description=_("Please enter your full name."), | ||
required=False, | ||
) | ||
|
||
|
||
class SimpleForm(form.Form): | ||
fields = field.Fields(ISimpleForm) | ||
ignoreContext = True # don't use context to get widget data | ||
id = "simpleform" | ||
|
||
@button.buttonAndHandler(_("Send")) | ||
def handle_send(self, action): | ||
data, errors = self.extractData() | ||
|
||
|
||
class SimpleFormView(FormWrapper): | ||
|
||
form = SimpleForm | ||
|
||
index = ViewPageTemplateFile("simpleform-with-macro.pt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters