Skip to content

Commit 618885e

Browse files
committed
bundle definition, css and style changes
1 parent b1b1bb4 commit 618885e

16 files changed

Lines changed: 144 additions & 187 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
body.template-dynamic-view.userrole-manager,
2+
body.portaltype-dynamicpagerow.template-view {
3+
.dynamic-row {
4+
background-color: #f5f5f5;
5+
padding: 1rem;
6+
margin: 1rem 0;
7+
border-radius: 5px;
8+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
9+
transition: all 0.3s ease;
10+
&:hover {
11+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
12+
background-color: #e5e5e5;
13+
}
14+
&.state-private {
15+
.content {
16+
opacity: 0.3;
17+
}
18+
}
19+
}
20+
}

src/cs_dynamicpages/content/dynamic_page_row.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# from z3c.form.browser.radio import RadioFieldWidget
1212
from zope import schema
1313
from zope.interface import implementer
14-
14+
from plone import api
1515

1616
log = getLogger(__name__)
1717

@@ -32,6 +32,12 @@ class IDynamicPageRow(model.Schema):
3232
class DynamicPageRow(Container):
3333
"""Content-type class for IPortadakoLerroa"""
3434

35+
def review_state(self):
36+
return api.content.get_state(obj=self)
37+
38+
def can_edit(self):
39+
return api.user.has_permission("Modify portal content", obj=self)
40+
3541
def render(self, request):
3642
if self.row_type:
3743
try:

src/cs_dynamicpages/controlpanels/dynamica_pages_control_panel/controlpanel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class IDynamicaPagesControlPanel(Interface):
3535
default=[
3636
{
3737
"row_type": "cs_dynamicpages-featured-view",
38-
"each_row_type_fields": ["title", "description", "image", "link_text", "link_url"],
38+
"each_row_type_fields": ["IBasic.title", "IBasic.description", "IRelatedImage.image", "ILinkInfo.link_text", "ILinkInfo.link_url"],
3939
}
4040
],
4141
)

src/cs_dynamicpages/profiles/default/registry.xml renamed to src/cs_dynamicpages/profiles/default/registry/dynamic_bundle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
>
1010
<value key="enabled">True</value>
1111
<value key="jscompilation">++plone++cs_dynamicpages.edit/edit_dynamicpagerow.js</value>
12-
<value key="csscompilation"></value>
12+
<value key="csscompilation">++plone++cs_dynamicpages.edit/dynamicpageview.css</value>
1313
<value key="depends">plone</value>
1414
<value key="load_async">True</value>
1515
<value key="load_defer">False</value>

src/cs_dynamicpages/views/configure.zcml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77

88
<!-- -*- extra stuff goes here -*- -->
99

10+
<browser:page
11+
name="dynamic-view"
12+
for="plone.app.contenttypes.interfaces.IFolder"
13+
class=".dynamic_view.DynamicView"
14+
template="dynamic_view.pt"
15+
permission="zope2.View"
16+
layer="cs_dynamicpages.interfaces.IBrowserLayer"
17+
/>
1018

1119
<browser:page
1220
name="view"
@@ -17,14 +25,7 @@
1725
layer="cs_dynamicpages.interfaces.IBrowserLayer"
1826
/>
1927

20-
<browser:page
21-
name="dynamic-view"
22-
for="plone.app.contenttypes.interfaces.IFolder"
23-
class=".dynamic_view.DynamicView"
24-
template="dynamic_view.pt"
25-
permission="zope2.View"
26-
layer="cs_dynamicpages.interfaces.IBrowserLayer"
27-
/>
28+
2829

