From 24514ba1c4f31070010f34213e75b83b0012b8b6 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 3 Sep 2017 19:49:51 +0200 Subject: [PATCH] Started implementation of setting Signed-off-by: Konrad --- models/unit.go | 2 ++ modules/auth/repo_form.go | 1 + routers/repo/setting.go | 10 ++++++++++ templates/repo/settings/options.tmpl | 6 ++++++ 4 files changed, 19 insertions(+) diff --git a/models/unit.go b/models/unit.go index a14edcec0..db15100c5 100644 --- a/models/unit.go +++ b/models/unit.go @@ -16,6 +16,7 @@ const ( UnitTypeWiki // 5 Wiki UnitTypeExternalWiki // 6 ExternalWiki UnitTypeExternalTracker // 7 ExternalTracker + UnitTypeIssueDependencies // 8 Issue Dependencies ) var ( @@ -28,6 +29,7 @@ var ( UnitTypeWiki, UnitTypeExternalWiki, UnitTypeExternalTracker, + UnitTypeIssueDependencies, } // defaultRepoUnits contains the default unit types diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 58dcf468e..32f5f773d 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -104,6 +104,7 @@ type RepoSettingForm struct { TrackerURLFormat string TrackerIssueStyle string EnablePulls bool + EnableIssueDependencies bool } // Validate validates the fields diff --git a/routers/repo/setting.go b/routers/repo/setting.go index a50c6a6e2..0b7fdb5b9 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -16,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" + "fmt" ) const ( @@ -215,6 +216,15 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { }) } + if form.EnableIssueDependencies{ + units = append(units, models.RepoUnit{ + RepoID: repo.ID, + Type: models.UnitTypeIssueDependencies, + Index: int(models.UnitTypeIssueDependencies), + Config: new(models.UnitConfig), + }) + } + if err := models.UpdateRepositoryUnits(repo, units); err != nil { ctx.Handle(500, "UpdateRepositoryUnits", err) return diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 8a7ea218b..d230bb30f 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -138,6 +138,12 @@ +
+
+ + +
+