Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make newlines in description possible #48

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/js/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ new Vue({
delimiters: ['${', '}'],
data() {
return {
charge: mapCharge(charge),
charge: mapCharge(charge_data),
network: network,
pendingFunds: 0,
ws: null,
Expand Down
17 changes: 9 additions & 8 deletions templates/satspay/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
<q-card>
<q-card-section class="text-center">
<div class="text-h4">${charge.name || 'LNbits SatsPay'}</div>
<div class="text-subtitle1">${charge.description}</div>
<div
class="text-subtitle1"
v-for="line in charge.description.split('\n')"
>
${line}
</div>
</q-card-section>
<satspay-time-elapsed
:charge="charge"
Expand Down Expand Up @@ -184,12 +189,8 @@
</q-card>
</div>
</div>
{% endblock %} {% block styles %} {% if charge_data.custom_css %}
<link
href="/satspay/css/{{ charge_data.custom_css }}"
rel="stylesheet"
type="text/css"
/>
{% endblock %} {% block styles %} {% if custom_css %}
<link href="/satspay/css/{{ custom_css }}" rel="stylesheet" type="text/css" />
{% endif %}
<style>
header button.q-btn-dropdown {
Expand All @@ -198,7 +199,7 @@
</style>
{% endblock %} {% block scripts %}
<script>
const charge = {{ charge_data|tojson }};
const charge_data = JSON.parse({{ charge_data|tojson }});
const network = "{{ network }}";
</script>
<script src="{{ static_url_for('satspay/static', path='js/utils.js') }}"></script>
Expand Down
4 changes: 3 additions & 1 deletion views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from http import HTTPStatus

from fastapi import (
Expand Down Expand Up @@ -47,7 +48,8 @@ async def display_charge(request: Request, charge_id: str):
"satspay/display.html",
{
"request": request,
"charge_data": charge.public,
"charge_data": json.dumps(charge.public),
"custom_css": charge.custom_css,
"mempool_endpoint": charge.config.mempool_endpoint,
"network": charge.config.network,
},
Expand Down