Browse Source

fix issue

zouap
zhoupzh 2 years ago
parent
commit
8910bfa617
5 changed files with 57 additions and 5 deletions
  1. +3
    -0
      options/locale/locale_en-US.ini
  2. +3
    -0
      options/locale/locale_zh-CN.ini
  3. +4
    -2
      templates/repo/issue/list.tmpl
  4. +19
    -1
      templates/repo/issue/view_content/sidebar.tmpl
  5. +28
    -2
      web_src/js/index.js

+ 3
- 0
options/locale/locale_en-US.ini View File

@@ -1732,6 +1732,9 @@ issues.attachment.open_tab = `Click to see "%s" in a new tab`
issues.attachment.download = `Click to download "%s"` issues.attachment.download = `Click to download "%s"`
issues.subscribe = Subscribe issues.subscribe = Subscribe
issues.unsubscribe = Unsubscribe issues.unsubscribe = Unsubscribe
issues.top_task=Top issue
issues.top = Top
issues.cancel_topping = Cancel topping
issues.lock = Lock conversation issues.lock = Lock conversation
issues.unlock = Unlock conversation issues.unlock = Unlock conversation
issues.lock.unknown_reason = Cannot lock an issue with an unknown reason. issues.lock.unknown_reason = Cannot lock an issue with an unknown reason.


+ 3
- 0
options/locale/locale_zh-CN.ini View File

@@ -1749,6 +1749,9 @@ issues.attachment.open_tab=`在新的标签页中查看 '%s'`
issues.attachment.download=`点击下载 '%s'` issues.attachment.download=`点击下载 '%s'`
issues.subscribe=订阅 issues.subscribe=订阅
issues.unsubscribe=取消订阅 issues.unsubscribe=取消订阅
issues.top_task=置顶任务
issues.top=置顶
issues.cancel_topping=取消置顶
issues.lock=锁定对话 issues.lock=锁定对话
issues.unlock=解锁对话 issues.unlock=解锁对话
issues.lock.unknown_reason=由于未知原因无法锁定。 issues.lock.unknown_reason=由于未知原因无法锁定。


+ 4
- 2
templates/repo/issue/list.tmpl View File

@@ -246,7 +246,9 @@
{{end}} {{end}}
<div class="ui {{if .IsClosed}}{{if .IsPull}}{{if .PullRequest.HasMerged}}purple{{else}}red{{end}}{{else}}red{{end}}{{else}}{{if .IsRead}}white{{else}}green{{end}}{{end}} label">#{{.Index}}</div> <div class="ui {{if .IsClosed}}{{if .IsPull}}{{if .PullRequest.HasMerged}}purple{{else}}red{{end}}{{else}}red{{end}}{{else}}{{if .IsRead}}white{{else}}green{{end}}{{end}} label">#{{.Index}}</div>
<a class="title" href="{{$.Link}}/{{.Index}}">{{RenderEmoji .Title}}</a> <a class="title" href="{{$.Link}}/{{.Index}}">{{RenderEmoji .Title}}</a>

{{if eq .StayTop 1}}
<div class="ui label green" data="{{.StayTop}}">{{$.i18n.Tr "repo.issues.top"}}</div>
{{end}}
{{if .IsPull }} {{if .IsPull }}
{{if (index $.CommitStatus .PullRequest.ID)}} {{if (index $.CommitStatus .PullRequest.ID)}}
{{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
@@ -264,7 +266,7 @@
{{if .TotalTrackedTime}} {{if .TotalTrackedTime}}
<span class="comment ui right">{{svg "octicon-clock" 16}} {{.TotalTrackedTime | Sec2Time}}</span> <span class="comment ui right">{{svg "octicon-clock" 16}} {{.TotalTrackedTime | Sec2Time}}</span>
{{end}} {{end}}
<p class="desc"> <p class="desc">
{{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }} {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
{{if .OriginalAuthor }} {{if .OriginalAuthor }}


+ 19
- 1
templates/repo/issue/view_content/sidebar.tmpl View File

@@ -325,6 +325,25 @@
</div> </div>
</div> </div>
{{end}} {{end}}

{{if and $.IssueWatch (not .Repository.IsArchived)}}
<div class="ui divider"></div>

<div class="ui isToping">
<span class="text"><strong>{{.i18n.Tr "repo.issues.top_task"}}</strong></span>
<div id="stayTopIssue" data-issue-top="{{if .Issue.StayTop}}false{{else}}true{{end}}" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/setstaytop">
<button class="fluid ui button">
{{if .Issue.StayTop}}
{{.i18n.Tr "repo.issues.cancel_topping"}}
{{else}}
{{.i18n.Tr "repo.issues.top"}}
{{end}}
</button>
</form>
</div>
</div>
{{end}}

{{if .Repository.IsTimetrackerEnabled }} {{if .Repository.IsTimetrackerEnabled }}
{{if and .CanUseTimetracker (not .Repository.IsArchived)}} {{if and .CanUseTimetracker (not .Repository.IsArchived)}}
<div class="ui divider"></div> <div class="ui divider"></div>
@@ -646,4 +665,3 @@
</div> </div>
{{end}} {{end}}
{{end}} {{end}}


+ 28
- 2
web_src/js/index.js View File

@@ -56,6 +56,7 @@ import { Message } from "element-ui";
import { i18nVue } from "./features/i18nVue.js"; import { i18nVue } from "./features/i18nVue.js";
import './features/ad.js'; import './features/ad.js';
import { Fancybox } from "./vendor/fancybox.esm.js"; import { Fancybox } from "./vendor/fancybox.esm.js";
import { resolveProjectReferencePath } from "typescript";




Vue.prototype.$axios = axios; Vue.prototype.$axios = axios;
@@ -263,7 +264,20 @@ function updateIssuesMeta(url, action, issueIds, elementId, isAdd) {
}); });
}); });
} }

function updateIssueTop(url,param) {
return new Promise((resolve,reject) => {
$.ajax({
type: "POST",
url,
data: {
_csrf: csrf,
isStayTop:param,
},
success: resolve,
error:reject,
});
});
}
function initRepoStatusChecker() { function initRepoStatusChecker() {
const migrating = $("#repo_migrating"); const migrating = $("#repo_migrating");
$("#repo_migrating_failed").hide(); $("#repo_migrating_failed").hide();
@@ -824,7 +838,19 @@ function initIssueComments() {
event.preventDefault(); event.preventDefault();
updateIssuesMeta(url, "", issueId, id, isChecked).then(reload); updateIssuesMeta(url, "", issueId, id, isChecked).then(reload);
}); });

$("#stayTopIssue").on("click", function (event){
const url = $(this).data("update-url");
const isIssueTop = $(this).data("issue-top");
updateIssueTop(url, isIssueTop).then((res, rej) => {
console.log(res)
if (res.code === 0){
reload()
}
}).catch((err) => {
console.log(err)
})
event.preventDefault();
})
$(document).on("click", (event) => { $(document).on("click", (event) => {
const urlTarget = $(":target"); const urlTarget = $(":target");
if (urlTarget.length === 0) return; if (urlTarget.length === 0) return;


Loading…
Cancel
Save