From a7ae132b2b0c312cc4ee97de675cacae3756a9c4 Mon Sep 17 00:00:00 2001 From: BaiJiangJie Date: Fri, 18 Oct 2019 18:06:07 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BC=98=E5=8C=96=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E8=B5=84=E4=BA=A7=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=B8=8D=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E4=BB=A5=E5=9C=A8=E6=94=B6=E8=97=8F=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E5=88=97=E8=A1=A8=E5=8F=96=E6=B6=88=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/templates/assets/user_asset_list.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/assets/templates/assets/user_asset_list.html b/apps/assets/templates/assets/user_asset_list.html index 9d3853480..fa2c9830c 100644 --- a/apps/assets/templates/assets/user_asset_list.html +++ b/apps/assets/templates/assets/user_asset_list.html @@ -104,6 +104,7 @@ $(document).ready(function () { body: JSON.stringify({asset: assetId}), flash_message: false, success: function (data) { + favoriteAssets.push(assetId); var btn = disfavorBtnTmpl.replace("ID", assetId); $this.replaceWith(btn) } @@ -117,6 +118,10 @@ $(document).ready(function () { method: "DELETE", flash_message: false, success: function (data) { + var index = favoriteAssets.indexOf(assetId); + if (index !== '-1'){ + favoriteAssets.splice(index, 1); + } var btn = favorBtnTmpl.replace("ID", assetId); $this.replaceWith(btn) }