summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-07-15 21:53:43 +0800
committerUnknwon <u@gogs.io>2016-07-15 21:53:43 +0800
commit7ca5f8f119593023809e6130db75154597c52426 (patch)
tree00b618852ec93eaba8160832f68f99ffc91382e9
parent194a742fb922c20db0a70100e5f2aaadf03c2acf (diff)
downloadgitea-7ca5f8f119593023809e6130db75154597c52426.tar.gz
gitea-7ca5f8f119593023809e6130db75154597c52426.zip
models/repo: remove redundant info for some repo methods
RepoLink -> Link, RepoRelLink -> RelLink, FullRepoLink -> FullLink
-rw-r--r--models/action.go2
-rw-r--r--models/pull.go2
-rw-r--r--models/repo.go8
-rw-r--r--modules/context/repo.go2
-rw-r--r--routers/repo/pull.go2
-rw-r--r--routers/repo/setting.go2
-rw-r--r--routers/repo/webhook.go2
-rw-r--r--templates/repo/header.tmpl8
8 files changed, 14 insertions, 14 deletions
diff --git a/models/action.go b/models/action.go
index efb4eaaf02..d39209c447 100644
--- a/models/action.go
+++ b/models/action.go
@@ -517,7 +517,7 @@ func CommitRepoAction(
Before: oldCommitID,
After: newCommitID,
CompareUrl: setting.AppUrl + commit.CompareUrl,
- Commits: commit.ToApiPayloadCommits(repo.FullRepoLink()),
+ Commits: commit.ToApiPayloadCommits(repo.FullLink()),
Repo: payloadRepo,
Pusher: &api.PayloadAuthor{
Name: pusher_name,
diff --git a/models/pull.go b/models/pull.go
index 86ddb5d944..8ef0cc643a 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -236,7 +236,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
Before: pr.MergeBase,
After: pr.MergedCommitID,
CompareUrl: setting.AppUrl + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
- Commits: ListToPushCommits(l).ToApiPayloadCommits(pr.BaseRepo.FullRepoLink()),
+ Commits: ListToPushCommits(l).ToApiPayloadCommits(pr.BaseRepo.FullLink()),
Repo: pr.BaseRepo.ComposePayload(),
Pusher: &api.PayloadAuthor{
Name: pr.HeadRepo.MustOwner().DisplayName(),
diff --git a/models/repo.go b/models/repo.go
index 78f1511c9d..f8782db71e 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -346,11 +346,11 @@ func (repo *Repository) GitConfigPath() string {
return filepath.Join(repo.RepoPath(), "config")
}
-func (repo *Repository) RepoLink() string {
+func (repo *Repository) Link() string {
return setting.AppSubUrl + "/" + repo.MustOwner().Name + "/" + repo.Name
}
-func (repo *Repository) RepoRelLink() string {
+func (repo *Repository) RelLink() string {
return "/" + repo.MustOwner().Name + "/" + repo.Name
}
@@ -358,7 +358,7 @@ func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) strin
return fmt.Sprintf("%s/%s/compare/%s...%s", repo.MustOwner().Name, repo.Name, oldCommitID, newCommitID)
}
-func (repo *Repository) FullRepoLink() string {
+func (repo *Repository) FullLink() string {
return setting.AppUrl + repo.MustOwner().Name + "/" + repo.Name
}
@@ -459,7 +459,7 @@ func (repo *Repository) ComposePayload() *api.PayloadRepo {
return &api.PayloadRepo{
ID: repo.ID,
Name: repo.Name,
- URL: repo.FullRepoLink(),
+ URL: repo.FullLink(),
SSHURL: cl.SSH,
CloneURL: cl.HTTPS,
Description: repo.Description,
diff --git a/modules/context/repo.go b/modules/context/repo.go
index a7ca17d3bc..f68576ff5d 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -174,7 +174,7 @@ func RepoAssignment(args ...bool) macaron.Handler {
return
}
ctx.Repo.GitRepo = gitRepo
- ctx.Repo.RepoLink = repo.RepoLink()
+ ctx.Repo.RepoLink = repo.Link()
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index 922d64ef47..da1ee14996 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -531,7 +531,7 @@ func PrepareCompareDiff(
)
// Get diff information.
- ctx.Data["CommitRepoLink"] = headRepo.RepoLink()
+ ctx.Data["CommitRepoLink"] = headRepo.Link()
headCommitID, err := headGitRepo.GetBranchCommitID(headBranch)
if err != nil {
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 14d2963656..6fd195aa10 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -122,7 +122,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
}
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))
- ctx.Redirect(repo.RepoLink() + "/settings")
+ ctx.Redirect(repo.Link() + "/settings")
case "advanced":
repo.EnableWiki = form.EnableWiki
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go
index 460a430aad..d904862359 100644
--- a/routers/repo/webhook.go
+++ b/routers/repo/webhook.go
@@ -349,7 +349,7 @@ func TestWebhook(ctx *context.Context) {
{
ID: ctx.Repo.CommitID,
Message: ctx.Repo.Commit.Message(),
- URL: ctx.Repo.Repository.FullRepoLink() + "/commit/" + ctx.Repo.CommitID,
+ URL: ctx.Repo.Repository.FullLink() + "/commit/" + ctx.Repo.CommitID,
Author: &api.PayloadAuthor{
Name: ctx.Repo.Commit.Author.Name,
Email: ctx.Repo.Commit.Author.Email,
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index dfb7673d33..1293fa4310 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -10,7 +10,7 @@
<div class="divider"> / </div>
<a href="{{$.RepoLink}}">{{.Name}}</a>
{{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" href="{{$.Mirror.Address}}">{{$.Mirror.Address}}</a></div>{{end}}
- {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.RepoLink}}">{{SubStr .BaseRepo.RepoRelLink 1 -1}}</a></div>{{end}}
+ {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{SubStr .BaseRepo.RepoRelLink 1 -1}}</a></div>{{end}}
</div>
<div class="ui right">
@@ -18,7 +18,7 @@
<a class="ui button" href="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
<i class="icon fa-eye{{if not $.IsWatchingRepo}}-slash{{end}}"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}}
</a>
- <a class="ui basic label" href="{{.RepoLink}}/watchers">
+ <a class="ui basic label" href="{{.Link}}/watchers">
{{.NumWatches}}
</a>
</div>
@@ -26,7 +26,7 @@
<a class="ui button" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
<i class="icon fa-star{{if not $.IsStaringRepo}}-o{{end}}"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}}
</a>
- <a class="ui basic label" href="{{.RepoLink}}/stars">
+ <a class="ui basic label" href="{{.Link}}/stars">
{{.NumStars}}
</a>
</div>
@@ -35,7 +35,7 @@
<a class="ui button {{if eq .OwnerID $.SignedUserID}}poping up{{end}}" {{if not (eq .OwnerID $.SignedUserID)}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
<i class="icon octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
</a>
- <a class="ui basic label" href="{{.RepoLink}}/forks">
+ <a class="ui basic label" href="{{.Link}}/forks">
{{.NumForks}}
</a>
</div>