File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,15 @@ func SettingsPost(ctx *context.Context) {
397397 repoChanged = true
398398 }
399399
400+ if form .EnableCode && ! unit_model .TypeCode .UnitGlobalDisabled () {
401+ units = append (units , repo_model.RepoUnit {
402+ RepoID : repo .ID ,
403+ Type : unit_model .TypeCode ,
404+ })
405+ } else if ! unit_model .TypeCode .UnitGlobalDisabled () {
406+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeCode )
407+ }
408+
400409 if form .EnableWiki && form .EnableExternalWiki && ! unit_model .TypeExternalWiki .UnitGlobalDisabled () {
401410 if ! validation .IsValidExternalURL (form .ExternalWikiURL ) {
402411 ctx .Flash .Error (ctx .Tr ("repo.settings.external_wiki_url_error" ))
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ type RepoSettingForm struct {
134134 EnablePrune bool
135135
136136 // Advanced settings
137+ EnableCode bool
137138 EnableWiki bool
138139 EnableExternalWiki bool
139140 ExternalWikiURL string
Original file line number Diff line number Diff line change 249249 {{.CsrfTokenHtml}}
250250 <input type="hidden" name="action" value="advanced">
251251
252+ {{$isCodeEnabled := .Repository.UnitEnabled $.Context $.UnitTypeCode}}
253+ <div class="inline field">
254+ <label>{{.locale.Tr "repo.code"}}</label>
255+ {{if .UnitTypeCode.UnitGlobalDisabled}}
256+ <div class="ui checkbox tooltip disabled" data-content="{{.locale.Tr "repo.unit_disabled"}}">
257+ {{else}}
258+ <div class="ui checkbox">
259+ {{end}}
260+ <input class="enable-system" name="enable_code" type="checkbox"{{if $isCodeEnabled}} checked{{end}}>
261+ <label>{{.locale.Tr "repo.code.desc"}}</label>
262+ </div>
263+ </div>
264+
252265 {{$isWikiEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeWiki) (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}
253266 <div class="inline field">
254267 <label>{{.locale.Tr "repo.wiki"}}</label>
You can’t perform that action at this time.
0 commit comments