File tree 3 files changed +23
-0
lines changed
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) {
397
397
repoChanged = true
398
398
}
399
399
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
+
400
409
if form .EnableWiki && form .EnableExternalWiki && ! unit_model .TypeExternalWiki .UnitGlobalDisabled () {
401
410
if ! validation .IsValidExternalURL (form .ExternalWikiURL ) {
402
411
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 {
134
134
EnablePrune bool
135
135
136
136
// Advanced settings
137
+ EnableCode bool
137
138
EnableWiki bool
138
139
EnableExternalWiki bool
139
140
ExternalWikiURL string
Original file line number Diff line number Diff line change 249
249
{{.CsrfTokenHtml}}
250
250
<input type="hidden" name="action" value="advanced">
251
251
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
+
252
265
{{$isWikiEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeWiki) (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}
253
266
<div class="inline field">
254
267
<label>{{.locale.Tr "repo.wiki"}}</label>
You can’t perform that action at this time.
0 commit comments