Conjunto de mudanças 6079 no repositório publico


Ignorar:
Timestamp:
29/02/2012 15:05:13 (8 anos atrás)
Autor:
lucasaquino
Mensagem:

Registra tile related

Localização:
PortalInterlegis/produtos/il.portal.theme/trunk/il/portal/theme/browser
Arquivos:
3 editados

Legenda:

Não Modificado
Adicionado
Removido
  • PortalInterlegis/produtos/il.portal.theme/trunk/il/portal/theme/browser/configure.zcml

    r6072 r6079  
    44    xmlns:plone="http://namespaces.plone.org/plone"
    55    i18n_domain="il.portal.theme">
     6
     7  <includeDependencies package="." />
    68
    79  <!-- Browser layer registration -->
     
    1214      name="il_portal_theme"
    1315      />
     16 
     17
     18  <browser:page
     19    for="*"
     20    name="test-relation-widget"
     21    class=".demo.TestView"
     22    permission="cmf.ModifyPortalContent"
     23    />
     24 
    1425
    1526  <!--  View Registration -->
     
    5667      for="*"
    5768      />
    58 
     69 
     70  <plone:tile
     71      name="ilportal.tiles.relateditens"
     72      title="Portal Interlegis related items tile"
     73      description="Itens relacionados"
     74      add_permission="cmf.ModifyPortalContent"
     75      schema=".tile.IRelatedItensTileData"
     76      class=".tile.RelatedItensTile"
     77      permission="zope2.View"
     78      for="*"
     79      />
    5980 
    6081
  • PortalInterlegis/produtos/il.portal.theme/trunk/il/portal/theme/browser/templates/paginainicial.pt

    r6077 r6079  
    1111        <div class="bottom-plan">
    1212            <div tal:attributes="data-tile string:${context/absolute_url}/@@ilportal.tiles.plaintext/bottom-plan-tile" />
    13         </div>       
     13        </div>
     14        <div class="related">
     15            <div tal:attributes="data-tile string:${context/absolute_url}/@@ilportal.tiles.relateditens/itens-relacionados" />
     16        </div>   
    1417    </div>
    1518</body>
  • PortalInterlegis/produtos/il.portal.theme/trunk/il/portal/theme/browser/tile.py

    r6072 r6079  
    11from zope.interface import Interface
    2 
     2from z3c.form import form, field
     3from plone.z3cform import layout
    34from plone import tiles
    45from zope.schema import Text
     
    67from plone.app.textfield.interfaces import ITransformer
    78
     9from z3c.relationfield.schema import RelationChoice, RelationList
     10
     11from plone.formwidget.autocomplete.widget import (
     12    AutocompleteMultiFieldWidget,
     13    )
     14from plone.formwidget.contenttree import (
     15    ContentTreeFieldWidget,
     16    ObjPathSourceBinder,
     17    )
     18
    819
    920class IRichTextTileData(Interface):
    10 
     21   
    1122    text = RichText(title=u'Text')
    12 
    1323
    1424class RichTextTile(tiles.PersistentTile):
     
    2131                text = transformer(self.data['text'], 'text/x-html-safe')
    2232        return '<html><body>%s</body></html>' % text
    23        
    24        
     33
    2534class IPlainTextTileData(Interface):
    2635   
     
    3443            text = self.data['text']
    3544        return '<html><body>%s</body></html>' % text
     45
     46class IRelatedItensTileData(Interface):
     47   
     48    related_itens = RelationChoice(title=u"Escolha o item relacionado",
     49                       required=False,
     50                       source=ObjPathSourceBinder())
     51   
     52    #import pdb;pdb.set_trace()
     53   
     54class RelatedForm(form.EditForm):
     55    fields = field.Fields(IRelatedItensTileData)
     56    fields['related_itens'].widgetFactory = ContentTreeFieldWidget
     57   
     58RelatedView = layout.wrap_form(RelatedForm)
     59
     60class RelatedItensTile(tiles.PersistentTile):
     61
     62    def __call__(self):
     63        relateditens = ''
     64        if self.data['related_itens']:
     65            relateditens = self.data['related_itens']
     66        return '<html><body>%s</body></html>' % relateditens
     67   
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.