From c15f182377b95aff28632bd52c29fa80593e5511 Mon Sep 17 00:00:00 2001 From: d11n Date: Fri, 11 Mar 2022 08:41:48 +0100 Subject: [PATCH] Streamline JS/CSS bundles (#3520) --- BTCPayServer/BTCPayServer.csproj | 5 -- BTCPayServer/Views/Shared/_LayoutPos.cshtml | 1 + .../Views/UIApps/UpdateCrowdfund.cshtml | 6 +- .../Views/UIApps/UpdatePointOfSale.cshtml | 8 +- .../Views/UIAppsPublic/ViewCrowdfund.cshtml | 7 +- .../EditPaymentRequest.cshtml | 4 +- .../ViewPaymentRequest.cshtml | 1 + .../UIStorePullPayments/NewPullPayment.cshtml | 4 +- .../Views/UIWallets/WalletSend.cshtml | 1 + BTCPayServer/bundleconfig.json | 76 +------------------ BTCPayServer/wwwroot/crowdfund-admin/main.js | 3 - BTCPayServer/wwwroot/js/summernote-options.js | 14 ---- BTCPayServer/wwwroot/main/site.js | 17 ++++- .../wwwroot/payment-request-admin/main.js | 3 - BTCPayServer/wwwroot/pos-admin/main.js | 3 - .../wwwroot/pull-payment-admin/main.js | 3 - 16 files changed, 36 insertions(+), 120 deletions(-) delete mode 100644 BTCPayServer/wwwroot/crowdfund-admin/main.js delete mode 100644 BTCPayServer/wwwroot/js/summernote-options.js delete mode 100644 BTCPayServer/wwwroot/payment-request-admin/main.js delete mode 100644 BTCPayServer/wwwroot/pos-admin/main.js delete mode 100644 BTCPayServer/wwwroot/pull-payment-admin/main.js diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 60692a7f5..4eba16262 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -231,10 +231,5 @@ - - <_ContentIncludedByDefault Remove="Views\Authorization\Authorize.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Components\NotificationsDropdown\Default.cshtml" /> - - diff --git a/BTCPayServer/Views/Shared/_LayoutPos.cshtml b/BTCPayServer/Views/Shared/_LayoutPos.cshtml index b01ebe7c4..8f089b19b 100644 --- a/BTCPayServer/Views/Shared/_LayoutPos.cshtml +++ b/BTCPayServer/Views/Shared/_LayoutPos.cshtml @@ -45,6 +45,7 @@ var srvModel = @Safe.Json(Model); + } @@ -14,7 +15,8 @@ @section PageFootContent { - + + }
diff --git a/BTCPayServer/Views/UIApps/UpdatePointOfSale.cshtml b/BTCPayServer/Views/UIApps/UpdatePointOfSale.cshtml index 5e661f6b2..9fe5d4bcb 100644 --- a/BTCPayServer/Views/UIApps/UpdatePointOfSale.cshtml +++ b/BTCPayServer/Views/UIApps/UpdatePointOfSale.cshtml @@ -258,8 +258,9 @@ @section PageHeadContent { - - + + + } @section PageFootContent { @@ -417,5 +418,6 @@ }); - + + } diff --git a/BTCPayServer/Views/UIAppsPublic/ViewCrowdfund.cshtml b/BTCPayServer/Views/UIAppsPublic/ViewCrowdfund.cshtml index 9e061098f..c500631ca 100644 --- a/BTCPayServer/Views/UIAppsPublic/ViewCrowdfund.cshtml +++ b/BTCPayServer/Views/UIAppsPublic/ViewCrowdfund.cshtml @@ -419,9 +419,10 @@ @if (!Model.SimpleDisplay) { - - - @*We need to make sure btcpay.js is not bundled, else it will not work if there is a RootPath*@ + + + + @*We need to make sure btcpay.js is not bundled, else it will not work if there is a RootPath*@ } diff --git a/BTCPayServer/Views/UIPaymentRequest/EditPaymentRequest.cshtml b/BTCPayServer/Views/UIPaymentRequest/EditPaymentRequest.cshtml index edde72cf7..badcaa8df 100644 --- a/BTCPayServer/Views/UIPaymentRequest/EditPaymentRequest.cshtml +++ b/BTCPayServer/Views/UIPaymentRequest/EditPaymentRequest.cshtml @@ -7,12 +7,12 @@ } @section PageHeadContent { - + } @section PageFootContent { - + } diff --git a/BTCPayServer/Views/UIPaymentRequest/ViewPaymentRequest.cshtml b/BTCPayServer/Views/UIPaymentRequest/ViewPaymentRequest.cshtml index eebab9708..63ddaaf2e 100644 --- a/BTCPayServer/Views/UIPaymentRequest/ViewPaymentRequest.cshtml +++ b/BTCPayServer/Views/UIPaymentRequest/ViewPaymentRequest.cshtml @@ -52,6 +52,7 @@ + @*We need to make sure btcpay.js is not bundled, else it will not work if there is a RootPath*@ diff --git a/BTCPayServer/Views/UIStorePullPayments/NewPullPayment.cshtml b/BTCPayServer/Views/UIStorePullPayments/NewPullPayment.cshtml index c5968d6d9..d9951a388 100644 --- a/BTCPayServer/Views/UIStorePullPayments/NewPullPayment.cshtml +++ b/BTCPayServer/Views/UIStorePullPayments/NewPullPayment.cshtml @@ -6,12 +6,12 @@ } @section PageHeadContent { - + } @section PageFootContent { - + } diff --git a/BTCPayServer/Views/UIWallets/WalletSend.cshtml b/BTCPayServer/Views/UIWallets/WalletSend.cshtml index 7ba155cc3..a2b222741 100644 --- a/BTCPayServer/Views/UIWallets/WalletSend.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletSend.cshtml @@ -23,6 +23,7 @@ @section PageFootContent { + } diff --git a/BTCPayServer/bundleconfig.json b/BTCPayServer/bundleconfig.json index a66c483db..0da52cf28 100644 --- a/BTCPayServer/bundleconfig.json +++ b/BTCPayServer/bundleconfig.json @@ -71,9 +71,8 @@ ] }, { - "outputFileName": "wwwroot/bundles/crowdfund-bundle-1.min.js", + "outputFileName": "wwwroot/bundles/crowdfund-bundle.min.js", "inputFiles": [ - "wwwroot/vendor/vuejs/vue.min.js", "wwwroot/vendor/vue-qrcode/vue-qrcode.min.js", "wwwroot/vendor/babel-polyfill/polyfill.min.js", "wwwroot/vendor/vue-toasted/vue-toasted.min.js", @@ -83,47 +82,6 @@ "wwwroot/crowdfund/**/*.js" ] }, - { - "outputFileName": "wwwroot/bundles/crowdfund-bundle-2.min.js", - "inputFiles": [ - "wwwroot/vendor/moment/moment.min.js" - ], - "minify": { - "enabled": false - } - }, - { - "outputFileName": "wwwroot/bundles/crowdfund-admin-bundle.min.js", - "inputFiles": [ - "wwwroot/vendor/vuejs/vue.min.js", - "wwwroot/vendor/summernote/summernote-bs5.js", - "wwwroot/js/summernote-options.js", - "wwwroot/crowdfund-admin/main.js" - ] - }, - { - "outputFileName": "wwwroot/bundles/crowdfund-admin-bundle.min.css", - "inputFiles": [ - "wwwroot/vendor/summernote/summernote-bs5.css", - "wwwroot/main/template-editor.css" - ] - }, - { - "outputFileName": "wwwroot/bundles/pos-admin-bundle.min.js", - "inputFiles": [ - "wwwroot/vendor/vuejs/vue.min.js", - "wwwroot/vendor/summernote/summernote-bs5.js", - "wwwroot/js/summernote-options.js", - "wwwroot/pos-admin/main.js" - ] - }, - { - "outputFileName": "wwwroot/bundles/pos-admin-bundle.min.css", - "inputFiles": [ - "wwwroot/vendor/summernote/summernote-bs5.css", - "wwwroot/main/template-editor.css" - ] - }, { "outputFileName": "wwwroot/bundles/crowdfund-bundle.min.css", "inputFiles": [ @@ -135,7 +93,6 @@ { "outputFileName": "wwwroot/bundles/light-pos-bundle.min.js", "inputFiles": [ - "wwwroot/vendor/vuejs/vue.min.js", "wwwroot/light-pos/**/*.js" ] }, @@ -145,38 +102,9 @@ "wwwroot/light-pos/**/*.css" ] }, - { - "outputFileName": "wwwroot/bundles/payment-request-admin-bundle.min.js", - "inputFiles": [ - "wwwroot/js/summernote-options.js", - "wwwroot/vendor/summernote/summernote-bs5.js", - "wwwroot/payment-request-admin/**/*.js" - ] - }, - { - "outputFileName": "wwwroot/bundles/pull-payment-admin-bundle.min.js", - "inputFiles": [ - "wwwroot/js/summernote-options.js", - "wwwroot/vendor/summernote/summernote-bs5.js", - "wwwroot/pull-payment-admin/**/*.js" - ] - }, - { - "outputFileName": "wwwroot/bundles/payment-request-admin-bundle.min.css", - "inputFiles": [ - "wwwroot/vendor/summernote/summernote-bs5.css" - ] - }, - { - "outputFileName": "wwwroot/bundles/pull-payment-admin-bundle.min.css", - "inputFiles": [ - "wwwroot/vendor/summernote/summernote-bs5.css" - ] - }, { "outputFileName": "wwwroot/bundles/payment-request-bundle.min.js", "inputFiles": [ - "wwwroot/vendor/vuejs/vue.min.js", "wwwroot/vendor/babel-polyfill/polyfill.min.js", "wwwroot/vendor/vue-toasted/vue-toasted.min.js", "wwwroot/vendor/bootstrap-vue/bootstrap-vue.js", @@ -202,8 +130,6 @@ { "outputFileName": "wwwroot/bundles/wallet-send-bundle.min.js", "inputFiles": [ - "wwwroot/vendor/vuejs/vue.min.js", - "wwwroot/vendor/babel-polyfill/polyfill.min.js", "wwwroot/vendor/bc-ur/web-bundle.js", "wwwroot/vendor/ur-registry/urlib.min.js", "wwwroot/vendor/vue-qrcode-reader/VueQrcodeReader.umd.min.js", diff --git a/BTCPayServer/wwwroot/crowdfund-admin/main.js b/BTCPayServer/wwwroot/crowdfund-admin/main.js deleted file mode 100644 index e8dadd035..000000000 --- a/BTCPayServer/wwwroot/crowdfund-admin/main.js +++ /dev/null @@ -1,3 +0,0 @@ -document.addEventListener('DOMContentLoaded', () => { - $('.richtext').summernote(window.summernoteOptions()) -}) diff --git a/BTCPayServer/wwwroot/js/summernote-options.js b/BTCPayServer/wwwroot/js/summernote-options.js deleted file mode 100644 index 0662855ca..000000000 --- a/BTCPayServer/wwwroot/js/summernote-options.js +++ /dev/null @@ -1,14 +0,0 @@ -(function() { - window.summernoteOptions = function() { - return { - minHeight: 300, - tableClassName: 'table table-sm', - insertTableMaxSize: { - col: 5, - row: 10 - }, - codeviewFilter: true, - codeviewFilterRegex: new RegExp($.summernote.options.codeviewFilterRegex.source + '|<.*?( on\\w+?=.*?)>', 'gi') - } - } -})() diff --git a/BTCPayServer/wwwroot/main/site.js b/BTCPayServer/wwwroot/main/site.js index 713945de0..6abc18d47 100644 --- a/BTCPayServer/wwwroot/main/site.js +++ b/BTCPayServer/wwwroot/main/site.js @@ -28,7 +28,7 @@ document.addEventListener("DOMContentLoaded", function () { } updateTimeAgo(); - // intializing date time pickers throughts website + // intializing date time pickers $(".flatdtpicker").each(function () { var element = $(this); var fdtp = element.attr("data-fdtp"); @@ -56,7 +56,20 @@ document.addEventListener("DOMContentLoaded", function () { }); } }); - + + // rich text editor + if ($.summernote) { + $('.richtext').summernote({ + minHeight: 300, + tableClassName: 'table table-sm', + insertTableMaxSize: { + col: 5, + row: 10 + }, + codeviewFilter: true, + codeviewFilterRegex: new RegExp($.summernote.options.codeviewFilterRegex.source + '|<.*?( on\\w+?=.*?)>', 'gi') + }); + } $(".input-group-clear").on("click", function () { $(this).parents(".input-group").find("input").val(null); diff --git a/BTCPayServer/wwwroot/payment-request-admin/main.js b/BTCPayServer/wwwroot/payment-request-admin/main.js deleted file mode 100644 index e8dadd035..000000000 --- a/BTCPayServer/wwwroot/payment-request-admin/main.js +++ /dev/null @@ -1,3 +0,0 @@ -document.addEventListener('DOMContentLoaded', () => { - $('.richtext').summernote(window.summernoteOptions()) -}) diff --git a/BTCPayServer/wwwroot/pos-admin/main.js b/BTCPayServer/wwwroot/pos-admin/main.js deleted file mode 100644 index 1944c0e41..000000000 --- a/BTCPayServer/wwwroot/pos-admin/main.js +++ /dev/null @@ -1,3 +0,0 @@ -document.addEventListener('DOMContentLoaded', () => { - $('.richtext').summernote(window.summernoteOptions()) -}); diff --git a/BTCPayServer/wwwroot/pull-payment-admin/main.js b/BTCPayServer/wwwroot/pull-payment-admin/main.js deleted file mode 100644 index e8dadd035..000000000 --- a/BTCPayServer/wwwroot/pull-payment-admin/main.js +++ /dev/null @@ -1,3 +0,0 @@ -document.addEventListener('DOMContentLoaded', () => { - $('.richtext').summernote(window.summernoteOptions()) -})