From 65b3f513c3d9d9488475f03408f0ba628363a599 Mon Sep 17 00:00:00 2001 From: Lunny Xiao <xiaolunwen@gmail.com> Date: Thu, 25 Apr 2019 17:00:34 +0800 Subject: [PATCH] fix new team 500 (#6749) * fix new team 500 * Update models/unit.go Co-Authored-By: lunny <xiaolunwen@gmail.com> --- models/unit.go | 5 +++++ templates/org/team/new.tmpl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/models/unit.go b/models/unit.go index a8ddf285da..697df696bc 100644 --- a/models/unit.go +++ b/models/unit.go @@ -25,6 +25,11 @@ const ( UnitTypeExternalTracker // 7 ExternalTracker ) +// Value returns integer value for unit type +func (u UnitType) Value() int { + return int(u) +} + func (u UnitType) String() string { switch u { case UnitTypeCode: diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl index 12cdd697c3..fb79c9b7fb 100644 --- a/templates/org/team/new.tmpl +++ b/templates/org/team/new.tmpl @@ -57,7 +57,7 @@ {{range $t, $unit := $.Units}} <div class="field"> <div class="ui toggle checkbox"> - <input type="checkbox" class="hidden" name="units" value="{{$unit.Type}}"{{if or (eq $.Team.ID 0) ($.Team.UnitEnabled $unit.Type)}} checked{{end}}> + <input type="checkbox" class="hidden" name="units" value="{{$unit.Type.Value}}"{{if or (eq $.Team.ID 0) ($.Team.UnitEnabled $unit.Type)}} checked{{end}}> <label>{{$.i18n.Tr $unit.NameKey}}</label> <span class="help">{{$.i18n.Tr $unit.DescKey}}</span> </div>