How to use the deform.widget.RichTextWidget function in deform

To help you get started, we’ve selected a few deform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pylons / substanced / substanced / scaffolds / substanced / +package+ / resources.py View on Github external
)
from substanced.util import renamer

def context_is_a_document(context, request):
    return request.registry.content.istype(context, 'Document')

class DocumentSchema(Schema):
    name = NameSchemaNode(
        editing=context_is_a_document,
        )
    title = colander.SchemaNode(
        colander.String(),
        )
    body = colander.SchemaNode(
        colander.String(),
        widget=deform.widget.RichTextWidget()
        )

class DocumentPropertySheet(PropertySheet):
    schema = DocumentSchema()

@content(
    'Document',
    icon='glyphicon glyphicon-align-left',
    add_view='add_document',
    )
class Document(Persistent):

    name = renamer()

    def __init__(self, title='', body=''):
        self.title = title
github Pylons / substanced / tutorial / tutorial / tutorial / step08 / resources.py View on Github external
from substanced.schema import Schema
from substanced.content import content
from substanced.property import PropertySheet

from .interfaces import IDocument

class DocumentSchema(Schema):
    name = colander.SchemaNode(
        colander.String(),
        )
    title = colander.SchemaNode(
        colander.String(),
    )
    body = colander.SchemaNode(
        colander.String(),
        widget=deform.widget.RichTextWidget()
    )

class DocumentBasicPropertySheet(PropertySheet):
    schema = DocumentSchema()

    def __init__(self, context, request):
        self.context = context
        self.request = request

    def get(self):
        context = self.context
        return dict(
            name=context.__name__,
            title=context.title,
            body=context.body
        )
github VoteIT / voteit.core / voteit / core / schemas / meeting.py View on Github external
default="This is only visible to participants, so don't put information on how to register here. "
                              "Displayed on the first page of the meeting. You can include things "
                              "like information about the meeting, how to contact the moderator and your logo."),
        missing="",
        widget=deform.widget.RichTextWidget(
            options=(('theme', 'advanced'),)),
        validator=richtext_validator,
    )
    public_description = colander.SchemaNode(
        colander.String(),
        title=_("Public presentation"),
        description=_("meeting_public_description_description",
                      default="The public description is visible on the request access "
                              "page and to not yet logged in visitors."),
        missing="",
        widget=deform.widget.RichTextWidget(options=(('theme', 'advanced'),)),
        validator=richtext_validator, )
    hide_meeting = colander.SchemaNode(
        colander.Bool(),
        title=_("Hide meeting from listings"),
        description=_("hide_meeting_description",
                      default="Users won't be able to find it unless they have a link to it."),
        tab='advanced',
        default=False,
        missing=False
    )
    nav_title = colander.SchemaNode(
        colander.String(),
        title=_("Navigation bar title"),
        description=_(
            "In case you want another title in the navigation bar"),
        missing="",
github liqd / adhocracy3 / src / sdidemo / sdidemo / resources.py View on Github external
docs = interfaces.eq(IDemoContent).execute().all()
    return map(lambda x: (get_oid(x), x.name), docs)

class DocumentSchema(Schema):
    name = NameSchemaNode(
        editing=context_is_a_document,
    )
    title = colander.SchemaNode(
        colander.String(),
    )
    author = colander.SchemaNode(
        colander.String(),
    )
    body = colander.SchemaNode(
        colander.String(),
        widget=deform.widget.RichTextWidget()
    )
    refs = MultireferenceIdSchemaNode(
        choices_getter = get_all_documents,
    )


class DocumentPropertySheet(PropertySheet):
    schema = DocumentSchema()

class BinderPropertySheet(PropertySheet):
    schema = BinderSchema()
    
class IDemoContent(Interface):
    pass

def find_index(context, catalog_name, index_name):
github Pylons / pyramid_cookbook / getting_started / 09-forms / tutorial / views.py View on Github external
import colander
import deform.widget

from pyramid.decorator import reify
from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import get_renderer
from pyramid.view import view_config

from .models import pages


class WikiPage(colander.MappingSchema):
    title = colander.SchemaNode(colander.String())
    body = colander.SchemaNode(
        colander.String(),
        widget=deform.widget.RichTextWidget()
    )


class WikiViews(object):
    def __init__(self, request):
        self.request = request
        renderer = get_renderer("templates/layout.pt")
        self.layout = renderer.implementation().macros['layout']

    @reify
    def wiki_form(self):
        schema = WikiPage()
        return deform.Form(schema, buttons=('submit',))

    @reify
    def reqts(self):
github Pylons / deform / deformdemo / app.py View on Github external
    @view_config(renderer='templates/form.pt', name='sequence_of_richtext')
    @demonstrate('Sequence of Rich Text Widgets')
    def sequence_of_richtext(self):
        class Sequence(colander.SequenceSchema):
            text = colander.SchemaNode(
                colander.String(),
                widget=deform.widget.RichTextWidget(),
                description='Enter some text')
        class Schema(colander.Schema):
            texts = Sequence()
        schema = Schema()
        form = deform.Form(schema, buttons=('submit',))
        return self.render_form(form)
github Kotti / Kotti / kotti / views / edit / content.py View on Github external
description = colander.SchemaNode(
        colander.String(),
        title=_("Description"),
        widget=TextAreaWidget(cols=40, rows=5),
        missing="",
    )
    tags = colander.SchemaNode(
        ObjectType(), title=_("Tags"), widget=deferred_tag_it_widget, missing=[]
    )


class DocumentSchema(ContentSchema):
    body = colander.SchemaNode(
        colander.String(),
        title=_("Body"),
        widget=RichTextWidget(
            # theme='advanced', width=790, height=500
            height=500
        ),
        missing="",
    )


class DocumentAddForm(AddFormView):
    schema_factory = DocumentSchema
    add = Document
    item_type = _("Document")


class DocumentEditForm(EditFormView):
    schema_factory = DocumentSchema
github Pylons / pyramid_cookbook / getting_started / 10-security / tutorial / views.py View on Github external
from pyramid.decorator import reify
from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import get_renderer
from pyramid.security import remember, forget, authenticated_userid
from pyramid.view import view_config, forbidden_view_config

from .models import pages
from .security import USERS


class WikiPage(colander.MappingSchema):
    title = colander.SchemaNode(colander.String())
    body = colander.SchemaNode(
        colander.String(),
        widget=deform.widget.RichTextWidget()
    )


class WikiViews(object):
    def __init__(self, request):
        self.request = request
        renderer = get_renderer("templates/layout.pt")
        self.layout = renderer.implementation().macros['layout']
        self.logged_in = authenticated_userid(request)

    @reify
    def wiki_form(self):
        schema = WikiPage()
        return deform.Form(schema, buttons=('submit',))

    @reify