2930
<browser:pages
3031
for="cs_dynamicpages.content.dynamic_page_row.IDynamicPageRow"
@@ -41,6 +42,7 @@
4142
template="horizontal_rule_view.pt"
4243
/>
4344
</browser:pages>
45+
4446
<browser:pages
4547
for="cs_dynamicpages.content.dynamic_page_row.IDynamicPageRow"
4648
class=".query_three_columns_view.QueryThreeColumnsView"
@@ -52,6 +54,7 @@
5254
template="query_three_columns_view.pt"
5355
/>
5456
</browser:pages>
57+
5558
<browser:pages
5659
for="cs_dynamicpages.content.dynamic_page_row.IDynamicPageRow"
5760
class=".slider_view.SliderView"
Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
<html xmlns="http://www.w3.org/1999/xhtml"
2-
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3-
xmlns:metal="http://xml.zope.org/namespaces/metal"
4-
xmlns:tal="http://xml.zope.org/namespaces/tal"
5-
metal:use-macro="context/main_template/macros/master"
6-
i18n:domain="cs_dynamicpages"
7-
>
1+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:i18n="http://xml.zope.org/namespaces/i18n"
2+
xmlns:metal="http://xml.zope.org/namespaces/metal" xmlns:tal="http://xml.zope.org/namespaces/tal"
3+
metal:use-macro="context/main_template/macros/master" i18n:domain="cs_dynamicpages">
84

9-
<body>
10-
11-
12-
<metal:content-main fill-slot="main">
13-
<main id="content">
14-
<tal:define tal:define="
5+
<body>
6+
<metal:content-main fill-slot="main">
7+
<main id="content">
8+
<tal:define tal:define="
159
isAnon context/@@plone_portal_state/anonymous;
1610
">
17-
<tal:conditionisanon tal:condition="isAnon">
18-
<tal:replace tal:replace="python:context.REQUEST.RESPONSE.redirect(context.portal_url(),301)">
19-
</tal:replace>
20-
</tal:conditionisanon>
21-
<tal:conditionisanon tal:condition="not:isAnon">
22-
<div tal:replace="structure python:context.render(request)"></div>
23-
</tal:conditionisanon>
24-
</tal:define>
25-
</main>
26-
</metal:content-main>
27-
</body>
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+
<section class="dynamic-row state-${context/review_state}">
17+
<div class="edit-buttons d-flex" tal:condition="featured/can_edit">
18+
<a href="${featured/absolute_url}/edit">Edit</a>
19+
<span class="ms-auto">Review state: ${featured/review_state}</span>
20+
</div>
21+
<div class="content">
22+
<replace tal:replace="structure python:context.render(request)"></replace>
23+
</div>
24+
</section>
25+
</tal:conditionisanon>
26+
</tal:define>
27+
</main>
28+
</metal:content-main>
29+
</body>
2830

29-
</html>
31+
</html>

src/cs_dynamicpages/views/dynamic_page_row_view.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from zope.interface import implementer
44
from zope.interface import Interface
55

6-
76
# from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
87

98

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
1-
<html xmlns="http://www.w3.org/1999/xhtml"
2-
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3-
xmlns:metal="http://xml.zope.org/namespaces/metal"
4-
xmlns:tal="http://xml.zope.org/namespaces/tal"
5-
metal:use-macro="context/main_template/macros/master"
6-
i18n:domain="cs_dynamicpages"
7-
>
1+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:i18n="http://xml.zope.org/namespaces/i18n"
2+
xmlns:metal="http://xml.zope.org/namespaces/metal" xmlns:tal="http://xml.zope.org/namespaces/tal"
3+
metal:use-macro="context/main_template/macros/master" i18n:domain="cs_dynamicpages">
84

