Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install jquery.widget

How to install jquery.widget

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install jquery.widget
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1.0c1 Available View build log
Windows (64-bit)
0.1.0c1 Available View build log
Mac OS X (10.5+)
0.1.0c1 Available View build log
Linux (32-bit)
0.1.0c1 Available View build log
Linux (64-bit)
0.1.0c1 Available View build log
 
License
ZPL 2.1
Lastest release
version 0.1.0c1 on Jan 5th, 2011

This package contains a collection of JQuery-based widgets.

  • Rest Editor Widget

Detailed Documentation

Rest Editor Widget

The jquery.resteditorre package provides a javascript which can render a toolbar above a testarea widget. This toolbar offers buttons which can be used for apply reStructuredText formatters to the text in the textarea.

We can't demonstrate this here because it's all done in javascript. The reStructuredText editor textarea looks exactly how a normal z3c.form textarea looks. Btw. any textarea can use this package, there is no need for using the implemented RESTEditorWidget. But anyway such a textarea widget looks like:

>>> import zope.schema
>>> from z3c.form import widget
>>> from z3c.form import testing
>>> from jquery.widget.resteditor.browser import RESTEditorFieldWidget

We have to define a text field and a test request for instantiate the widget:

>>> text = zope.schema.Text(
...     title=u'Text',
...     description=u'Text field'
...     )
>>> widget = RESTEditorFieldWidget(text, testing.TestRequest())
>>> widget
<RESTEditorWidget ''>

Before we can render the widget, we need to register a template This template is normaly registered by the z3c.form framework. Let's do it here since we not use a real site setup.

>>> from zope.configuration import xmlconfig
>>> import zope.component
>>> import z3c.form
>>> xmlconfig.XMLConfig('meta.zcml', zope.component)()
>>> xmlconfig.XMLConfig('meta.zcml', z3c.form)()
>>> xmlconfig.XMLConfig('configure.zcml', z3c.form)()

Now we can render the widget:

>>> widget.update()
>>> print widget.render()
<textarea id="" name="" class="restEditorWidget"></textarea>

As you can see the reStructuredText editor widget uses a css class called restEditorWidget. this class can be used for apply a JQuery xpath rule and load the JQuery method restEditor.

This can be done like:

$('.restEditorWidget').restEditor();

Of corse you can do this inside a global JQuery dom onload event handler call. If so, you can use something like this:

$(document).ready(function() { $('.restEditorWidget').restEditor(); });

Note, there is also a sample located at http://www.z3c.org/samples

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:2

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.