Conjunto de mudanças 6489 no repositório publico


Ignorar:
Timestamp:
13/06/2012 15:56:36 (9 anos atrás)
Autor:
mazza
Mensagem:

boxes: campo Text com WysiwygFieldWidget?

Localização:
PortalInterlegis/produtos/il.portalinterlegis/trunk
Arquivos:
2 adicionados
5 editados

Legenda:

Não Modificado
Adicionado
Removido
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/setup.py

    r6478 r6489  
    3131          'five.grok',
    3232          'plone.app.theming',
    33           # -*- Extra requirements: -*-
     33          'z3c.form',
     34          'plone.directives.form',
    3435      ],
    3536      extras_require={'test': ['plone.app.testing', 'mock']},
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/boxes.py

    r6483 r6489  
    66from five.grok.components import ZopeTwoPageTemplate
    77from persistent.dict import PersistentDict
    8 from z3c.form import form, field, datamanager
     8from plone.autoform.form import AutoExtensibleForm
     9from z3c.form import form, datamanager
    910from z3c.form.interfaces import IDataManager
    1011from zope.annotation import IAnnotations
     
    2021    implements(IDataManager)
    2122provideAdapter(PersistentDictionaryField)
     23
    2224
    2325class BoxManager(object):
     
    3537        # is from https://mail.zope.org/pipermail/grok-dev/2008-July/005999.html
    3638        # (plone.directives.form.EditForm did not work well)
    37         class BoxEditForm(form.EditForm, grok.View):
     39        class BoxEditForm(AutoExtensibleForm, form.EditForm, grok.View):
    3840            grok.context(IFolderish)
    3941            grok.name(self._box_name_for_url(number))
     
    4143
    4244            label = self.form_label
    43             fields = field.Fields(self.schema)
     45            schema = self.schema
    4446
    4547            def getContent(form_self):
    4648                return self.box_content(form_self.context, number)
     49
     50            def render(self):
     51                # we cannot simply associtate this template in the class level
     52                # because form.EditForm has a ".render()" method and grok.View
     53                # assumes you cannot have both "template = ..." and ".render()".
     54                # No problem, we make a method that simply renders the template
     55                template = ZopeTwoPageTemplate(filename="boxform.pt")
     56                return template.render(self)
    4757
    4858        globals()['BoxEditForm_%s' % self._box_key(number)] = BoxEditForm
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/interfaces.py

    r6482 r6489  
    11# -*- coding: utf-8 -*-
     2from plone.app.z3cform.wysiwyg import WysiwygFieldWidget
     3from plone.autoform.interfaces import WIDGETS_KEY
     4from plone.directives import form
    25from zope import schema
    36from zope.interface import Interface
    47
     8
    59# TODO: tive de mover isso pra ca (veio de boxes) por causa de um import circular
    610template_dict = {}
     11
     12# decorator
    713def template(t):
    814    def f(cls):
    915        template_dict[cls] = t
     16        return cls
     17    return f
     18
     19# decorator
     20def with_widget(**kwargs):
     21    def f(cls):
     22        cls.setTaggedValue(WIDGETS_KEY, kwargs)
    1023        return cls
    1124    return f
     
    3750# BOX INTERFACES
    3851
     52
    3953@template('''
    4054      <div class="simple-box">
     
    4559        </p>
    4660      </div>''')
    47 class ISimpleBox(Interface):
     61@with_widget(text=WysiwygFieldWidget)
     62class ISimpleBox(form.Schema):
    4863    title = schema.TextLine(title=u"Título", required=True)
    4964    subtitle = schema.TextLine(title=u"Subtítulo", required=True)
    50     text = schema.TextLine(title=u"Texto", required=True)
     65    text = schema.Text(title=u"Texto", required=False)
    5166
    5267@template('''
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/static/js/editable-box.js

    r6487 r6489  
    2222        .appendTo($(this))
    2323        .prepOverlay({
    24             subtype: 'ajax',
     24            subtype: 'iframe',
    2525            filter: '#content',
    2626            formselector: 'form',
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/static/rules.xml

    r6488 r6489  
    55    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    66    css:if-content="#visual-portal-wrapper">
    7 
    8     <theme href="index.html" />
    97
    108        <!-- as pointed out in https://dev.plone.org/ticket/11829 -->
     
    1513    <notheme if-path="table.htm"/>
    1614    <notheme if-path="attributes.htm"/>
     15
     16    <theme href="box_form.html" css:if-content="#box-preview"/>
     17    <theme href="index.html" />
    1718
    1819    <before theme-children='/html/head' content-children='/html/head'/>
Note: Veja TracChangeset para ajuda no uso do visualizador de conjunto de mudanças.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.