Skip to content

Commit ccf3d4b

Browse files
committed
(PC-32913)[BO] feat: create widget collapse text
1 parent 3ff6065 commit ccf3d4b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{% macro collapsable_text(id, short, long) %}
2+
<div class="pc-display-selector"
3+
data-pc-input-name="name-{{ id }}">
4+
<input class="form-check-input d-none"
5+
type="radio"
6+
name="name-{{ id }}"
7+
id="id-{{ id }}-long"
8+
value="label-{{ id }}-long">
9+
<input class="form-check-input d-none"
10+
type="radio"
11+
name="name-{{ id }}"
12+
id="id-{{ id }}-short"
13+
value="label-{{ id }}-short"
14+
checked>
15+
<label class="form-check-label"
16+
for="id-{{ id }}-short"
17+
id="label-{{ id }}-long">{{ short }}…</label>
18+
<label class="form-check-label"
19+
for="id-{{ id }}-long"
20+
id="label-{{ id }}-short">{{ long }}</label>
21+
</div>
22+
{% endmacro %}

api/src/pcapi/static/backoffice/js/addons/pc-display-selector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class PcDisplaySelector extends PcAddOn {
6969
}
7070

7171
unbindEvents = () => {
72-
this.selectors.forEach((selector) => {
72+
this.$selectors.forEach(($selector) => {
7373
this.#inputInSelector($selector).forEach(($input) => {
7474
$input.removeEventListener("change", this.#change)
7575
})

0 commit comments

Comments
 (0)