Skip to content

Commit b3063cd

Browse files
author
Brian Gantick
authored
Merge pull request #8 from punkave/feature/widg-opts
More options for widget
2 parents a46e33e + bfbb336 commit b3063cd

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,5 @@ Extending a template...
7979
<h1>HELLO</h1>
8080
{% endblock %}
8181
```
82+
83+
The `pk-people-widgets` module has some special conveniences. You can set a `namespace` option to override the widget class names. There are also `beforeWidget` and `afterWidget` blocks for you to override for conveniently wrapping the widget with your own custom markup.
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
{% set widget = data.widget %}
2+
{% set widgetClass = data.options.namespace or 'pk-people-widget' %}
23

3-
<div class="pk-people-widget">
4+
{% block beforeWidget %}{% endblock %}
5+
6+
<div class="{{ widgetClass }}">
47
{% block header %}
58
{% if widget.title %}
6-
<h2 class="pk-people-widget__title">{{ widget.title }}</h2>
9+
<h2 class="{{ widgetClass }}__title">{{ widget.title }}</h2>
710
{% endif %}
811
{% endblock %}
912
{% block list %}
10-
<ul class="pk-people-widget__list">
13+
<ul class="{{ widgetClass }}__list">
1114
{% for piece in widget._pieces %}
1215
{% block person %}
13-
<li class="pk-person">
16+
<li class="{{ widgetClass }}__person">
1417
{% block image %}
1518
{% if not apos.areas.isEmpty(piece, 'image') %}
16-
<div class="pk-person__image">
19+
<div class="{{ widgetClass }}__image">
1720
{{ apos.singleton(piece, 'image', 'apostrophe-images', { edit: false }) }}
1821
</div>
1922
{% endif %}
2023
{% endblock %}
2124
{% block info %}
22-
<h3 class="pk-person__fullname">
25+
<h3 class="{{ widgetClass }}__fullname">
2326
<a href="{{ piece._url }}">{{ piece.title }}</a>
2427
</h3>
2528
{% if piece.position %}
26-
<p class="pk-person__position">{{ piece.position }}</p>
29+
<p class="{{ widgetClass }}__position">{{ piece.position }}</p>
2730
{% endif %}
2831
{% if piece.email %}
29-
<a class="pk-person__email" href="mailto:{{ piece.email }}">{{ piece.email }}</a>
32+
<a class="{{ widgetClass }}__email" href="mailto:{{ piece.email }}">{{ piece.email }}</a>
3033
{% endif %}
3134
{% if piece.tel %}
32-
<a class="pk-person__tel" href="tel:{{ piece.tel }}">{{ piece.tel }}</a>
35+
<a class="{{ widgetClass }}__tel" href="tel:{{ piece.tel }}">{{ piece.tel }}</a>
3336
{% endif %}
3437
{% endblock %}
3538
{% block summary %}
3639
{% if piece.summary %}
37-
<p class="pk-person__summary">{{ piece.summary }}</p>
40+
<p class="{{ widgetClass }}__summary">{{ piece.summary }}</p>
3841
{% endif %}
3942
{% endblock %}
4043
</li>
@@ -44,7 +47,9 @@ <h3 class="pk-person__fullname">
4447
{% endblock %}
4548
{% block link %}
4649
{% if widget.linkIndex == 'yes' and widget.linkText %}
47-
<a class="pk-people-widget__link" href="{{ widget._pieces[0]._parentUrl }}">{{ widget.linkText }}</a>
50+
<a class="{{ widgetClass }}__link" href="{{ widget._pieces[0]._parentUrl }}">{{ widget.linkText }}</a>
4851
{% endif %}
4952
{% endblock %}
5053
</div>
54+
55+
{% block afterWidget %}{% endblock %}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pk-people",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "A base class for people in ApostropheCMS",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)