Skip to content

Commit 46d4297

Browse files
committed
format and lint
1 parent 7b8979f commit 46d4297

8 files changed

Lines changed: 173 additions & 98 deletions
Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,42 @@
1-
<div 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-
class="accordion shadow-sm mb-4" id="accordionDynamicPage-${context/id}" tal:define="
1+
<div 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+
class="accordion shadow-sm mb-4"
6+
id="accordionDynamicPage-${context/id}"
7+
tal:define="
48
elements view/elements;
5-
" tal:condition="elements">
6-
<div class="accordion-item border-0 border-bottom" tal:repeat="brain elements">
9+
"
10+
tal:condition="elements"
11+
>
12+
<div class="accordion-item border-0 border-bottom"
13+
tal:repeat="brain elements"
14+
>
715
<div class="accordion-header h3 m-0">
816
<button class="accordion-button collapsed fw-bold fs-5 bg-white text-dark"
9-
aria-controls="accordionDynamicPage-${context/id}-${brain/id}" aria-expanded="false" type="button"
10-
data-bs-target="#accordionDynamicPage-${context/id}-${brain/id}" data-bs-toggle="collapse">
17+
aria-controls="accordionDynamicPage-${context/id}-${brain/id}"
18+
aria-expanded="false"
19+
type="button"
20+
data-bs-target="#accordionDynamicPage-${context/id}-${brain/id}"
21+
data-bs-toggle="collapse"
22+
>
1123
${brain/Title}
1224
</button>
1325
</div>
14-
<div class="accordion-collapse collapse" id="accordionDynamicPage-${context/id}-${brain/id}"
15-
data-bs-parent="#accordionDynamicPage-${context/id}">
16-
<div class="accordion-body bg-light" tal:define="
26+
<div class="accordion-collapse collapse"
27+
id="accordionDynamicPage-${context/id}-${brain/id}"
28+
data-bs-parent="#accordionDynamicPage-${context/id}"
29+
>
30+
<div class="accordion-body bg-light"
31+
tal:define="
1732
element brain/getObject;
18-
">
19-
<tal:replace tal:condition="element/text" replace="structure element/text/output">
33+
"
34+
>
35+
<tal:replace tal:condition="element/text"
36+
replace="structure element/text/output"
37+
>
2038
</tal:replace>
2139
</div>
2240
</div>
2341
</div>
24-
</div>
42+
</div>
Lines changed: 85 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,99 @@
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">
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+
>
48

5-
<body>
9+
<body>
610

7-
<metal:custom_title fill-slot="content-title">
8-
<h1 i18n:translate="">
11+
<metal:custom_title fill-slot="content-title">
12+
<h1 i18n:translate="">
913
Dynamic Pages Templates management
10-
</h1>
11-
</metal:custom_title>
14+
</h1>
15+
</metal:custom_title>
1216

13-
<metal:custom_description fill-slot="content-description">
17+
<metal:custom_description fill-slot="content-description">
1418

15-
</metal:custom_description>
19+
</metal:custom_description>
1620

17-
<metal:content-core fill-slot="content-core">
18-
<metal:block define-macro="content-core">
21+
<metal:content-core fill-slot="content-core">
22+
<metal:block define-macro="content-core">
1923

2024

2125

22-
<ul class="list-group">
23-
<li class="list-group-item d-flex justify-content-between align-items-start"
24-
tal:repeat="template view/available_templates">
25-
<ul>
26-
<li><span i18n:translate="">Name</span>:
27-
<span tal:replace="template/name"></span>
28-
</li>
29-
<li><span i18n:translate="">Content title</span>:
30-
<span tal:replace="template/Title"></span>
31-
(<span tal:replace="template/translated_portal_type"></span>)
32-
</li>
33-
<li><a class="btn btn-outline-primary btn-sm" href="${template/absolute_url}" target="_blank"
34-
data-template-name="${template/name}" i18n:translate="">See template</a></li>
35-
</ul>
26+
<ul class="list-group">
27+
<li class="list-group-item d-flex justify-content-between align-items-start"
28+
tal:repeat="template view/available_templates"
29+
>
30+
<ul>
31+
<li><span i18n:translate="">Name</span>:
32+
<span tal:replace="template/name"></span>
33+
</li>
34+
<li><span i18n:translate="">Content title</span>:
35+
<span tal:replace="template/Title"></span>
36+
(<span tal:replace="template/translated_portal_type"></span>)
37+
</li>
38+
<li><a class="btn btn-outline-primary btn-sm"
39+
href="${template/absolute_url}"
40+
target="_blank"
41+
data-template-name="${template/name}"
42+
i18n:translate=""
43+
>See template</a></li>
44+
</ul>
3645

