跳转到主要内容

Plone的HTML5小部件

项目描述

简介

此插件提供了以下HTML5小部件

  • color

  • contenteditable (+wysiwyg)

  • datalist

  • date

  • datetime

  • datetime-local

  • email

  • month

  • number

  • password

  • range

  • search

  • tel

  • time

  • url

  • week

状态:年轻

待办事项

  • 尽可能减少复制/粘贴

  • 添加测试

  • 添加对datalist的支持

  • 为Text和TextLine添加contenteditable小部件

如何安装

此插件可以像其他插件一样安装。请遵循官方文档。它不提供任何配置文件,所以您只需将其添加到您的zope安装中。

如果您想在无法使用的浏览器上支持这些小部件,您必须考虑使用polyfill。

提供polyfill的一些插件

  • collective.js.webshims

小部件审查与支持

datalist

color

与zope.schema.ASCIILine字段一起使用

from zope import schema
from zope import interface
from z3c.form import form, field
from collective.z3cform.html5widgets.widget_color import ColorFieldWidget
class ExampleSchema(interface.Interface):
    color = schema.ASCIILine(title=u"Color", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)
    fields['color'].widgetFactory = ColorFieldWidget

contenteditable

浏览器支持

  • Chrome: 4.0+

  • Safari: 3.1+

  • Safari移动: 5.0+

  • Firefox: 3.5+

  • Opera: 9.0+

  • Opera mini/mobile: N/A

  • Internet Explore: 5.5 (sic)

  • Android: 3.0+

示例

from zope import schema
from zope import interface
from z3c.form import form, field
class ExampleSchema(interface.Interface):
    pass
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)

date

示例

from zope import schema
from zope import interface
from z3c.form import form, field

class ExampleSchema(interface.Interface):
    date = schema.Date(title=u"Date (created)", required=False)

class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)

datetime

示例

from zope import schema
from zope import interface
from z3c.form import form, field
class ExampleSchema(interface.Interface):
    datetime = schema.Datetime(title=u"Date time (modified)", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)

datetime-local

示例

from zope import schema
from zope import interface
from z3c.form import form, field
class ExampleSchema(interface.Interface):
    datetime = schema.Datetime(title=u"Date time (modified)", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)

email

示例

from zope import schema
from zope import interface
from z3c.form import form, field
from collective.z3cform.html5widgets.widget_email import EmailFieldWidget
class ExampleSchema(interface.Interface):
    email = schema.ASCIILine(title=u"Email", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)
    fields['email'].widgetFactory = EmailFieldWidget

month

示例

from zope import schema
from zope import interface
from z3c.form import form, field
from collective.z3cform.html5widgets.widget_month import MonthFieldWidget
class ExampleSchema(interface.Interface):
    month = schema.Date(title=u"Month", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)
    fields['month'].widgetFactory = MonthFieldWidget

number

示例

from zope import schema
from zope import interface
from z3c.form import form, field
from collective.z3cform.html5widgets.widget_number import NumberFieldWidget
class ExampleSchema(interface.Interface):
    number = schema.Int(title=u"Number", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)
    fields['number'].widgetFactory = NumberFieldWidget

password

示例

from zope import schema
from zope import interface
from z3c.form import form, field
class ExampleSchema(interface.Interface):
    password = schema.Password(title=u"Password", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)

range

示例

from zope import schema
from zope import interface
from z3c.form import form, field
from collective.z3cform.html5widgets.widget_range import RangeFieldWidget
class ExampleSchema(interface.Interface):
    range = schema.Int(title=u"Range", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)
    fields['range'].widgetFactory = RangeFieldWidget

tel

示例

from zope import schema
from zope import interface
from z3c.form import form, field
from collective.z3cform.html5widgets.widget_tel import TelFieldWidget
class ExampleSchema(interface.Interface):
    tel = schema.ASCIILine(title=u"Telephone", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)
    fields['tel'].widgetFactory = TelFieldWidget

time

示例

from zope import schema
from zope import interface
from z3c.form import form, field
class ExampleSchema(interface.Interface):
    time = schema.Time(title=u"Time", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)

url

示例

from zope import schema
from zope import interface
from z3c.form import form, field
class ExampleSchema(interface.Interface):
    url = schema.URI(title=u"URL", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)

week

示例

from zope import schema
from zope import interface
from z3c.form import form, field
from collective.z3cform.html5widgets.widget_week import WeekFieldWidget
class ExampleSchema(interface.Interface):
    week = schema.Date(title=u"Week", required=False)
class ExampleForm(form.Form):
    fields = field.Fields(ExampleSchema)
    fields['week'].widgetFactory = WeekFieldWidget

致谢

公司

人物

变更日志

0.1 (2013-03-21)

  • 使用templer创建的包 [JeanMichel aka toutpt]

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码发行版

collective.z3cform.html5widgets-0.1.zip (50.6 kB 查看哈希值)

上传时间 源代码

支持