chore: getting rid of jinja variable in wallet.html (#3547)

This commit is contained in:
dni ⚡ 2025-11-21 09:01:53 +01:00 committed by GitHub
parent 5346ac47b1
commit 3ccefb70fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 19 additions and 38 deletions

View file

@ -16,7 +16,7 @@
<q-card-section style="height: 130px"> <q-card-section style="height: 130px">
<div class="row q-gutter-md"> <div class="row q-gutter-md">
<div <div
v-if="isSatsDenomination" v-if="g.isSatsDenomination"
class="col-1" class="col-1"
style="max-width: 30px" style="max-width: 30px"
> >
@ -46,7 +46,7 @@
<div class="col-auto"> <div class="col-auto">
<div class="text-h3 q-my-none full-width"> <div class="text-h3 q-my-none full-width">
<strong <strong
v-text="formatBalance(this.g.wallet.sat)" v-text="formatBalance(g.wallet.sat)"
class="text-no-wrap" class="text-no-wrap"
:style="{fontSize: 'clamp(0.75rem, 10vw, 3rem)', display: 'inline-block', maxWidth: '100%'}" :style="{fontSize: 'clamp(0.75rem, 10vw, 3rem)', display: 'inline-block', maxWidth: '100%'}"
></strong> ></strong>
@ -55,7 +55,7 @@
<div class="col-auto"> <div class="col-auto">
<lnbits-update-balance <lnbits-update-balance
v-if="$q.screen.lt.lg" v-if="$q.screen.lt.lg"
:wallet_id="this.g.wallet.id" :wallet_id="g.wallet.id"
:callback="updateBalanceCallback" :callback="updateBalanceCallback"
:small_btn="true" :small_btn="true"
></lnbits-update-balance> ></lnbits-update-balance>
@ -95,7 +95,7 @@
<div class="col-auto"> <div class="col-auto">
<lnbits-update-balance <lnbits-update-balance
v-if="$q.screen.lt.lg" v-if="$q.screen.lt.lg"
:wallet_id="this.g.wallet.id" :wallet_id="g.wallet.id"
:callback="updateBalanceCallback" :callback="updateBalanceCallback"
:small_btn="true" :small_btn="true"
></lnbits-update-balance> ></lnbits-update-balance>
@ -106,7 +106,7 @@
<span <span
class="text-h5 text-italic" class="text-h5 text-italic"
style="opacity: 0.75" style="opacity: 0.75"
v-text="formattedBalance + ' {{LNBITS_DENOMINATION}}'" v-text="formatBalance(g.wallet.sat)"
> >
</span> </span>
</div> </div>
@ -114,7 +114,7 @@
<div <div
class="absolute-right q-pa-md" class="absolute-right q-pa-md"
v-if="$q.screen.gt.md && g.fiatTracking && '{{ LNBITS_DENOMINATION }}' == 'sats'" v-if="$q.screen.gt.md && g.fiatTracking && g.isSatsDenomination"
> >
<div class="text-bold text-italic">BTC Price</div> <div class="text-bold text-italic">BTC Price</div>
<span <span
@ -213,7 +213,7 @@
style="position: relative; left: -15px; bottom: -10px" style="position: relative; left: -15px; bottom: -10px"
></q-btn> ></q-btn>
<div class="text-subtitle1 q-mt-none q-mb-none"> <div class="text-subtitle1 q-mt-none q-mb-none">
{{ SITE_TITLE }} Wallet: <span v-text="$t('wallet')"></span>
<strong><em v-text="g.wallet.name"></em></strong> <strong><em v-text="g.wallet.name"></em></strong>
</div> </div>
<q-space></q-space> <q-space></q-space>
@ -408,9 +408,7 @@
<div class="col-2"></div> <div class="col-2"></div>
</div> </div>
</q-card-section> </q-card-section>
<q-card-section <q-card-section v-if="g.isSatsDenomination">
v-if="'{{ LNBITS_DENOMINATION }}' == 'sats'"
>
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<q-select <q-select
@ -594,7 +592,7 @@
filled filled
dense dense
v-model="receive.data.amount" v-model="receive.data.amount"
:label="$t('amount')+' ({{LNBITS_DENOMINATION}}) *'" :label="$t('amount') + '(' + denomination + ') *'"
mask="#.##" mask="#.##"
fill-mask="0" fill-mask="0"
reverse-fill-mask reverse-fill-mask
@ -698,9 +696,7 @@
> >
<q-item-section avatar> <q-item-section avatar>
<q-avatar square> <q-avatar square>
<img <img src="/static/images/logos/lnbits.png" />
:src="'{{ static_url_for('static', 'images/logos/lnbits.png') }}'"
/>
</q-avatar> </q-avatar>
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
@ -719,9 +715,7 @@
> >
<q-item-section avatar> <q-item-section avatar>
<q-avatar> <q-avatar>
<img <img src="/static/images/stripe_logo.ico" />
:src="'{{ static_url_for('static', 'images/stripe_logo.ico') }}'"
/>
</q-avatar> </q-avatar>
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
@ -1022,7 +1016,7 @@
<span <span
v-text="msatoshiFormat(parse.lnurlpay.maxSendable)" v-text="msatoshiFormat(parse.lnurlpay.maxSendable)"
></span> ></span>
<span v-text="'{{LNBITS_DENOMINATION}}'"></span> <span v-text="denomination"></span>
<span v-if="parse.lnurlpay.commentAllowed > 0"> <span v-if="parse.lnurlpay.commentAllowed > 0">
<br /> <br />
and a and a
@ -1038,7 +1032,7 @@
between between
<b v-text="msatoshiFormat(parse.lnurlpay.minSendable)"></b> and <b v-text="msatoshiFormat(parse.lnurlpay.minSendable)"></b> and
<b v-text="msatoshiFormat(parse.lnurlpay.maxSendable)"></b> <b v-text="msatoshiFormat(parse.lnurlpay.maxSendable)"></b>
<span v-text="'{{LNBITS_DENOMINATION}}'"></span> <span v-text="denomination"></span>
<span v-if="parse.lnurlpay.commentAllowed > 0"> <span v-if="parse.lnurlpay.commentAllowed > 0">
<br /> <br />
and a and a

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -48,7 +48,9 @@ window.g = Vue.reactive({
'lnbits.backgroundImage', 'lnbits.backgroundImage',
WINDOW_SETTINGS.LNBITS_DEFAULT_BGIMAGE || '' WINDOW_SETTINGS.LNBITS_DEFAULT_BGIMAGE || ''
), ),
ads: WINDOW_SETTINGS.AD_SPACE.split(',').map(ad => ad.split(';')) ads: WINDOW_SETTINGS.AD_SPACE.split(',').map(ad => ad.split(';')),
denomination: WINDOW_SETTINGS.LNBITS_DENOMINATION,
isSatsDenomination: WINDOW_SETTINGS.LNBITS_DENOMINATION == 'sats'
}) })
window.dateFormat = 'YYYY-MM-DD HH:mm' window.dateFormat = 'YYYY-MM-DD HH:mm'