9-
<body>
10-
<metal:main fill-slot="main">
11-
<main id="content">
12-
<tal:features define="
5+
<body>
6+
<metal:main fill-slot="main">
7+
<main id="content">
8+
<tal:features define="
139
features view/features;
1410
">
15-
<tal:featured repeat="brain features">
16-
<div tal:define="
17-
featured brain/getObject;
18-
"
19-
tal:replace="structure python:featured.render(request)"
20-
></div>
21-
</tal:featured>
22-
</tal:features>
23-
</main>
24-
</metal:main>
25-
</body>
11+
<tal:featured repeat="brain features">
12+
<div tal:define="featured brain/getObject;">
13+
<section class="dynamic-row state-${featured/review_state}">
14+
<div class="edit-buttons d-flex gap-2" tal:condition="featured/can_edit">
15+
<a class="btn btn-outline-primary btn-sm align-self-start" href="${featured/absolute_url}">View</a>
16+
<a class="btn btn-outline-primary btn-sm align-self-start" href="${featured/absolute_url}/edit">Edit</a>
17+
<a class="btn btn-outline-primary btn-sm align-self-start" href="${featured/absolute_url}">Move up</a>
18+
<a class="btn btn-outline-primary btn-sm align-self-start" href="${featured/absolute_url}">Move down</a>
19+
<small
20+
class="d-inline-flex ms-auto mb-3 px-2 py-1 fw-semibold text-warning-emphasis bg-warning-subtle border border-warning-subtle rounded-2 position-relative">
21+
Review state: ${featured/review_state}
22+
<span
23+
tal:attributes="class python:featured.review_state() == 'published' and 'position-absolute top-0 start-100 translate-middle p-2 bg-success border border-light rounded-circle' or 'position-absolute top-0 start-100 translate-middle p-2 bg-danger border border-light rounded-circle'">
24+
</span>
25+
</small>
26+
</div>
27+
<div class="content">
28+
<replace tal:replace="structure python:featured.render(request)"></replace>
29+
</div>
30+
</section>
31+
</div>
32+
</tal:featured>
33+
</tal:features>
34+
</main>
35+
</metal:main>
36+
</body>
2637

27-
</html>
38+
</html>
Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1-
<div class="dynamic-featured card text-bg-dark">
1+
<div class="card text-bg-dark">
2+
23
<tal:image tal:define="
34
image view/related_image;
4-
"
5-
tal:condition="image"
6-
>
5+
" tal:condition="image">
76
<img tal:define="
87
images image/@@images;
9-
"
10-
tal:replace="structure python:images.srcset(fieldname='image',
8+
" tal:replace="structure python:images.srcset(fieldname='image',
119
scale_in_src='huge',
1210
sizes='(min-width: 1400px) 1400px, 100vw',
1311
alt=image.Title() ,
14-
title=image.Title())"
15-
/>
12+
title=image.Title())" />
1613
</tal:image>
1714
<div class="card-img-overlay">
1815
<h5 class="card-title">${context/Title}</h5>
19-
<p class="card-text"
20-
tal:condition="context/Description"
21-
>${context/Description}</p>
22-
<a href="${context/link_url}"
23-
tal:condition="context/link_url"
24-
>${context/link_text}</a>
16+
<p class="card-text" tal:condition="context/Description">${context/Description}</p>
17+
<a href="${context/link_url}" tal:condition="context/link_url">${context/link_text}</a>
2518
</div>
26-
</div>
19+
</div>

src/cs_dynamicpages/views/featured_view.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
# from cs_dynamicpages import _
2-
from Products.Five.browser import BrowserView
32
from zope.interface import implementer
43
from zope.interface import Interface
5-
6-
7-
# from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
4+
from cs_dynamicpages.views.dynamic_page_row_view import DynamicPageRowView
85

96

107
class IFeaturedView(Interface):
118
"""Marker Interface for IFeaturedView"""
129

1310

1411
@implementer(IFeaturedView)
15-
class FeaturedView(BrowserView):
16-
# If you want to define a template here, please remove the template from
17-
# the configure.zcml registration of this view.
18-
# template = ViewPageTemplateFile('featured_view.pt')
19-
12+
class FeaturedView(DynamicPageRowView):
2013
def related_image(self):
2114
related_image = self.context.related_image
2215
if related_image:

0 commit comments

Comments
 (0)