Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 207 lines (151 sloc) 7.035 kb

collective.z3cform.widgets

Life, the Universe, and Everything

A widget package for Dexterity projects.

collective.z3cform.widgets provides the following widgets:

EnhancedTextLinesFieldWidget

This widget is an ajaxified version of the TextLinesFieldWidget that will allow creation, sort, update and deletion of text lines; degrades to <textarea> if JavaScript is not enabled.

https://github.com/collective/collective.z3cform.widgets/raw/master/enhancedtextlines.png

This widget uses the jQuery TaskPlease plugin.

TokenInputFieldWidget

TokenInputFieldWidget allows your users to select multiple items from portal Subjects list , using autocompletion as they type to find each item. You may have seen a similar type of text entry when filling in the recipients field sending messages on Facebook. This widget will degrade to <textarea> if JavaScript is not enabled.

https://github.com/collective/collective.z3cform.widgets/raw/master/tokeninput.png

This widget uses the jQuery Tokeninput plugin.

If you install collective.z3cform.widgets in a Plone site it will replace every ICategorization subjects field's widget of any Dexterity-based content type with this one.

MultiContentSearchFieldWidget

A widget to add a dynamic list of objects. This works as a widget for related items field so it must be used like this:

relatedItems = RelationList(
    title=_(u'label_related_items', default=u'Related Items'),
    default=[],
    value_type=RelationChoice(title=u"Related",
                  source=ObjPathSourceBinder(portal_type='Document')),
    required=False,
    )
form.widget(relatedItems=MultiContentSearchFieldWidget)

The parameters passed to the ObjPathSourceBinder class are used to filter the search of elements to relate to. If no parameters are passed, a tree structure is shown in the widget.

SimpleRichTextWidget

A lightweight and unbloated Rich Text Editor (RTE / WYSIWYG). These parameters can be configured:

'iframe_height': height in pixels,
'format_block': 'true' or 'false',
'bold': 'true' or 'false',
'italic': 'true' or 'false',
'unordered_list': 'true' or 'false',
'link': 'true' or 'false',
'image': 'true' or 'false',
'allow_disable': 'true' or 'false'

This widget uses the jQuery RTE plugin.

Mostly Harmless

https://secure.travis-ci.org/collective/collective.z3cform.widgets.png?branch=master https://coveralls.io/repos/collective/collective.z3cform.widgets/badge.png?branch=master

Got an idea? Found a bug? Let us know by opening a support ticket.

Don't Panic

Installation

To enable this product in a buildout-based installation:

  1. Edit your buildout.cfg and add collective.z3cform.widgets to the list of eggs to install:

    [buildout]
    ...
    eggs =
        collective.z3cform.widgets
    

After updating the configuration you need to run ''bin/buildout'', which will take care of updating your system.

Go to the 'Site Setup' page in a Plone site and click on the 'Add-ons' link.

Check the box next to collective.z3cform.widgets and click the 'Activate' button.

Note: You may have to empty your browser cache and save your resource registries in order to see the effects of the product installation.

New fields

EnhancedTextLinesFieldWidget

To use this widget we must use a List field or a Tuple field with the value_type as an schema.TextLine() like this:

from collective.z3cform.widgets.enhancedtextlines import EnhancedTextLinesFieldWidget

form.widget(options = EnhancedTextLinesFieldWidget)
options = schema.Tuple(
    title=_(u"Options"),
    value_type=schema.TextLine(),
    missing_value=(),
    )
TokenInputFieldWidget

To use this Widget we must use a List field or a Tuple field with the value_type as a schema.TextLine() like this:

from collective.z3cform.widgets.token_input_widget import TokenInputFieldWidget

form.widget(subjects=TokenInputFieldWidget)
subjects = schema.List(
    title=_(u"Categories"),
    value_type=schema.TextLine(),
    default=[],
    )
MultiContentSearchFieldWidget

The parameters passed to the ObjPathSourceBinder class are used to filter the search of elements to relate to.. if none parameter are passed, a tree structure is shown in the widget:

from collective.z3cform.widgets.multicontent_search_widget import MultiContentSearchFieldWidget

form.widget(relatedItems=MultiContentSearchFieldWidget)
relatedItems = RelationList(
    title=_(u"Related Items"),
    default=[],
    value_type=RelationChoice(title=u"Related",
        source=ObjPathSourceBinder(portal_type='Document')),
    )
SimpleRichTextWidget
TBA

Override existing fields

TBA

Future widgets

The following widgets will be available in this package in the near future:

  • widget to select an option from a list; this widget will degrade to <select> if JavaScript is not enabled.
  • widget to select multiple options from a list; this widget will degrade to <select> if JavaScript is not enabled.

This widgets will probably use the Chosen plugin.

Browsers supported

All modern browsers should be supported (Mozilla Firefox 3.0+, Google Chrome 7.0+, Apple Safari 4.0+, Opera 10.0+ and Microsoft Internet Explorer 9.0+).

See also

Not entirely unlike

collective.z3cform.datagridfield
Version of DataGridField for use with Dexterity / z3c.form.
plone.app.widgets
A revamp of Plone widgets, it does this by overriding the widgets of some of the fields in Plone.
Something went wrong with that request. Please try again.