mirror of
https://github.com/lnbits/lnbits.git
synced 2025-07-08 14:30:43 +02:00
chore(vue): use g
for consistency with Flask
This commit is contained in:
@ -145,7 +145,7 @@ new Vue({
|
|||||||
if (this.payments.length) {
|
if (this.payments.length) {
|
||||||
return _.pluck(this.payments, 'amount').reduce(function (a, b) { return a + b; }, 0) / 1000;
|
return _.pluck(this.payments, 'amount').reduce(function (a, b) { return a + b; }, 0) / 1000;
|
||||||
}
|
}
|
||||||
return this.w.wallet.sat;
|
return this.g.wallet.sat;
|
||||||
},
|
},
|
||||||
fbalance: function () {
|
fbalance: function () {
|
||||||
return LNbits.utils.formatSat(this.balance)
|
return LNbits.utils.formatSat(this.balance)
|
||||||
@ -211,7 +211,7 @@ new Vue({
|
|||||||
createInvoice: function () {
|
createInvoice: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.receive.status = 'loading';
|
this.receive.status = 'loading';
|
||||||
LNbits.api.createInvoice(this.w.wallet, this.receive.data.amount, this.receive.data.memo)
|
LNbits.api.createInvoice(this.g.wallet, this.receive.data.amount, this.receive.data.memo)
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
self.receive.status = 'success';
|
self.receive.status = 'success';
|
||||||
self.receive.paymentReq = response.data.payment_request;
|
self.receive.paymentReq = response.data.payment_request;
|
||||||
@ -279,7 +279,7 @@ new Vue({
|
|||||||
icon: null
|
icon: null
|
||||||
});
|
});
|
||||||
|
|
||||||
LNbits.api.payInvoice(this.w.wallet, this.send.data.bolt11).then(function (response) {
|
LNbits.api.payInvoice(this.g.wallet, this.send.data.bolt11).then(function (response) {
|
||||||
self.send.paymentChecker = setInterval(function () {
|
self.send.paymentChecker = setInterval(function () {
|
||||||
LNbits.api.getPayment(self.w.wallet, response.data.checking_id).then(function (res) {
|
LNbits.api.getPayment(self.w.wallet, response.data.checking_id).then(function (res) {
|
||||||
if (res.data.paid) {
|
if (res.data.paid) {
|
||||||
@ -301,7 +301,7 @@ new Vue({
|
|||||||
fetchPayments: function (checkPending) {
|
fetchPayments: function (checkPending) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
return LNbits.api.getPayments(this.w.wallet, checkPending).then(function (response) {
|
return LNbits.api.getPayments(this.g.wallet, checkPending).then(function (response) {
|
||||||
self.payments = response.data.map(function (obj) {
|
self.payments = response.data.map(function (obj) {
|
||||||
return LNbits.map.payment(obj);
|
return LNbits.map.payment(obj);
|
||||||
}).sort(function (a, b) {
|
}).sort(function (a, b) {
|
||||||
@ -326,7 +326,7 @@ new Vue({
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'payments': function () {
|
'payments': function () {
|
||||||
EventHub.$emit('update-wallet-balance', [this.w.wallet.id, this.balance]);
|
EventHub.$emit('update-wallet-balance', [this.g.wallet.id, this.balance]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
{% block page %}
|
{% block page %}
|
||||||
<div class="row q-col-gutter-md">
|
<div class="row q-col-gutter-md">
|
||||||
<div class="col-6 col-md-4 col-lg-3" v-for="extension in w.extensions" :key="extension.code">
|
<div class="col-6 col-md-4 col-lg-3" v-for="extension in g.extensions" :key="extension.code">
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<q-icon :name="extension.icon" color="grey-5" style="font-size: 4rem;"></q-icon>
|
<q-icon :name="extension.icon" color="grey-5" style="font-size: 4rem;"></q-icon>
|
||||||
@ -26,14 +26,14 @@
|
|||||||
<q-card-actions>
|
<q-card-actions>
|
||||||
<div v-if="extension.isEnabled">
|
<div v-if="extension.isEnabled">
|
||||||
<q-btn flat color="deep-purple"
|
<q-btn flat color="deep-purple"
|
||||||
type="a" :href="[extension.url, '?usr=', w.user.id].join('')">Open</q-btn>
|
type="a" :href="[extension.url, '?usr=', g.user.id].join('')">Open</q-btn>
|
||||||
<q-btn flat color="grey-5"
|
<q-btn flat color="grey-5"
|
||||||
type="a"
|
type="a"
|
||||||
:href="['{{ url_for('core.extensions') }}', '?usr=', w.user.id, '&disable=', extension.code].join('')"> Disable</q-btn>
|
:href="['{{ url_for('core.extensions') }}', '?usr=', g.user.id, '&disable=', extension.code].join('')"> Disable</q-btn>
|
||||||
</div>
|
</div>
|
||||||
<q-btn v-else flat color="deep-purple"
|
<q-btn v-else flat color="deep-purple"
|
||||||
type="a"
|
type="a"
|
||||||
:href="['{{ url_for('core.extensions') }}', '?usr=', w.user.id, '&enable=', extension.code].join('')">
|
:href="['{{ url_for('core.extensions') }}', '?usr=', g.user.id, '&enable=', extension.code].join('')">
|
||||||
Enable</q-btn>
|
Enable</q-btn>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
<q-separator class="q-my-lg"></q-separator>
|
<q-separator class="q-my-lg"></q-separator>
|
||||||
<p>A magical "w" is always available, with info about the user, wallets and extensions:</p>
|
<p>A magical "g" is always available, with info about the user, wallets and extensions:</p>
|
||||||
<code class="text-caption">{% raw %}{{ w }}{% endraw %}</code>
|
<code class="text-caption">{% raw %}{{ g }}{% endraw %}</code>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -141,7 +141,7 @@ var LNbits = {
|
|||||||
var windowMixin = {
|
var windowMixin = {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
w: {
|
g: {
|
||||||
visibleDrawer: false,
|
visibleDrawer: false,
|
||||||
extensions: [],
|
extensions: [],
|
||||||
user: null,
|
user: null,
|
||||||
@ -165,14 +165,14 @@ var windowMixin = {
|
|||||||
created: function () {
|
created: function () {
|
||||||
this.$q.dark.set(this.$q.localStorage.getItem('lnbits.darkMode'));
|
this.$q.dark.set(this.$q.localStorage.getItem('lnbits.darkMode'));
|
||||||
if (window.user) {
|
if (window.user) {
|
||||||
this.w.user = Object.freeze(LNbits.map.user(window.user));
|
this.g.user = Object.freeze(LNbits.map.user(window.user));
|
||||||
}
|
}
|
||||||
if (window.wallet) {
|
if (window.wallet) {
|
||||||
this.w.wallet = Object.freeze(LNbits.map.wallet(window.wallet));
|
this.g.wallet = Object.freeze(LNbits.map.wallet(window.wallet));
|
||||||
}
|
}
|
||||||
if (window.extensions) {
|
if (window.extensions) {
|
||||||
var user = this.w.user;
|
var user = this.g.user;
|
||||||
this.w.extensions = Object.freeze(window.extensions.map(function (data) {
|
this.g.extensions = Object.freeze(window.extensions.map(function (data) {
|
||||||
return LNbits.map.extension(data);
|
return LNbits.map.extension(data);
|
||||||
}).map(function (obj) {
|
}).map(function (obj) {
|
||||||
if (user) {
|
if (user) {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<q-header bordered class="bg-lnbits-dark">
|
<q-header bordered class="bg-lnbits-dark">
|
||||||
<q-toolbar>
|
<q-toolbar>
|
||||||
<q-btn dense flat round icon="menu" @click="w.visibleDrawer = !w.visibleDrawer"></q-btn>
|
<q-btn dense flat round icon="menu" @click="g.visibleDrawer = !g.visibleDrawer"></q-btn>
|
||||||
<q-toolbar-title><strong>LN</strong>bits</q-toolbar-title>
|
<q-toolbar-title><strong>LN</strong>bits</q-toolbar-title>
|
||||||
<q-badge color="yellow" text-color="black">
|
<q-badge color="yellow" text-color="black">
|
||||||
<span><span v-show="$q.screen.gt.sm">USE WITH CAUTION - LNbits wallet is still in </span>BETA</span>
|
<span><span v-show="$q.screen.gt.sm">USE WITH CAUTION - LNbits wallet is still in </span>BETA</span>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
</q-header>
|
</q-header>
|
||||||
|
|
||||||
<q-drawer v-model="w.visibleDrawer" side="left" :width="($q.screen.lt.md) ? 260 : 230" show-if-above :elevated="$q.screen.lt.md">
|
<q-drawer v-model="g.visibleDrawer" side="left" :width="($q.screen.lt.md) ? 260 : 230" show-if-above :elevated="$q.screen.lt.md">
|
||||||
{% block drawer %}
|
{% block drawer %}
|
||||||
<lnbits-wallet-list></lnbits-wallet-list>
|
<lnbits-wallet-list></lnbits-wallet-list>
|
||||||
<lnbits-extension-list class="q-pb-xl"></lnbits-extension-list>
|
<lnbits-extension-list class="q-pb-xl"></lnbits-extension-list>
|
||||||
|
Reference in New Issue
Block a user