From f35fdeccf61586f64b627040bbaebdcc9239ccdc Mon Sep 17 00:00:00 2001 From: ryuring Date: Fri, 23 Feb 2024 12:44:13 +0900 Subject: [PATCH] =?UTF-8?q?fix=20#3152=20=E3=82=B3=E3=83=B3=E3=83=86?= =?UTF-8?q?=E3=83=B3=E3=83=84=E3=82=92=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=A7=E5=89=8A=E9=99=A4=E3=81=97=E3=81=9F?= =?UTF-8?q?=E9=9A=9B=E3=81=AB=E4=BB=96=E7=94=BB=E9=9D=A2=E3=81=AB=E3=81=82?= =?UTF-8?q?=E3=82=8B=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=8C?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/js/admin/contents/index_table.js | 32 +++++++++++++------ .../element/Contents/index_list_table.php | 4 ++- .../js/admin/contents/index_table.bundle.js | 11 +------ .../admin/contents/index_table.bundle.js.map | 2 +- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/plugins/bc-admin-third/src/js/admin/contents/index_table.js b/plugins/bc-admin-third/src/js/admin/contents/index_table.js index e10a457050..cdfc95c3ce 100644 --- a/plugins/bc-admin-third/src/js/admin/contents/index_table.js +++ b/plugins/bc-admin-third/src/js/admin/contents/index_table.js @@ -11,28 +11,39 @@ /** * コンテンツ一覧(テーブル) */ +const contentsIndexTable = { -$(function () { - - initList(); + /** + * mounted + */ + mounted() { + this.initView(); + this.registerEvents(); + }, /** - * 一覧を初期化 + * 表示初期化 */ - function initList() { - $('.btn-copy, .btn-delete, .btn-publish, .btn-unpublish').click(actionClickHandler); + initView() { // 公開・非公開ボタンの表示設定 $("#ListTable tbody tr .btn-publish").hide(); $("#ListTable tbody tr.unpublish .btn-publish").show(); $("#ListTable tbody tr .btn-unpublish").hide(); $("#ListTable tbody tr.publish .btn-unpublish").show(); - } + }, + + /** + * イベント登録 + */ + registerEvents() { + $('.btn-copy, .btn-delete, .btn-publish, .btn-unpublish').click(this.actionClickHandler); + }, /** * アクションボタンクリック時イベント * @returns {boolean} */ - function actionClickHandler() { + actionClickHandler() { const $target = $(this); if ($target.attr('data-confirm-message') && !confirm($target.attr('data-confirm-message'))) { return false; @@ -51,6 +62,7 @@ $(function () { $.bcUtil.showLoader(); } }).done(function () { + $.bcUtil.showNoticeMessage(bcI18n.commonExecCompletedMessage); location.reload(); }).fail(function (XMLHttpRequest, textStatus, errorThrown) { $.bcUtil.showAjaxError(bcI18n.commonExecFailedMessage, XMLHttpRequest, errorThrown); @@ -61,4 +73,6 @@ $(function () { return false; } -}); +} + +contentsIndexTable.mounted(); diff --git a/plugins/bc-admin-third/templates/Admin/element/Contents/index_list_table.php b/plugins/bc-admin-third/templates/Admin/element/Contents/index_list_table.php index 7bff481b7c..d409abe714 100644 --- a/plugins/bc-admin-third/templates/Admin/element/Contents/index_list_table.php +++ b/plugins/bc-admin-third/templates/Admin/element/Contents/index_list_table.php @@ -18,7 +18,9 @@ * @var array $contents */ $this->BcListTable->setColumnNumber(8); -$this->BcBaser->js('admin/contents/index_table.bundle'); +$this->BcBaser->js('admin/contents/index_table.bundle', false, [ + 'defer' => true +]); ?> diff --git a/plugins/bc-admin-third/webroot/js/admin/contents/index_table.bundle.js b/plugins/bc-admin-third/webroot/js/admin/contents/index_table.bundle.js index e97788d882..fe12b89b17 100644 --- a/plugins/bc-admin-third/webroot/js/admin/contents/index_table.bundle.js +++ b/plugins/bc-admin-third/webroot/js/admin/contents/index_table.bundle.js @@ -1,11 +1,2 @@ -/** - * baserCMS : Based Website Development Project - * Copyright (c) NPO baser foundation - * - * @copyright Copyright (c) NPO baser foundation - * @link https://basercms.net baserCMS Project - * @since 5.0.0 - * @license https://basercms.net/license/index.html MIT License - */ -$((function(){function t(){var t=$(this);if(t.attr("data-confirm-message")&&!confirm(t.attr("data-confirm-message")))return!1;var e=t.attr("href");return $.bcToken.check((function(){$.ajax({url:e,type:"POST",headers:{"X-CSRF-Token":$.bcToken.key},dataType:"json",data:t.parent().find("form").serialize(),beforeSend:function(){$.bcUtil.showLoader()}}).done((function(){location.reload()})).fail((function(t,e,n){$.bcUtil.showAjaxError(bcI18n.commonExecFailedMessage,t,n),$.bcUtil.hideLoader(),location.href="#Header"}))})),!1}$(".btn-copy, .btn-delete, .btn-publish, .btn-unpublish").click(t),$("#ListTable tbody tr .btn-publish").hide(),$("#ListTable tbody tr.unpublish .btn-publish").show(),$("#ListTable tbody tr .btn-unpublish").hide(),$("#ListTable tbody tr.publish .btn-unpublish").show()})); +({mounted:function(){this.initView(),this.registerEvents()},initView:function(){$("#ListTable tbody tr .btn-publish").hide(),$("#ListTable tbody tr.unpublish .btn-publish").show(),$("#ListTable tbody tr .btn-unpublish").hide(),$("#ListTable tbody tr.publish .btn-unpublish").show()},registerEvents:function(){$(".btn-copy, .btn-delete, .btn-publish, .btn-unpublish").click(this.actionClickHandler)},actionClickHandler:function(){var t=$(this);if(t.attr("data-confirm-message")&&!confirm(t.attr("data-confirm-message")))return!1;var e=t.attr("href");return $.bcToken.check((function(){$.ajax({url:e,type:"POST",headers:{"X-CSRF-Token":$.bcToken.key},dataType:"json",data:t.parent().find("form").serialize(),beforeSend:function(){$.bcUtil.showLoader()}}).done((function(){$.bcUtil.showNoticeMessage(bcI18n.commonExecCompletedMessage),location.reload()})).fail((function(t,e,n){$.bcUtil.showAjaxError(bcI18n.commonExecFailedMessage,t,n),$.bcUtil.hideLoader(),location.href="#Header"}))})),!1}}).mounted(); //# sourceMappingURL=index_table.bundle.js.map \ No newline at end of file diff --git a/plugins/bc-admin-third/webroot/js/admin/contents/index_table.bundle.js.map b/plugins/bc-admin-third/webroot/js/admin/contents/index_table.bundle.js.map index 5bf64503e1..b55ae6e624 100644 --- a/plugins/bc-admin-third/webroot/js/admin/contents/index_table.bundle.js.map +++ b/plugins/bc-admin-third/webroot/js/admin/contents/index_table.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"js/admin/contents/index_table.bundle.js","mappings":";;;;;;;;;AAcAA,GAAE,WAoBE,SAASC,IACL,IAAMC,EAAUF,EAAEG,MAClB,GAAID,EAAQE,KAAK,0BAA4BC,QAAQH,EAAQE,KAAK,yBAC9D,OAAO,EAEX,IAAIE,EAAYJ,EAAQE,KAAK,QAqB7B,OApBAJ,EAAEO,QAAQC,OAAM,WACZR,EAAES,KAAK,CACHC,IAAKJ,EACLK,KAAM,OACNC,QAAS,CACL,eAAgBZ,EAAEO,QAAQM,KAE9BC,SAAU,OACVC,KAAMb,EAAQc,SAASC,KAAK,QAAQC,YACpCC,WAAY,WACRnB,EAAEoB,OAAOC,YACb,IACDC,MAAK,WACJC,SAASC,QACb,IAAGC,MAAK,SAAUC,EAAgBC,EAAYC,GAC1C5B,EAAEoB,OAAOS,cAAcC,OAAOC,wBAAyBL,EAAgBE,GACvE5B,EAAEoB,OAAOY,aACTT,SAASU,KAAO,SACpB,GACJ,KACO,CACX,CAvCIjC,EAAE,wDAAwDkC,MAAMjC,GAEhED,EAAE,oCAAoCmC,OACtCnC,EAAE,8CAA8CoC,OAChDpC,EAAE,sCAAsCmC,OACxCnC,EAAE,8CAA8CoC,MAoCxD","sources":["webpack://bc-admin-third/./src/js/admin/contents/index_table.js"],"sourcesContent":["/**\n * baserCMS : Based Website Development Project \n * Copyright (c) NPO baser foundation \n *\n * @copyright Copyright (c) NPO baser foundation\n * @link https://basercms.net baserCMS Project\n * @since 5.0.0\n * @license https://basercms.net/license/index.html MIT License\n */\n\n/**\n * コンテンツ一覧(テーブル)\n */\n\n$(function () {\n\n initList();\n\n /**\n * 一覧を初期化\n */\n function initList() {\n $('.btn-copy, .btn-delete, .btn-publish, .btn-unpublish').click(actionClickHandler);\n // 公開・非公開ボタンの表示設定\n $(\"#ListTable tbody tr .btn-publish\").hide();\n $(\"#ListTable tbody tr.unpublish .btn-publish\").show();\n $(\"#ListTable tbody tr .btn-unpublish\").hide();\n $(\"#ListTable tbody tr.publish .btn-unpublish\").show();\n }\n\n /**\n * アクションボタンクリック時イベント\n * @returns {boolean}\n */\n function actionClickHandler() {\n const $target = $(this);\n if ($target.attr('data-confirm-message') && !confirm($target.attr('data-confirm-message'))) {\n return false;\n }\n let targetUrl = $target.attr('href');\n $.bcToken.check(function () {\n $.ajax({\n url: targetUrl,\n type: 'POST',\n headers: {\n 'X-CSRF-Token': $.bcToken.key\n },\n dataType: 'json',\n data: $target.parent().find('form').serialize(),\n beforeSend: function () {\n $.bcUtil.showLoader();\n }\n }).done(function () {\n location.reload();\n }).fail(function (XMLHttpRequest, textStatus, errorThrown) {\n $.bcUtil.showAjaxError(bcI18n.commonExecFailedMessage, XMLHttpRequest, errorThrown);\n $.bcUtil.hideLoader();\n location.href = '#Header';\n });\n });\n return false;\n }\n\n});\n"],"names":["$","actionClickHandler","$target","this","attr","confirm","targetUrl","bcToken","check","ajax","url","type","headers","key","dataType","data","parent","find","serialize","beforeSend","bcUtil","showLoader","done","location","reload","fail","XMLHttpRequest","textStatus","errorThrown","showAjaxError","bcI18n","commonExecFailedMessage","hideLoader","href","click","hide","show"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"js/admin/contents/index_table.bundle.js","mappings":"CAa2B,CAKvBA,QAAO,WACHC,KAAKC,WACLD,KAAKE,gBACT,EAKAD,SAAQ,WAEJE,EAAE,oCAAoCC,OACtCD,EAAE,8CAA8CE,OAChDF,EAAE,sCAAsCC,OACxCD,EAAE,8CAA8CE,MACpD,EAKAH,eAAc,WACVC,EAAE,wDAAwDG,MAAMN,KAAKO,mBACzE,EAMAA,mBAAkB,WACd,IAAMC,EAAUL,EAAEH,MAClB,GAAIQ,EAAQC,KAAK,0BAA4BC,QAAQF,EAAQC,KAAK,yBAC9D,OAAO,EAEX,IAAIE,EAAYH,EAAQC,KAAK,QAsB7B,OArBAN,EAAES,QAAQC,OAAM,WACZV,EAAEW,KAAK,CACHC,IAAKJ,EACLK,KAAM,OACNC,QAAS,CACL,eAAgBd,EAAES,QAAQM,KAE9BC,SAAU,OACVC,KAAMZ,EAAQa,SAASC,KAAK,QAAQC,YACpCC,WAAY,WACRrB,EAAEsB,OAAOC,YACb,IACDC,MAAK,WACJxB,EAAEsB,OAAOG,kBAAkBC,OAAOC,4BAClCC,SAASC,QACb,IAAGC,MAAK,SAAUC,EAAgBC,EAAYC,GAC1CjC,EAAEsB,OAAOY,cAAcR,OAAOS,wBAAyBJ,EAAgBE,GACvEjC,EAAEsB,OAAOc,aACTR,SAASS,KAAO,SACpB,GACJ,KACO,CACX,IAIezC","sources":["webpack://bc-admin-third/./src/js/admin/contents/index_table.js"],"sourcesContent":["/**\n * baserCMS : Based Website Development Project \n * Copyright (c) NPO baser foundation \n *\n * @copyright Copyright (c) NPO baser foundation\n * @link https://basercms.net baserCMS Project\n * @since 5.0.0\n * @license https://basercms.net/license/index.html MIT License\n */\n\n/**\n * コンテンツ一覧(テーブル)\n */\nconst contentsIndexTable = {\n\n /**\n * mounted\n */\n mounted() {\n this.initView();\n this.registerEvents();\n },\n\n /**\n * 表示初期化\n */\n initView() {\n // 公開・非公開ボタンの表示設定\n $(\"#ListTable tbody tr .btn-publish\").hide();\n $(\"#ListTable tbody tr.unpublish .btn-publish\").show();\n $(\"#ListTable tbody tr .btn-unpublish\").hide();\n $(\"#ListTable tbody tr.publish .btn-unpublish\").show();\n },\n\n /**\n * イベント登録\n */\n registerEvents() {\n $('.btn-copy, .btn-delete, .btn-publish, .btn-unpublish').click(this.actionClickHandler);\n },\n\n /**\n * アクションボタンクリック時イベント\n * @returns {boolean}\n */\n actionClickHandler() {\n const $target = $(this);\n if ($target.attr('data-confirm-message') && !confirm($target.attr('data-confirm-message'))) {\n return false;\n }\n let targetUrl = $target.attr('href');\n $.bcToken.check(function () {\n $.ajax({\n url: targetUrl,\n type: 'POST',\n headers: {\n 'X-CSRF-Token': $.bcToken.key\n },\n dataType: 'json',\n data: $target.parent().find('form').serialize(),\n beforeSend: function () {\n $.bcUtil.showLoader();\n }\n }).done(function () {\n $.bcUtil.showNoticeMessage(bcI18n.commonExecCompletedMessage);\n location.reload();\n }).fail(function (XMLHttpRequest, textStatus, errorThrown) {\n $.bcUtil.showAjaxError(bcI18n.commonExecFailedMessage, XMLHttpRequest, errorThrown);\n $.bcUtil.hideLoader();\n location.href = '#Header';\n });\n });\n return false;\n }\n\n}\n\ncontentsIndexTable.mounted();\n"],"names":["mounted","this","initView","registerEvents","$","hide","show","click","actionClickHandler","$target","attr","confirm","targetUrl","bcToken","check","ajax","url","type","headers","key","dataType","data","parent","find","serialize","beforeSend","bcUtil","showLoader","done","showNoticeMessage","bcI18n","commonExecCompletedMessage","location","reload","fail","XMLHttpRequest","textStatus","errorThrown","showAjaxError","commonExecFailedMessage","hideLoader","href"],"sourceRoot":""} \ No newline at end of file