37-
<a class="btn btn-sm btn-danger btn-delete-element" href="#" title="Delete"
38-
data-bs-target="#deleteElementModal-${repeat/template/number}" data-bs-toggle="modal"
39-
i18n:attributes="title">
40-
<tal:icon tal:replace="structure python:icons.tag('trash')" />
41-
</a>
42-
<div class="modal fade" id="deleteElementModal-${repeat/template/number}" aria-hidden="true"
43-
aria-labelledby="deleteElementModalLabel-${repeat/template/number}" tabindex="-1">
44-
<div class="modal-dialog">
45-
<div class="modal-content">
46-
<div class="modal-header">
47-
<h2 id="deleteElementModalLabel-${repeat/template/number}" i18n:translate="">
48-
Confirm Deletion</h5>
49-
<button class="btn-close" aria-label="Close" type="button" data-bs-dismiss="modal"
50-
i18n:attributes="aria-label"></button>
51-
</div>
52-
<div class="modal-body">
53-
<p i18n:translate="">Are you sure you want to delete this item? This action cannot be undone.</p>
54-
</div>
55-
<div class="modal-footer">
56-
<button class="btn btn-secondary" type="button" data-bs-dismiss="modal"
57-
i18n:translate="">Cancel</button>
58-
<button class="btn btn-danger confirmDeleteElement" type="button" data-uid="${template/uid}"
59-
i18n:translate="">Delete</button>
46+
<a class="btn btn-sm btn-danger btn-delete-element"
47+
href="#"
48+
title="Delete"
49+
data-bs-target="#deleteElementModal-${repeat/template/number}"
50+
data-bs-toggle="modal"
51+
i18n:attributes="title"
52+
>
53+
<tal:icon tal:replace="structure python:icons.tag('trash')" />
54+
</a>
55+
<div class="modal fade"
56+
id="deleteElementModal-${repeat/template/number}"
57+
aria-hidden="true"
58+
aria-labelledby="deleteElementModalLabel-${repeat/template/number}"
59+
tabindex="-1"
60+
>
61+
<div class="modal-dialog">
62+
<div class="modal-content">
63+
<div class="modal-header">
64+
<h2 id="deleteElementModalLabel-${repeat/template/number}"
65+
i18n:translate=""
66+
>
67+
Confirm Deletion
68+
<button class="btn-close"
69+
aria-label="Close"
70+
type="button"
71+
data-bs-dismiss="modal"
72+
i18n:attributes="aria-label"
73+
></button>
74+
</h2></div>
75+
<div class="modal-body">
76+
<p i18n:translate="">Are you sure you want to delete this item? This action cannot be undone.</p>
77+
</div>
78+
<div class="modal-footer">
79+
<button class="btn btn-secondary"
80+
type="button"
81+
data-bs-dismiss="modal"
82+
i18n:translate=""
83+
>Cancel</button>
84+
<button class="btn btn-danger confirmDeleteElement"
85+
type="button"
86+
data-uid="${template/uid}"
87+
i18n:translate=""
88+
>Delete</button>
89+
</div>
6090
</div>
6191
</div>
6292
</div>
63-
</div>
64-
</li>
65-
</ul>
66-
</metal:block>
67-
</metal:content-core>
68-
</body>
93+
</li>
94+
</ul>
95+
</metal:block>
96+
</metal:content-core>
97+
</body>
6998

70-
</html>
99+
</html>
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<div class="mb-5 pb-4 border-bottom">
2-
<h1 class="documentFirstHeading mb-3" tal:content="context/title"></h1>
3-
<p class="documentDescription lead mb-0" tal:condition="context/description" tal:content="context/description"></p>
4-
</div>
2+
<h1 class="documentFirstHeading mb-3"
3+
tal:content="context/title"
4+
></h1>
5+
<p class="documentDescription lead mb-0"
6+
tal:condition="context/description"
7+
tal:content="context/description"
8+
></p>
9+
</div>

src/cs_dynamicpages/views/dynamic_view.pt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
>Edit</a>
230230
</li>
231231
<li>
232-
<h2 class="dropdown-header"
232+
<h2 class="dropdown-header"
233233
i18n:translate=""
234234
>State</h2>
235235
</li>
@@ -244,7 +244,7 @@
244244
</tal:featured_transitions>
245245
</tal:define>
246246
<li>
247-
<h2 class="dropdown-header"
247+
<h2 class="dropdown-header"
248248
i18n:translate=""
249249
>Move actions</h2>
250250
</li>

src/cs_dynamicpages/views/dynamic_view.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# from cs_dynamicpages import _
2+
from Acquisition import aq_parent
23
from cs_dynamicpages.templates import Manager
34
from cs_dynamicpages.utils import get_available_views_for_row
45
from plone import api
6+
from plone.app.uuid.utils import uuidToObject
57
from plone.protect.interfaces import IDisableCSRFProtection
68
from plone.uuid.interfaces import IUUID
79
from Products.Five.browser import BrowserView
10+
from zope.i18n import translate
811
from zope.interface import alsoProvides
912
from zope.interface import implementer
1013
from zope.interface import Interface
11-
from Acquisition import aq_parent
12-
from zope.i18n import translate
13-
from plone.app.uuid.utils import uuidToObject
1414

1515

1616
class IDynamicView(Interface):