View file

@ -579,7 +579,7 @@ window.PageAccount = {
// filter out themes that are not allowed // filter out themes that are not allowed
this.themeOptions = this.themeOptions.filter(theme => this.themeOptions = this.themeOptions.filter(theme =>
this.allowedThemes.includes(theme.name) this.LNBITS_THEME_OPTIONS.includes(theme.name)
) )
} }
} }

View file

@ -122,16 +122,6 @@ window.WalletPageLogic = {
} }
}, },
computed: { computed: {
formattedBalance() {
if (LNBITS_DENOMINATION != 'sats') {
return LNbits.utils.formatCurrency(
this.g.wallet.sat / 100,
LNBITS_DENOMINATION
)
} else {
return LNbits.utils.formatSat(this.g.wallet.sat)
}
},
canPay() { canPay() {
if (!this.parse.invoice) return false if (!this.parse.invoice) return false
if (this.parse.invoice.expired) { if (this.parse.invoice.expired) {

View file

@ -5,14 +5,9 @@ window.windowMixin = {
api: window._lnbitsApi, api: window._lnbitsApi,
utils: window._lnbitsUtils, utils: window._lnbitsUtils,
g: window.g, g: window.g,
toggleSubs: true,
isSatsDenomination: WINDOW_SETTINGS['LNBITS_DENOMINATION'] == 'sats',
allowedThemes: WINDOW_SETTINGS['LNBITS_THEME_OPTIONS'],
walletEventListeners: [],
...WINDOW_SETTINGS ...WINDOW_SETTINGS
} }
}, },
methods: { methods: {
openNewWalletDialog(walletType = 'lightning') { openNewWalletDialog(walletType = 'lightning') {
this.g.newWalletType = walletType this.g.newWalletType = walletType