Skip to content

Commit 25f5a2e

Browse files
gagnieraytrasher
authored andcommitted
Use FUI accordion to show/hide the request
1 parent bae2bc4 commit 25f5a2e

1 file changed

Lines changed: 28 additions & 25 deletions

File tree

templates/default/stripe_history.html.twig

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
{% endblock %}
4040

4141
{% block header %}
42+
{% set no_action = true %}
4243
{% set columns = [
4344
{
4445
'label': '#',
@@ -48,9 +49,19 @@
4849
'label': _T("Date"), 'order': constant("Galette\\Filters\\HistoryList::ORDERBY_DATE"),
4950
'collapse': true
5051
},
51-
{'label': _T("Name")},
52-
{'label': _T("Subject")},
53-
{'label': _T("Amount")}
52+
{
53+
'label': _T("Name"),
54+
'collapse': true
55+
},
56+
{
57+
'label': _T("Subject"),
58+
'collapse': true
59+
},
60+
{
61+
'label': _T("Amount"),
62+
'collapse': true
63+
},
64+
{'label': _T("Request", "stripe")}
5465
] %}
5566
{{ parent() }}
5667
{% endblock %}
@@ -67,7 +78,7 @@
6778
{{ _T("History entry %id")|replace({'%id': loop.index}) }}
6879
</span>
6980
</td>
70-
<td class="collapsing" data-col-label="{{ _T("Date") }}">
81+
<td class="left collapsing" data-col-label="{{ _T("Date") }}">
7182
{{ log.history_date|date(_T("Y-m-d H:i:s")) }}
7283
{% if log.duplicate is defined %}
7384
<i class="exclamation circle red icon tooltip" data-html="{{ _T("duplicate", "stripe") }}"></i>
@@ -76,7 +87,7 @@
7687
</span>
7788
{% endif %}
7889
</td>
79-
<td data-col-label="{{ _T("Name") }}">
90+
<td class="left collapsing" data-col-label="{{ _T("Name") }}">
8091
{% if log.metadata is iterable %}
8192
{% if log.metadata.adherent_id is defined and log.metadata.adherent_id != '' %}
8293
<a href="{{ url_for("member", {"id": log.metadata.adherent_id}) }}">
@@ -91,26 +102,28 @@
91102
{{ _T("No request or unable to read request", "stripe") }}
92103
{% endif %}
93104
</td>
94-
<td data-col-label="{{ _T("Subject") }}">
105+
<td class="left collapsing" data-col-label="{{ _T("Subject") }}">
95106
{% if log.metadata is iterable %}
96107
{% if log.metadata.item_name is defined %}
97108
<span class="ui {{ payment_intent_color }} small label">{{ payment_intent[0] }}</span>
98109
| {{ log.metadata.item_name }}
99110
{% endif %}
100111
{% endif %}
101112
</td>
102-
<td data-col-label="{{ _T("Amount") }}">
113+
<td class="right collapsing" data-col-label="{{ _T("Amount") }}">
103114
{{ log.amount }}
104115
</td>
105-
<td class="info"></td>
106-
</tr>
107-
<tr class="request">
108-
<th colspan="2">{{ _T("Request", "stripe") }}</th>
109-
<td colspan="4">
110-
<code>{{ payment_intent[1] }}</code>
111-
<pre>{{ log.raw_request }}</pre>
116+
<td class="left" data-col-label="{{ _T("Request", "stripe") }}">
117+
<details class="ui basic styled accordion">
118+
<summary class="title">
119+
<i class="caret down icon" aria-hidden="true"></i> {{ _T("Show/hide full request", "stripe") }}
120+
</summary>
121+
<div class="content">
122+
<code>{{ payment_intent[1] }}</code>
123+
<pre>{{ log.raw_request }}</pre>
124+
</div>
125+
</details>
112126
</td>
113-
114127
</tr>
115128
{% else %}
116129
<tr><td colspan="6" class="emptylist">{{ _T("logs are empty") }}</td></tr>
@@ -122,15 +135,5 @@
122135
$('#nbshow').change(function() {
123136
this.form.submit();
124137
});
125-
126-
$(function() {
127-
var _elt = $('<a href="#" class="tooltip reqhide" data-html="{{ _T("Show/hide full request", "stripe")|e('js') }}"><i class="search plus grey icon"></i><span class="visually-hidden">{{ _T("Show/hide full request", "stripe")|e('js') }}</span></a>');
128-
$('.request').hide().prev('tr').find('td.info').prepend(_elt);
129-
$('.reqhide').click(function(event) {
130-
event.preventDefault();
131-
$(this).parents('tr').next('.request').toggle();
132-
});
133-
_bindFomanticComponents();
134-
});
135138
</script>
136139
{% endblock %}

0 commit comments

Comments
 (0)