aboutsummaryrefslogtreecommitdiffstats
path: root/modules/context/repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-02-04 23:53:46 +0800
committerGitHub <noreply@github.com>2017-02-04 23:53:46 +0800
commit8a421b1fd702d99e8438f6ef6f4ee339f1eaa130 (patch)
treec69e598ca9dca29dc64a4e1d8525165ec794106f /modules/context/repo.go
parent49fa03bf4286bd2cbf90b271fb65d4f70e5de57f (diff)
downloadgitea-8a421b1fd702d99e8438f6ef6f4ee339f1eaa130.tar.gz
gitea-8a421b1fd702d99e8438f6ef6f4ee339f1eaa130.zip
Add units concept for modulable functions of a repository (#742)
* Add units concept for modulable functions of a repository * remove unused comment codes & fix lints and tests * remove unused comment codes * use struct config instead of map * fix lint * rm wrong files * fix tests
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r--modules/context/repo.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index aca1e1b63c..8de5b9821b 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -477,3 +477,18 @@ func GitHookService() macaron.Handler {
}
}
}
+
+// UnitTypes returns a macaron middleware to set unit types to context variables.
+func UnitTypes() macaron.Handler {
+ return func(ctx *Context) {
+ ctx.Data["UnitTypeCode"] = models.UnitTypeCode
+ ctx.Data["UnitTypeIssues"] = models.UnitTypeIssues
+ ctx.Data["UnitTypePullRequests"] = models.UnitTypePullRequests
+ ctx.Data["UnitTypeCommits"] = models.UnitTypeCommits
+ ctx.Data["UnitTypeReleases"] = models.UnitTypeReleases
+ ctx.Data["UnitTypeWiki"] = models.UnitTypeWiki
+ ctx.Data["UnitTypeSettings"] = models.UnitTypeSettings
+ ctx.Data["UnitTypeExternalWiki"] = models.UnitTypeExternalWiki
+ ctx.Data["UnitTypeExternalTracker"] = models.UnitTypeExternalTracker
+ }
+}