Browse Source

fix issue

pull/2081/head
zhoupzh 3 years ago
parent
commit
c79ea8994e
2 changed files with 29 additions and 4 deletions
  1. +1
    -0
      templates/repo/home.tmpl
  2. +28
    -4
      templates/repo/view_list.tmpl

+ 1
- 0
templates/repo/home.tmpl View File

@@ -147,6 +147,7 @@
{{template "repo/branch_dropdown" .}} {{template "repo/branch_dropdown" .}}
{{ $n := len .TreeNames}} {{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}} {{ $l := Subtract $n 1}}
{{.TreePath}}
<!-- If home page, show new PR. If not, show breadcrumb --> <!-- If home page, show new PR. If not, show breadcrumb -->
{{if eq $n 0}} {{if eq $n 0}}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}


+ 28
- 4
templates/repo/view_list.tmpl View File

@@ -155,17 +155,17 @@
</tr> </tr>
<tr style="display: none;" class="context-menu-one"> <tr style="display: none;" class="context-menu-one">
<td colspan="12"> <td colspan="12">
<form class="ui column form" method="POST">
<div class="ui column form" method="POST">
<div class="two fields" style="margin: 0;"> <div class="two fields" style="margin: 0;">
<div class="five wide field"> <div class="five wide field">
<input class="ui input" name="new_filename" type="text" value="test">
<input class="ui input" name="new_filename" type="text" value="">
</div> </div>
<div class="five wide field"> <div class="five wide field">
<button class="ui blue button popup-save" type="submit">保存</button>
<button class="ui blue button popup-save" type="button" data-postBasePath="{{$.RepoLink}}/_rename/{{EscapePound $.BranchName}}{{if $.TreePath}}/{{EscapePound $.TreePath}}{{end}}/{{$entry.Name}}" data-commit="{{$.LatestCommit.ID}}" data-treepath="{{if $.TreePath}}/{{EscapePound $.TreePath}}{{end}}/">保存</button>
<button class="ui basic button popup-close" type="button">取消</button> <button class="ui basic button popup-close" type="button">取消</button>
</div> </div>
</div> </div>
</form>
</div>
</td> </td>
</tr> </tr>
{{end}} {{end}}
@@ -366,6 +366,7 @@
// if (a.target.nodeName === 'LI') { // if (a.target.nodeName === 'LI') {
// a.target.remove() // a.target.remove()
// } // }
console.log(e,a)
document.querySelectorAll(".context-menu-one").forEach((ele)=>{ document.querySelectorAll(".context-menu-one").forEach((ele)=>{
if(ele.style.display==='table-row'){ 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')) 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) => { // beforeDisabled: (e) => {
// console.log(e,e.target) // console.log(e,e.target)


Loading…
Cancel
Save