Browse Source

fix issue

tags/v1.22.5.1^2
zhoupzh 3 years ago
parent
commit
a78467337f
2 changed files with 36 additions and 11 deletions
  1. +1
    -0
      templates/repo/home.tmpl
  2. +35
    -11
      templates/repo/view_list.tmpl

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

@@ -247,6 +247,7 @@
<div class="ui container">
<div class="ui mobile reversed stackable grid">
<div class="ui ten wide tablet twelve wide computer column">
{{.CanEditFile}}
{{if .IsViewFile}}
{{template "repo/view_file" .}}
{{else if .IsBlame}}


+ 35
- 11
templates/repo/view_list.tmpl View File

@@ -49,6 +49,15 @@
margin: 0px 5px 0px 0px !important;
}
</style>
<div id="mask">
<div id="loadingPage">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
</div>
<table id="repo-files-table" class="ui single line table">
{{.CsrfTokenHtml}}
<thead>
@@ -154,7 +163,7 @@
</td>
<td class="text right age three wide">{{TimeSince $commit.Committer.When $.Lang}}</td>
</tr>
<tr style="display: none;" class="context-menu-one">
<tr style="display: none !important;" class="context-menu-one">
<td colspan="12">
<div class="ui column form" method="POST">
<div class="two fields" style="margin: 0;">
@@ -162,7 +171,7 @@
<input class="ui input" name="new_filename" type="text" value="">
</div>
<div class="five wide field">
<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 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>
</div>
</div>
@@ -200,14 +209,27 @@
<script>
$('.popup-close').on('click',function(e){
$(this).parents('tr').prev().css('display','table-row')
$(this).closest('tr').css("display",'none')
$(this).closest('tr').css('cssText','display:none !important')
})
$('.name.four.wide').on('contextmenu',function(e){
let ev = window.event || e;
ev.preventDefault();
menu.show(e)
})

function test(){
$('.name.four.wide').on('contextmenu',function(e){
let ev = window.event || e;
ev.preventDefault();
menu.show(e)
})
// if({{.CanEditFile}}){
// $('.name.four.wide').on('contextmenu',function(e){
// let ev = window.event || e;
// ev.preventDefault();
// menu.show(e)
// })
// }else{
// return
// }
}
test()
// const ContextMenu = function (options) {
// // 唯一实例
// let instance;
@@ -376,7 +398,7 @@
}
})
if(a.currentTarget.parentNode.nextElementSibling){
a.currentTarget.parentNode.style.display = 'none'
a.currentTarget.parentNode.style.setProperty('display','none','important')
a.currentTarget.parentNode.nextElementSibling.style.display='table-row'
// a.target.parentNode.nextElementSibling =
a.currentTarget.parentNode.nextElementSibling.getElementsByTagName("input")[0].setAttribute("value", a.currentTarget.getElementsByTagName("a")[0].getAttribute('title'))
@@ -401,6 +423,8 @@
data:{last_commit:last_commit,tree_path:tree_path,_csrf:csrf},
success:function(res){
console.log(res)
document.getElementById("mask").style.display = "block"
location.reload()
}

})
@@ -434,6 +458,6 @@
// }
]
})
console.log({{$.CanEditFile}})
</script>

Loading…
Cancel
Save