Browse Source

Merge remote-tracking branch 'origin/V20220314' into fix-jobname

tags/V1.22.3.1^2
liuzx 3 years ago
parent
commit
c6c0034196
4 changed files with 41 additions and 10 deletions
  1. +1
    -1
      options/locale/locale_zh-CN.ini
  2. +8
    -2
      public/home/home.js
  3. +4
    -4
      routers/private/hook.go
  4. +28
    -3
      templates/org/home.tmpl

+ 1
- 1
options/locale/locale_zh-CN.ini View File

@@ -2105,7 +2105,7 @@ select_again = 选择超过9个,请重新选择!
custom_select_projects = 自定义精选项目
customize = 自定义
selected_project=精选项目
fold = 折叠
fold = 收起
unfold = 展开

form.name_reserved=组织名称 '%s' 是被保留的。


+ 8
- 2
public/home/home.js View File

@@ -113,12 +113,18 @@ socket.onmessage = function (e) {
html += recordPrefix + actionName;
html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" +getRepotext(record) + "</a>"
}
else if(record.OpType == "9" || record.OpType == "5"){
else if(record.OpType == "5"){
branch = "<a href=\"" + getRepoLink(record) + "/src/branch/" + encodeURI(record.RefName) + "\" rel=\"nofollow\">" + record.RefName + "</a>"
actionName = actionName.replace("{branch}",branch);
html += recordPrefix + actionName;
html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepotext(record) + "</a>"
}else if(record.OpType == "17"){
}else if(record.OpType == "9"){
branch = "<a href=\"" + getRepoLink(record) + "/src/tag/" + encodeURI(record.RefName) + "\" rel=\"nofollow\">" + record.RefName + "</a>"
actionName = actionName.replace("{branch}",branch);
html += recordPrefix + actionName;
html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepotext(record) + "</a>"
}
else if(record.OpType == "17"){
actionName = actionName.replace("{deleteBranchName}",record.RefName);
var repoLink = "<a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepotext(record) + "</a>"
actionName = actionName.replace("{repoName}",repoLink);


+ 4
- 4
routers/private/hook.go View File

@@ -416,6 +416,10 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
copy(updates[1:], updates)
updates[0] = &option
}

if err := updateRepoCommitCnt(ctx, repo); err != nil {
log.Error("updateRepoCommitCnt failed:%v", err.Error(), ctx.Data["MsgID"])
}
}
}

@@ -521,10 +525,6 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
}
}

if err := updateRepoCommitCnt(ctx, repo); err != nil {
log.Error("updateRepoCommitCnt failed:%v", err.Error(), ctx.Data["MsgID"])
}

ctx.JSON(http.StatusOK, private.HookPostReceiveResult{
Results: results,
RepoWasEmpty: wasEmpty,


+ 28
- 3
templates/org/home.tmpl View File

@@ -29,16 +29,17 @@
<div class="ui mobile reversed stackable grid">
<div class="ui sixteen wide tablet sixteen wide computer column margin-bottom20 pad-botom maxheight" id='key_tag'>
{{if .OrgTopics}}
<a class="{{if eq $.Keyword "" }} tag_bg {{end}} tag_key ui small tag_lable topic omit" href="{{$.Link}}?" >{{$.i18n.Tr "org.all_org_topics"}}</span></a>
<a class="{{if eq $.Keyword "" }} tag_bg {{end}} tag_key ui small tag_lable topic omit" href="{{$.Link}}?" onclick="iscontinueStatus()" id="tag_a">{{$.i18n.Tr "org.all_org_topics"}}</a>
{{end}}

{{range .OrgTopics}}
{{if ne .Name ""}}
<a class="{{if eq $.Keyword .Name }} tag_bg {{end}} tag_key ui small tag_lable topic omit" href="{{$.Link}}?q={{.Name}}" >
<a class="{{if eq $.Keyword .Name }} tag_bg {{end}} tag_key ui small tag_lable topic omit" href="{{$.Link}}?q={{.Name}}" onclick="iscontinueStatus()">
{{.Name}}
</a>
{{end}}
{{end}}

{{if .OrgTopics}}
<a class=" tag_key ui small tag_lable topic omit icon_a" onclick="isUnfold()" id="icon_btn" >
<i class="ri-arrow-down-s-line" style="display:inline-block;vertical-align:top"></i>
@@ -136,14 +137,38 @@
<script>

function isUnfold(){
// var isTrue = document.getElementById("tag_a").getAttribute("data-tag")
var isContain= document.querySelector("#key_tag").classList.contains("maxheight");
if(isContain){
if(isContain){
document.querySelector("#key_tag").classList.remove("maxheight");
document.getElementById("icon_btn").innerHTML="<i class=\"ri-arrow-up-s-line\" style=\"display:inline-block;vertical-align:top\"></i> &nbsp {{.i18n.Tr "org.fold"}}"
localStorage.setItem("isunfold",true)
}else{
document.querySelector("#key_tag").classList.add("maxheight");
document.getElementById("icon_btn").innerHTML="<i class=\"ri-arrow-down-s-line\" style=\"display:inline-block;vertical-align:top\"></i> &nbsp {{.i18n.Tr "org.unfold"}}"
localStorage.setItem("isunfold",false)
}
}

function isShowIconBtn(){
var key_height = document.getElementById("key_tag").offsetHeight
var parent = document.getElementById("key_tag")
var child = document.getElementById("icon_btn")
if (key_height < 88){
parent.removeChild(child)
}
}
function iscontinueStatus(){
var isunfold = localStorage.getItem("isunfold")
if (isunfold == "true" || isunfold == true){
document.querySelector("#key_tag").classList.remove("maxheight");
document.getElementById("icon_btn").innerHTML="<i class=\"ri-arrow-up-s-line\" style=\"display:inline-block;vertical-align:top\"></i> &nbsp {{.i18n.Tr "org.fold"}}"
}else{
document.querySelector("#key_tag").classList.add("maxheight");
document.getElementById("icon_btn").innerHTML="<i class=\"ri-arrow-down-s-line\" style=\"display:inline-block;vertical-align:top\"></i> &nbsp {{.i18n.Tr "org.unfold"}}"
}
}
isShowIconBtn()
iscontinueStatus()
</script>

Loading…
Cancel
Save