Skip to content

Commit 403178c

Browse files
committed
three columns query row
1 parent 2ba7ee3 commit 403178c

6 files changed

Lines changed: 69 additions & 42 deletions

File tree

src/cs_dynamicpages/profiles/default/types/DynamicPageRow.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<element value="plone.locking" />
4343
<element value="cs_dynamicpages.link_info" />
4444
<element value="cs_dynamicpages.related_image" />
45+
<element value="plone.collection" />
4546
<!--<element value="plone.leadimage"/>-->
4647
<!--<element value="plone.relateditems"/>-->
4748
<!--<element value="plone.richtext"/>-->

src/cs_dynamicpages/views/configure.zcml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<!-- -*- extra stuff goes here -*- -->
88

99
<browser:page
10-
name="dynamic-page-row-view"
11-
for="*"
10+
name="view"
11+
for="cs_dynamicpages.content.dynamic_page_row.IDynamicPageRow"
1212
class=".dynamic_page_row_view.DynamicPageRowView"
1313
template="dynamic_page_row_view.pt"
1414
permission="zope2.View"
15-
layer="cs_dynamicpages.interfaces.ICsDynamicpagesLayer"
15+
layer="cs_dynamicpages.interfaces.IBrowserLayer"
1616
/>
1717

1818
<browser:page
@@ -31,13 +31,20 @@
3131
permission="zope2.View"
3232
>
3333
<browser:page
34-
template="featured_view.pt"
3534
name="cs_dynamicpages-featured-view"
35+
template="featured_view.pt"
3636
/>
3737
<browser:page
3838
name="cs_dynamicpages-horizontal-rule-view"
3939
template="horizontal_rule_view.pt"
4040
/>
41+
</browser:pages>
42+
<browser:pages
43+
for="cs_dynamicpages.content.dynamic_page_row.IDynamicPageRow"
44+
class=".query_three_columns_view.QueryThreeColumnsView"
45+
layer="cs_dynamicpages.interfaces.IBrowserLayer"
46+
permission="zope2.View"
47+
>
4148
<browser:page
4249
name="cs_dynamicpages-query-three-columns-view"
4350
template="query_three_columns_view.pt"
Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,23 @@
1-
<html xmlns="http://www.w3.org/1999/xhtml"
2-
xmlns:metal="http://xml.zope.org/namespaces/metal"
3-
xmlns:tal="http://xml.zope.org/namespaces/tal"
4-
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
5-
i18n:domain="cs_dynamicpages"
6-
metal:use-macro="context/main_template/macros/master">
7-
<body>
8-
9-
<metal:custom_title fill-slot="content-title">
10-
<h1 tal:replace="structure context/@@title" />
11-
12-
<!-- @@title view template: -->
13-
<!--
14-
<h1 tal:define="title context/Title" tal:condition="title" tal:content="title">
15-
Title or id
16-
</h1>
17-
-->
18-
19-
</metal:custom_title>
1+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:metal="http://xml.zope.org/namespaces/metal"
2+
xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3+
i18n:domain="cs_dynamicpages" metal:use-macro="context/main_template/macros/master">
204

21-
<metal:custom_description fill-slot="content-description">
22-
<p tal:replace="structure context/@@description" />
23-
</metal:custom_description>
24-
25-
<metal:content-core fill-slot="content-core">
26-
<metal:block define-macro="content-core">
5+
<body>
276

28-
<h2>Main content</h2>
29-
<!--<div tal:replace="view/my_custom_view_method" />-->
30-
<!--<div tal:replace="context/my_custom_field" />-->
317

32-
</metal:block>
33-
</metal:content-core>
8+
<metal:content-main fill-slot="main">
9+
<main id="content">
10+
<tal:define tal:define="isAnon context/@@plone_portal_state/anonymous">
11+
<tal:conditionisAnon tal:condition="isAnon">
12+
<tal:replace tal:replace="python:context.REQUEST.RESPONSE.redirect(context.portal_url(),301)">
13+
</tal:replace>
14+
</tal:conditionisAnon>
15+
<tal:conditionisAnon tal:condition="not:isAnon">
16+
<div tal:replace="structure python:context.render(request)"></div>
17+
</tal:conditionisAnon>
18+
</tal:define>
19+
</main>
20+
</metal:content-main>
3421
</body>
35-
</html>
22+
23+
</html>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<hr class="border border-primary border-3 opacity-75">
1+
<hr class="my-5 border border-primary border-3 opacity-75">
Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1-
<section tal:define="elements view/elements">
1+
<section tal:define="batch view/results">
2+
<h2 class="mb-5">${context/Title}</h2>
3+
<div class="row">
4+
<tal:repeat tal:repeat="brain batch">
5+
<tal:define tal:define="
6+
element brain/getObject;
7+
">
8+
<div class="col-md-4">
9+
<div class="card">
10+
<tal:image tal:define="image element/image" tal:condition="image">
11+
<img tal:define="
12+
images element/@@images;
13+
" tal:replace="structure python:images.srcset(fieldname='image',
14+
scale_in_src='huge',
15+
sizes='(min-width: 1400px) 400px, 100vw',
16+
alt=element.Title() ,
17+
title=element.Title())" />
18+
</tal:image>
19+
<div class="card-body">
20+
<h5 class="card-title">${element/Title}</h5>
21+
<p class="mb-3" tal:content="python:element.toLocalizedTime(element.EffectiveDate())"></p>
22+
<p class="card-text">${element/Description}</p>
23+
</div>
24+
</div>
25+
</div>
26+
27+
</tal:define>
28+
</tal:repeat>
29+
</div>
30+
<div class="mt-5 d-flex justify-content-end">
31+
<a href="${context/link_url}" tal:condition="context/link_url">${context/link_text}</a>
32+
</div>
233

334
</section>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# -*- coding: utf-8 -*-
22

33
# from cs_dynamicpages import _
4-
from Products.Five.browser import BrowserView
54
from zope.interface import implementer
65
from zope.interface import Interface
7-
6+
from plone.app.contenttypes.browser.collection import CollectionView
87
# from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
98

109
class IQueryThreeColumnsView(Interface):
1110
""" Marker Interface for IQueryThreeColumnsView"""
1211

1312

1413
@implementer(IQueryThreeColumnsView)
15-
class QueryThreeColumnsView(BrowserView):
14+
class QueryThreeColumnsView(CollectionView):
1615
# If you want to define a template here, please remove the template from
1716
# the configure.zcml registration of this view.
1817
# template = ViewPageTemplateFile('query_three_columns_view.pt')
1918

20-
def elements(self):
21-
import pdb; pdb.set_trace(); a=1
19+
def __call__(self):
20+
# Implement your own actions:
21+
return self.index()
2222

0 commit comments

Comments
 (0)