Browse Source

feat(vue): move confirmDialog to LNbits.utils so we can reuse the styling

fee_issues
Eneko Illarramendi 5 years ago
parent
commit
e461e34fc0
  1. 6
      lnbits/core/static/js/wallet.js
  2. 14
      lnbits/extensions/amilk/templates/amilk/index.html
  3. 42
      lnbits/extensions/diagonalley/templates/diagonalley/index.html
  4. 14
      lnbits/extensions/paywall/templates/paywall/index.html
  5. 14
      lnbits/extensions/tpos/templates/tpos/index.html
  6. 14
      lnbits/extensions/withdraw/static/js/index.js
  7. 13
      lnbits/static/js/base.js

6
lnbits/core/static/js/wallet.js

@ -307,7 +307,11 @@ new Vue({
});
},
deleteWallet: function (walletId, user) {
LNbits.href.deleteWallet(walletId, user);
LNbits.utils.confirmDialog(
'Are you sure you want to delete this wallet?'
).onOk(function () {
LNbits.href.deleteWallet(walletId, user);
});
},
fetchPayments: function (checkPending) {
var self = this;

14
lnbits/extensions/amilk/templates/amilk/index.html

@ -202,17 +202,9 @@
var self = this;
var amilk = _.findWhere(this.amilks, {id: amilkId});
this.$q.dialog({
message: 'Are you sure you want to delete this AMilk link?',
ok: {
flat: true,
color: 'orange'
},
cancel: {
flat: true,
color: 'grey'
}
}).onOk(function () {
LNbits.utils.confirmDialog(
'Are you sure you want to delete this AMilk link?'
).onOk(function () {
LNbits.api.request(
'DELETE',
'/amilk/api/v1/amilks/' + amilkId,

42
lnbits/extensions/diagonalley/templates/diagonalley/index.html

@ -474,17 +474,9 @@
var self = this;
var indexer = _.findWhere(this.indexers, {id: indexerId});
this.$q.dialog({
message: 'Are you sure you want to delete this Indexer link?',
ok: {
flat: true,
color: 'orange'
},
cancel: {
flat: true,
color: 'grey'
}
}).onOk(function () {
LNbits.utils.confirmDialog(
'Are you sure you want to delete this Indexer link?'
).onOk(function () {
LNbits.api.request(
'DELETE',
'/diagonalley/api/v1/diagonalley/indexers/' + indexerId,
@ -538,17 +530,9 @@
var self = this;
var order = _.findWhere(this.orders, {id: orderId});
this.$q.dialog({
message: 'Are you sure you want to delete this order link?',
ok: {
flat: true,
color: 'orange'
},
cancel: {
flat: true,
color: 'grey'
}
}).onOk(function () {
LNbits.utils.confirmDialog(
'Are you sure you want to delete this order link?'
).onOk(function () {
LNbits.api.request(
'DELETE',
'/diagonalley/api/v1/diagonalley/orders/' + orderId,
@ -646,17 +630,9 @@
var self = this;
var product = _.findWhere(this.products, {id: productId});
this.$q.dialog({
message: 'Are you sure you want to delete this products link?',
ok: {
flat: true,
color: 'orange'
},
cancel: {
flat: true,
color: 'grey'
}
}).onOk(function () {
LNbits.utils.confirmDialog(
'Are you sure you want to delete this products link?'
).onOk(function () {
LNbits.api.request(
'DELETE',
'/diagonalley/api/v1/diagonalley/products/' + productId,

14
lnbits/extensions/paywall/templates/paywall/index.html

@ -186,17 +186,9 @@
var self = this;
var paywall = _.findWhere(this.paywalls, {id: paywallId});
this.$q.dialog({
message: 'Are you sure you want to delete this paywall link?',
ok: {
flat: true,
color: 'orange'
},
cancel: {
flat: true,
color: 'grey'
}
}).onOk(function () {
LNbits.utils.confirmDialog(
'Are you sure you want to delete this paywall link?'
).onOk(function () {
LNbits.api.request(
'DELETE',
'/paywall/api/v1/paywalls/' + paywallId,

14
lnbits/extensions/tpos/templates/tpos/index.html

@ -193,17 +193,9 @@
var self = this;
var tpos = _.findWhere(this.tposs, {id: tposId});
this.$q.dialog({
message: 'Are you sure you want to delete this TPoS?',
ok: {
flat: true,
color: 'orange'
},
cancel: {
flat: true,
color: 'grey'
}
}).onOk(function () {
LNbits.utils.confirmDialog(
'Are you sure you want to delete this TPoS?'
).onOk(function () {
LNbits.api.request(
'DELETE',
'/tpos/api/v1/tposs/' + tposId,

14
lnbits/extensions/withdraw/static/js/index.js

@ -131,17 +131,9 @@ new Vue({
var self = this;
var link = _.findWhere(this.withdrawLinks, {id: linkId});
this.$q.dialog({
message: 'Are you sure you want to delete this withdraw link?',
ok: {
flat: true,
color: 'orange'
},
cancel: {
flat: true,
color: 'grey'
}
}).onOk(function () {
LNbits.utils.confirmDialog(
'Are you sure you want to delete this withdraw link?'
).onOk(function () {
LNbits.api.request(
'DELETE',
'/withdraw/api/v1/links/' + linkId,

13
lnbits/static/js/base.js

@ -87,6 +87,19 @@ var LNbits = {
}
},
utils: {
confirmDialog: function (msg) {
return Quasar.plugins.Dialog.create({
message: msg,
ok: {
flat: true,
color: 'orange'
},
cancel: {
flat: true,
color: 'grey'
}
});
},
formatCurrency: function (value, currency) {
return new Intl.NumberFormat(LOCALE, {style: 'currency', currency: currency}).format(value);
},

Loading…
Cancel
Save