forked from Shiloh/githaven
#2114 External URL for wiki
This commit is contained in:
parent
b21160a13a
commit
40f3142264
@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
||||
|
||||
![](public/img/gogs-large-resize.png)
|
||||
|
||||
##### Current version: 0.7.41 Beta
|
||||
##### Current version: 0.7.42 Beta
|
||||
|
||||
| Web | UI | Preview |
|
||||
|:-------------:|:-------:|:-------:|
|
||||
|
@ -569,6 +569,9 @@ settings.update_settings = Update Settings
|
||||
settings.change_reponame_prompt = This change will affect how links relate to the repository.
|
||||
settings.advanced_settings = Advanced Settings
|
||||
settings.wiki_desc = Enable wiki to allow people write documents
|
||||
settings.use_external_wiki = Use external wiki
|
||||
settings.external_wiki_url = External Wiki URL
|
||||
settings.external_wiki_url_desc = Visitors will be redirected to URL when they click on the tab.
|
||||
settings.issues_desc = Enable builtin lightweight issue tracker
|
||||
settings.use_external_issue_tracker = Use external issue tracker
|
||||
settings.tracker_url_format = External Issue Tracker URL Format
|
||||
|
2
gogs.go
2
gogs.go
@ -18,7 +18,7 @@ import (
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.7.41.1210 Beta"
|
||||
const APP_VER = "0.7.42.1211 Beta"
|
||||
|
||||
func init() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
@ -164,6 +164,8 @@ type Repository struct {
|
||||
|
||||
// Advanced settings
|
||||
EnableWiki bool `xorm:"NOT NULL DEFAULT true"`
|
||||
EnableExternalWiki bool
|
||||
ExternalWikiURL string
|
||||
EnableIssues bool `xorm:"NOT NULL DEFAULT true"`
|
||||
EnableExternalTracker bool
|
||||
ExternalTrackerFormat string
|
||||
|
@ -91,6 +91,8 @@ type RepoSettingForm struct {
|
||||
|
||||
// Advanced settings
|
||||
EnableWiki bool
|
||||
EnableExternalWiki bool
|
||||
ExternalWikiURL string
|
||||
EnableIssues bool
|
||||
EnableExternalTracker bool
|
||||
TrackerURLFormat string
|
||||
|
File diff suppressed because one or more lines are too long
@ -496,6 +496,7 @@ func updateServerInfo(gitBinPath, dir string) []byte {
|
||||
return gitCommand(gitBinPath, dir, args...)
|
||||
}
|
||||
|
||||
// FIXME: use process module
|
||||
func gitCommand(gitBinPath, dir string, args ...string) []byte {
|
||||
command := exec.Command(gitBinPath, args...)
|
||||
command.Dir = dir
|
||||
|
@ -125,6 +125,8 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
|
||||
|
||||
case "advanced":
|
||||
repo.EnableWiki = form.EnableWiki
|
||||
repo.EnableExternalWiki = form.EnableExternalWiki
|
||||
repo.ExternalWikiURL = form.ExternalWikiURL
|
||||
repo.EnableIssues = form.EnableIssues
|
||||
repo.EnableExternalTracker = form.EnableExternalTracker
|
||||
repo.ExternalTrackerFormat = form.TrackerURLFormat
|
||||
|
@ -27,6 +27,12 @@ const (
|
||||
func MustEnableWiki(ctx *middleware.Context) {
|
||||
if !ctx.Repo.Repository.EnableWiki {
|
||||
ctx.Handle(404, "MustEnableWiki", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Repo.Repository.EnableExternalWiki {
|
||||
ctx.Redirect(ctx.Repo.Repository.ExternalWikiURL)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
0.7.41.1210 Beta
|
||||
0.7.42.1211 Beta
|
@ -84,6 +84,17 @@
|
||||
<label>{{.i18n.Tr "repo.settings.wiki_desc"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<div class="ui checkbox">
|
||||
<input name="enable_external_wiki" type="checkbox" {{if .Repository.EnableExternalWiki}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.settings.use_external_wiki"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="external_wiki_url">{{.i18n.Tr "repo.settings.external_wiki_url"}}</label>
|
||||
<input id="external_wiki_url" name="external_wiki_url" type="url" value="{{.Repository.ExternalWikiURL}}">
|
||||
<p class="help">{{.i18n.Tr "repo.settings.external_wiki_url_desc"}}</p>
|
||||
</div>
|
||||
|
||||
<div class="ui divider"></div>
|
||||
|
||||
@ -102,7 +113,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="tracker_url_format">{{.i18n.Tr "repo.settings.tracker_url_format"}}</label>
|
||||
<input id="tracker_url_format" name="tracker_url_format" 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}">
|
||||
<p class="help">{{.i18n.Tr "repo.settings.tracker_url_format_desc" | Str2html}}</p>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user