src/cs_dynamicpages/views/featured_view.pt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"
3030
>
3131
<h3>${context/Title}</h3>
32-
<p class="lead" tal:condition="context/Description">${context/Description}</p>
32+
<p class="lead"
33+
tal:condition="context/Description"
34+
>${context/Description}</p>
3335
<div>
3436
<tal:replace tal:condition="context/text"
3537
replace="structure context/text/output"

src/cs_dynamicpages/views/features_view.pt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@
3838
</div>
3939
</tal:image>
4040
<div class="card-body p-4 d-flex flex-column">
41-
<h2 class="h5 card-title mb-3" tal:condition="element/url">
41+
<h2 class="h5 card-title mb-3"
42+
tal:condition="element/url"
43+
>
4244
<a class="text-dark no-underline stretched-link fw-bold"
4345
href="${element/url}"
4446
>${element/Title}</a>
4547
</h2>
4648
<h2 class="h5 card-title fw-bold text-dark mb-3"
47-
tal:condition="not:element/url"
49+
tal:condition="not:element/url"
4850
>${element/Title}</h2>
4951
<p class="card-text text-secondary"
5052
tal:condition="element/Description"

src/cs_dynamicpages/views/query_columns_view.pt

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,59 @@
1414
<div class="card h-100 border-0 shadow rounded overflow-hidden">
1515
<tal:image tal:define="
1616
image element/image;
17-
" tal:condition="image" tal:on-error="nothing">
17+
"
18+
tal:condition="image"
19+
tal:on-error="nothing"
20+
>
1821
<div class="ratio ratio-16x9 bg-light">
1922
<img tal:define="
2023
images element/@@images;
21-
" tal:replace="structure python:images.srcset(fieldname='image',
24+
"
25+
tal:replace="structure python:images.srcset(fieldname='image',
2226
scale_in_src='huge',
2327
sizes='(min-width: 1400px) 400px, 100vw',
2428
alt=element.Title() ,
2529
title=element.Title(),
2630
fetchpriority=fetchpriority_image_value,
2731
loading=loading_image_value,
28-
css_class='object-fit-cover w-100 h-100')" />
32+
css_class='object-fit-cover w-100 h-100')"
33+
/>
2934
</div>
3035
</tal:image>
3136
<div class="card-body p-4 d-flex flex-column">
3237
<h2 class="h5 card-title mb-3">
3338
<a class="text-dark no-underline stretched-link fw-bold"
34-
href="${element/absolute_url}">${element/Title}</a>
39+
href="${element/absolute_url}"
40+
>${element/Title}</a>
3541
</h2>
36-
<p class="mb-3 fw-medium text-muted small" tal:condition="python:element.portal_type == 'News Item'"
37-
tal:content="python:element.toLocalizedTime(element.EffectiveDate())"></p>
38-
<div tal:condition="python:element.portal_type == 'Event'"
39-
class="mt-auto d-flex flex-column gap-2 text-muted small mb-3">
40-
<div class="d-flex align-items-center ">
42+
<p class="mb-3 fw-medium text-muted small"
43+
tal:condition="python:element.portal_type == 'News Item'"
44+
tal:content="python:element.toLocalizedTime(element.EffectiveDate())"
45+
></p>
46+
<div class="mt-auto d-flex flex-column gap-2 text-muted small mb-3"
47+
tal:condition="python:element.portal_type == 'Event'"
48+
>
49+
<div class="d-flex align-items-center">
4150
<span class="text-primary me-2 d-flex align-items-center"
42-
tal:content="structure python:icons.tag('calendar')"></span>
51+
tal:content="structure python:icons.tag('calendar')"
52+
></span>
4353
<span class="fw-medium">
4454
<tal:replace define="
45-
event_summary nocall:element/@@event_summary;
46-
" replace="structure python:event_summary.formatted_date(element)" />
55+
event_summary nocall:element/@@event_summary;
56+
"
57+
replace="structure python:event_summary.formatted_date(element)"
58+
/>
4759
</span>
4860
</div>
49-
<div class="d-flex align-items-center" tal:condition="element/location">
61+
<div class="d-flex align-items-center"
62+
tal:condition="element/location"
63+
>
5064
<span class="text-primary me-2 d-flex align-items-center"
51-
tal:content="structure python:icons.tag('geo-alt')"></span>
52-
<span class="fw-medium text-truncate" tal:content="element/location"></span>
65+
tal:content="structure python:icons.tag('geo-alt')"
66+
></span>
67+
<span class="fw-medium text-truncate"
68+
tal:content="element/location"
69+
></span>
5370
</div>
5471
</div>
5572

@@ -61,7 +78,9 @@
6178
</tal:repeat>
6279
</div>
6380
<div class="d-flex justify-content-end mt-4">
64-
<a class="btn btn-primary shadow-sm" href="${context/link_url}"
65-
tal:condition="context/link_url">${context/link_text}</a>
81+
<a class="btn btn-primary shadow-sm"
82+
href="${context/link_url}"
83+
tal:condition="context/link_url"
84+
>${context/link_text}</a>
6685
</div>
67-
</tal:define>
86+
</tal:define>

0 commit comments

Comments
 (0)