CMCuritiba / cmcuritiba.portalmodelo.theme

Tema da Câmara Municipal de Curitiba para o Portal Modelo do Interlegis
GNU General Public License v3.0
2 stars 0 forks source link

Customizar template de notícias pelo tema. #33

Closed ramiroluz closed 3 years ago

ramiroluz commented 3 years ago

O template padrão exibe a notícia com as imagens miniatura, além disso deixa um espaço em branco ao final da notícia.

O código abaixo está sendo usado por uma customização diretamente pela web. O nome da view com caminho dentro do plone é: /portal_skins/plone_content/newsitem_view

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      metal:use-macro="context/main_template/macros/master"
      i18n:domain="plone">
<body>

<metal:content-core fill-slot="content-core">
    <metal:block define-macro="content-core"
          tal:define="kssClassesView context/@@kss_field_decorator_view;
                      getKssClasses nocall:kssClassesView/getKssClassesInlineEditable;
                      templateId template/getId;
                      text python:context.CookedBody(stx_level=2);
                      len_text python:len(text.strip())">

        <div class="newsImageContainer"
             tal:condition="context/getImage|nothing">
            <a href="#"
               tal:define="here_url context/@@plone_context_state/object_url;"
               tal:attributes="href string:$here_url/image/image_view_fullscreen"
               id="parent-fieldname-image">
               <img tal:replace="structure python: context.tag(scale='large', css_class='newsImage')" src="" alt="" />
            </a>
            <p class="discreet" tal:condition="context/imageCaption|nothing">
              <metal:field use-macro="python:context.widget('imageCaption', mode='view')">
              Image Caption
              </metal:field>
            </p>
        </div>

        <p tal:define="is_editable context/@@plone_context_state/is_editable"
           tal:condition="python: not len_text and is_editable"
           i18n:translate="no_body_text"
           class="discreet">
            This item does not have any body text, click the edit tab to change it.
        </p>

        <div metal:define-macro="text-field-view"
             id="parent-fieldname-text" class="stx"
             tal:define="kss_class python:getKssClasses('text',
                         templateId=templateId, macro='text-field-view');
                         text text|context/getText|nothing"
             tal:condition="text"
             tal:attributes="class python:test(context.Format() in ('text/structured',
                                                   'text/x-rst', ), 'stx' + kss_class, 'plain' + kss_class)">
            <div metal:define-slot="inside" tal:replace="structure text">The body</div>
        </div>
    </metal:block>
</metal:content-core>

</body>
</html>