mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 11:12:45 +01:00
Implementation of the feature to redirect to an external issue tracker
This commit is contained in:
parent
4a5faecd8f
commit
8dc49dc114
7 changed files with 18 additions and 3 deletions
|
@ -648,6 +648,8 @@ settings.external_wiki_url_desc = Visitors will be redirected to URL when they c
|
||||||
settings.issues_desc = Enable issue tracker
|
settings.issues_desc = Enable issue tracker
|
||||||
settings.use_internal_issue_tracker = Use builtin lightweight issue tracker
|
settings.use_internal_issue_tracker = Use builtin lightweight issue tracker
|
||||||
settings.use_external_issue_tracker = Use external issue tracker
|
settings.use_external_issue_tracker = Use external issue tracker
|
||||||
|
settings.external_tracker_url = External Issue Tracker URL
|
||||||
|
settings.external_tracker_url_desc = Visitors will be redirected to URL when they click on the tab.
|
||||||
settings.tracker_url_format = External Issue Tracker URL Format
|
settings.tracker_url_format = External Issue Tracker URL Format
|
||||||
settings.tracker_issue_style = External Issue Tracker Naming Style:
|
settings.tracker_issue_style = External Issue Tracker Naming Style:
|
||||||
settings.tracker_issue_style.numeric = Numeric
|
settings.tracker_issue_style.numeric = Numeric
|
||||||
|
|
|
@ -186,6 +186,7 @@ type Repository struct {
|
||||||
ExternalWikiURL string
|
ExternalWikiURL string
|
||||||
EnableIssues bool `xorm:"NOT NULL DEFAULT true"`
|
EnableIssues bool `xorm:"NOT NULL DEFAULT true"`
|
||||||
EnableExternalTracker bool
|
EnableExternalTracker bool
|
||||||
|
ExternalTrackerURL string
|
||||||
ExternalTrackerFormat string
|
ExternalTrackerFormat string
|
||||||
ExternalTrackerStyle string
|
ExternalTrackerStyle string
|
||||||
ExternalMetas map[string]string `xorm:"-"`
|
ExternalMetas map[string]string `xorm:"-"`
|
||||||
|
|
|
@ -96,6 +96,7 @@ type RepoSettingForm struct {
|
||||||
ExternalWikiURL string
|
ExternalWikiURL string
|
||||||
EnableIssues bool
|
EnableIssues bool
|
||||||
EnableExternalTracker bool
|
EnableExternalTracker bool
|
||||||
|
ExternalTrackerURL string
|
||||||
TrackerURLFormat string
|
TrackerURLFormat string
|
||||||
TrackerIssueStyle string
|
TrackerIssueStyle string
|
||||||
EnablePulls bool
|
EnablePulls bool
|
||||||
|
|
|
@ -52,10 +52,15 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func MustEnableIssues(ctx *context.Context) {
|
func MustEnableIssues(ctx *context.Context) {
|
||||||
if !ctx.Repo.Repository.EnableIssues || ctx.Repo.Repository.EnableExternalTracker {
|
if !ctx.Repo.Repository.EnableIssues {
|
||||||
ctx.Handle(404, "MustEnableIssues", nil)
|
ctx.Handle(404, "MustEnableIssues", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.Repo.Repository.EnableExternalTracker {
|
||||||
|
ctx.Redirect(ctx.Repo.Repository.ExternalTrackerURL)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func MustAllowPulls(ctx *context.Context) {
|
func MustAllowPulls(ctx *context.Context) {
|
||||||
|
|
|
@ -146,6 +146,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
||||||
repo.ExternalWikiURL = form.ExternalWikiURL
|
repo.ExternalWikiURL = form.ExternalWikiURL
|
||||||
repo.EnableIssues = form.EnableIssues
|
repo.EnableIssues = form.EnableIssues
|
||||||
repo.EnableExternalTracker = form.EnableExternalTracker
|
repo.EnableExternalTracker = form.EnableExternalTracker
|
||||||
|
repo.ExternalTrackerURL = form.ExternalTrackerURL
|
||||||
repo.ExternalTrackerFormat = form.TrackerURLFormat
|
repo.ExternalTrackerFormat = form.TrackerURLFormat
|
||||||
repo.ExternalTrackerStyle = form.TrackerIssueStyle
|
repo.ExternalTrackerStyle = form.TrackerIssueStyle
|
||||||
repo.EnablePulls = form.EnablePulls
|
repo.EnablePulls = form.EnablePulls
|
||||||
|
|
|
@ -52,9 +52,9 @@
|
||||||
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}">
|
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}">
|
||||||
<i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
|
<i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
|
||||||
</a>
|
</a>
|
||||||
{{if and .Repository.EnableIssues (not .Repository.EnableExternalTracker)}}
|
{{if .Repository.EnableIssues}}
|
||||||
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
|
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
|
||||||
<i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span>
|
<i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} {{if not .Repository.EnableExternalTracker}}<span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}{{end}}</span>
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if .Repository.AllowsPulls}}
|
{{if .Repository.AllowsPulls}}
|
||||||
|
|
|
@ -161,6 +161,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field {{if not .Repository.EnableExternalTracker}}disabled{{end}}" id="external_issue_box">
|
<div class="field {{if not .Repository.EnableExternalTracker}}disabled{{end}}" id="external_issue_box">
|
||||||
|
<div class="field">
|
||||||
|
<label for="external_tracker_url">{{.i18n.Tr "repo.settings.external_tracker_url"}}</label>
|
||||||
|
<input id="external_tracker_url" name="external_tracker_url" type="url" value="{{.Repository.ExternalTrackerURL}}">
|
||||||
|
<p class="help">{{.i18n.Tr "repo.settings.external_tracker_url_desc"}}</p>
|
||||||
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="tracker_url_format">{{.i18n.Tr "repo.settings.tracker_url_format"}}</label>
|
<label for="tracker_url_format">{{.i18n.Tr "repo.settings.tracker_url_format"}}</label>
|
||||||
<input id="tracker_url_format" name="tracker_url_format" type="url" value="{{.Repository.ExternalTrackerFormat}}" placeholder="e.g. https://github.com/{user}/{repo}/issues/{index}">
|
<input id="tracker_url_format" name="tracker_url_format" type="url" value="{{.Repository.ExternalTrackerFormat}}" placeholder="e.g. https://github.com/{user}/{repo}/issues/{index}">
|
||||||
|
|
Loading…
Reference in a new issue