From c79ea8994eb40ea091d0f6faa6c9e9f7297e3848 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 11 May 2022 15:24:12 +0800 Subject: [PATCH] fix issue --- templates/repo/home.tmpl | 1 + templates/repo/view_list.tmpl | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index d253e4752..cdc43b136 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -147,6 +147,7 @@ {{template "repo/branch_dropdown" .}} {{ $n := len .TreeNames}} {{ $l := Subtract $n 1}} + {{.TreePath}} {{if eq $n 0}} {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index 6fb685cd5..ab30b55f5 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -155,17 +155,17 @@ -
+
- +
- +
- +
{{end}} @@ -366,6 +366,7 @@ // if (a.target.nodeName === 'LI') { // a.target.remove() // } + console.log(e,a) document.querySelectorAll(".context-menu-one").forEach((ele)=>{ if(ele.style.display==='table-row'){ @@ -380,6 +381,29 @@ a.currentTarget.parentNode.nextElementSibling.getElementsByTagName("input")[0].setAttribute("value", a.currentTarget.getElementsByTagName("a")[0].getAttribute('title')) } + console.log(a.currentTarget.parentNode.nextElementSibling) + let btn = a.currentTarget.parentNode.nextElementSibling.getElementsByTagName("button")[0] + console.log(btn) + btn.addEventListener('click',function(e) { + console.log('ckilc',e.target.parentNode.previousElementSibling.getElementsByTagName("input")[0]) + + let postUrl = btn.getAttribute('data-postbasepath') + let last_commit = btn.getAttribute('data-commit') + let tree_path = btn.getAttribute('data-treepath') + e.target.parentNode.previousElementSibling.getElementsByTagName("input")[0].value + console.log(postUrl,last_commit) + + $.ajax({ + url:postUrl, + type: "POST", + contentType: "application/x-www-form-urlencoded", + data:{last_commit:last_commit,tree_path:tree_path}, + success:function(res){ + console.log(res) + } + + }) + + }) }, // beforeDisabled: (e) => { // console.log(e,e.target)