code.gitea.io/gitea@v1.22.3/templates/repo/settings/options.tmpl (about)

     1  {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}}
     2  	<div class="user-main-content twelve wide column">
     3  		<h4 class="ui top attached header">
     4  			{{ctx.Locale.Tr "repo.settings.basic_settings"}}
     5  		</h4>
     6  		<div class="ui attached segment">
     7  			<form class="ui form" action="{{.Link}}" method="post">
     8  				{{template "base/disable_form_autofill"}}
     9  				{{.CsrfTokenHtml}}
    10  				<input type="hidden" name="action" value="update">
    11  				<div class="required field {{if .Err_RepoName}}error{{end}}">
    12  					<label>{{ctx.Locale.Tr "repo.repo_name"}}</label>
    13  					<input name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required>
    14  				</div>
    15  				<div class="inline field">
    16  					<label>{{ctx.Locale.Tr "repo.repo_size"}}</label>
    17  					<span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>{{FileSize .Repository.Size}}</span>
    18  				</div>
    19  				<div class="inline field">
    20  					<label>{{ctx.Locale.Tr "repo.template"}}</label>
    21  					<div class="ui checkbox">
    22  						<input name="template" type="checkbox" {{if .Repository.IsTemplate}}checked{{end}}>
    23  						<label>{{ctx.Locale.Tr "repo.template_helper"}}</label>
    24  					</div>
    25  				</div>
    26  				{{if not .Repository.IsFork}}
    27  					<div class="inline field">
    28  						<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
    29  						<div class="ui checkbox" {{if and (not .Repository.IsPrivate) (gt .Repository.NumStars 0)}}data-tooltip-content="{{ctx.Locale.Tr "repo.stars_remove_warning"}}"{{end}}>
    30  							{{if .IsAdmin}}
    31  								<input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}>
    32  							{{else}}
    33  								<input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}{{if and $.ForcePrivate .Repository.IsPrivate}} disabled{{end}}>
    34  								{{if and .Repository.IsPrivate $.ForcePrivate}}<input type="hidden" name="private" value="{{.Repository.IsPrivate}}">{{end}}
    35  							{{end}}
    36  							<label>{{ctx.Locale.Tr "repo.visibility_helper"}} {{if .Repository.NumForks}}<span class="text red">{{ctx.Locale.Tr "repo.visibility_fork_helper"}}</span>{{end}}</label>
    37  						</div>
    38  					</div>
    39  				{{end}}
    40  				<div class="field {{if .Err_Description}}error{{end}}">
    41  					<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
    42  					<textarea id="description" name="description" rows="2" maxlength="2048">{{.Repository.Description}}</textarea>
    43  				</div>
    44  				<div class="field {{if .Err_Website}}error{{end}}">
    45  					<label for="website">{{ctx.Locale.Tr "repo.settings.site"}}</label>
    46  					<input id="website" name="website" type="url" maxlength="1024" value="{{.Repository.Website}}">
    47  				</div>
    48  				<div class="field">
    49  					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
    50  				</div>
    51  			</form>
    52  
    53  			<div class="divider"></div>
    54  			<form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data">
    55  				{{.CsrfTokenHtml}}
    56  				<div class="inline field">
    57  					<label for="avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label>
    58  					<input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp">
    59  				</div>
    60  				<div class="field">
    61  					<button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button>
    62  					<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button>
    63  				</div>
    64  			</form>
    65  		</div>
    66  
    67  		{{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}}
    68  		{{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}}
    69  		{{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}}
    70  		{{$showMirrorSettings := and (.Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeCode) (or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors)}}
    71  		{{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}}
    72  		{{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}}
    73  		{{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}}
    74  		{{$existingPushMirror := or .Repository.IsMirror .PushMirrors}}
    75  		{{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}}
    76  		{{$isWorkingPullMirror := .PullMirror}}
    77  
    78  		{{if $showMirrorSettings}}
    79  			<h4 class="ui top attached header">
    80  				{{ctx.Locale.Tr "repo.settings.mirror_settings"}}
    81  			</h4>
    82  			<div class="ui attached segment">
    83  				{{if .Repository.IsArchived}}
    84  					<div class="ui warning message tw-text-center">
    85  						{{ctx.Locale.Tr "repo.settings.archive.mirrors_unavailable"}}
    86  					</div>
    87  				{{else}}
    88  					{{if $newMirrorsEntirelyEnabled}}
    89  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs"}}
    90  						<a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/usage/repo-mirror#pushing-to-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br>
    91  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}}
    92  						<a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_pull_section"}}</a><br>
    93  					{{else if $onlyNewPushMirrorsEnabled}}
    94  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}}
    95  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}}
    96  						<a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br>
    97  					{{else if $onlyNewPullMirrorsEnabled}}
    98  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}}
    99  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}}
   100  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}}
   101  						<a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br>
   102  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}}
   103  						{{if $existingPushMirror}}
   104  							{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}
   105  						{{end}}
   106  					{{else}}
   107  						{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}<br>
   108  					{{end}}
   109  
   110  					{{if .Repository.IsMirror}}
   111  					<table class="ui table">
   112  						<thead>
   113  							<tr>
   114  								<th class="tw-w-2/5">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</th>
   115  								<th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th>
   116  								<th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th>
   117  								<th></th>
   118  							</tr>
   119  						</thead>
   120  						{{if $modifyBrokenPullMirror}}
   121  							{{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}}
   122  							<tbody>
   123  								<tr>
   124  									<td colspan="4">
   125  										<div class="text red tw-py-4">{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}</div>
   126  									</td>
   127  								</tr>
   128  							</tbody>
   129  						{{else if $isWorkingPullMirror}}
   130  						<tbody>
   131  							<tr>
   132  								<td>{{.PullMirror.RemoteAddress}}</td>
   133  								<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td>
   134  								<td>{{DateTime "full" .PullMirror.UpdatedUnix}}</td>
   135  								<td class="right aligned">
   136  									<form method="post" class="tw-inline-block">
   137  										{{.CsrfTokenHtml}}
   138  										<input type="hidden" name="action" value="mirror-sync">
   139  										<button class="ui primary tiny button inline">{{ctx.Locale.Tr "repo.settings.sync_mirror"}}</button>
   140  									</form>
   141  								</td>
   142  							</tr>
   143  							<tr>
   144  								<td colspan="4">
   145  									<form class="ui form" method="post">
   146  										{{template "base/disable_form_autofill"}}
   147  										{{.CsrfTokenHtml}}
   148  										<input type="hidden" name="action" value="mirror">
   149  										<div class="inline field {{if .Err_EnablePrune}}error{{end}}">
   150  											<label>{{ctx.Locale.Tr "repo.mirror_prune"}}</label>
   151  											<div class="ui checkbox">
   152  										<input id="enable_prune" name="enable_prune" type="checkbox" {{if .PullMirror.EnablePrune}}checked{{end}}>
   153  										<label>{{ctx.Locale.Tr "repo.mirror_prune_desc"}}</label>
   154  											</div>
   155  										</div>
   156  										<div class="inline field {{if .Err_Interval}}error{{end}}">
   157  											<label for="interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
   158  											<input id="interval" name="interval" value="{{.PullMirror.Interval}}">
   159  										</div>
   160  										{{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName}}
   161  										<div class="field {{if .Err_MirrorAddress}}error{{end}}">
   162  											<label for="mirror_address">{{ctx.Locale.Tr "repo.mirror_address"}}</label>
   163  											<input id="mirror_address" name="mirror_address" value="{{$address.Address}}" required>
   164  											<p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p>
   165  										</div>
   166  										<details class="ui optional field" {{if or .Err_Auth $address.Username}}open{{end}}>
   167  											<summary class="tw-p-1">
   168  												{{ctx.Locale.Tr "repo.need_auth"}}
   169  											</summary>
   170  											<div class="tw-p-1">
   171  												<div class="inline field {{if .Err_Auth}}error{{end}}">
   172  													<label for="mirror_username">{{ctx.Locale.Tr "username"}}</label>
   173  													<input id="mirror_username" name="mirror_username" value="{{$address.Username}}" {{if not .mirror_username}}data-need-clear="true"{{end}}>
   174  												</div>
   175  												<div class="inline field {{if .Err_Auth}}error{{end}}">
   176  													<label for="mirror_password">{{ctx.Locale.Tr "password"}}</label>
   177  													<input id="mirror_password" name="mirror_password" type="password" placeholder="{{if $address.Password}}{{ctx.Locale.Tr "repo.mirror_password_placeholder"}}{{else}}{{ctx.Locale.Tr "repo.mirror_password_blank_placeholder"}}{{end}}" value="" {{if not .mirror_password}}data-need-clear="true"{{end}} autocomplete="off">
   178  												</div>
   179  												<p class="help">{{ctx.Locale.Tr "repo.mirror_password_help"}}</p>
   180  											</div>
   181  										</details>
   182  
   183  										{{if .LFSStartServer}}
   184  										<div class="inline field">
   185  											<label>{{ctx.Locale.Tr "repo.mirror_lfs"}}</label>
   186  											<div class="ui checkbox">
   187  												<input id="mirror_lfs" name="mirror_lfs" type="checkbox" {{if .PullMirror.LFS}}checked{{end}}>
   188  												<label>{{ctx.Locale.Tr "repo.mirror_lfs_desc"}}</label>
   189  											</div>
   190  										</div>
   191  										<div class="field {{if .Err_LFSEndpoint}}error{{end}}">
   192  											<label for="mirror_lfs_endpoint">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint"}}</label>
   193  											<input id="mirror_lfs_endpoint" name="mirror_lfs_endpoint" value="{{.PullMirror.LFSEndpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}">
   194  											<p class="help">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery"}}</p>
   195  										</div>
   196  										{{end}}
   197  										<div class="field">
   198  											<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_mirror_settings"}}</button>
   199  										</div>
   200  									</form>
   201  								</td>
   202  							</tr>
   203  						</tbody>
   204  						{{end}}{{/* end if: $modifyBrokenPullMirror / $isWorkingPullMirror */}}
   205  					</table>
   206  					{{end}}{{/* end if .Repository.IsMirror */}}
   207  
   208  					<table class="ui table">
   209  						<thead>
   210  							<tr>
   211  								<th class="tw-w-2/5">{{ctx.Locale.Tr "repo.settings.mirror_settings.pushed_repository"}}</th>
   212  								<th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th>
   213  								<th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th>
   214  								<th></th>
   215  							</tr>
   216  						</thead>
   217  						<tbody>
   218  							{{range .PushMirrors}}
   219  							<tr>
   220  								<td class="gt-word-break">{{.RemoteAddress}}</td>
   221  								<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td>
   222  								<td>{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td>
   223  								<td class="right aligned">
   224  									<button
   225  										class="ui tiny button show-modal"
   226  										data-modal="#push-mirror-edit-modal"
   227  										data-tooltip-content="{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}}"
   228  										data-modal-push-mirror-edit-id="{{.ID}}"
   229  										data-modal-push-mirror-edit-interval="{{.Interval}}"
   230  										data-modal-push-mirror-edit-address="{{.RemoteAddress}}"
   231  									>
   232  										{{svg "octicon-pencil" 14}}
   233  									</button>
   234  									<form method="post" class="tw-inline-block">
   235  										{{$.CsrfTokenHtml}}
   236  										<input type="hidden" name="action" value="push-mirror-sync">
   237  										<input type="hidden" name="push_mirror_id" value="{{.ID}}">
   238  										<button class="ui primary tiny button" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.sync_mirror"}}">{{svg "octicon-sync" 14}}</button>
   239  									</form>
   240  									<form method="post" class="tw-inline-block">
   241  										{{$.CsrfTokenHtml}}
   242  										<input type="hidden" name="action" value="push-mirror-remove">
   243  										<input type="hidden" name="push_mirror_id" value="{{.ID}}">
   244  										<button class="ui basic red tiny button" data-tooltip-content="{{ctx.Locale.Tr "remove"}}">{{svg "octicon-trash" 14}}</button>
   245  									</form>
   246  								</td>
   247  							</tr>
   248  							{{else}}
   249  							<tr>
   250  								<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}</td>
   251  							</tr>
   252  							{{end}}
   253  							{{if (not .DisableNewPushMirrors)}}
   254  								<tr>
   255  									<td colspan="4">
   256  										<form class="ui form" method="post">
   257  											{{template "base/disable_form_autofill"}}
   258  											{{.CsrfTokenHtml}}
   259  											<input type="hidden" name="action" value="push-mirror-add">
   260  											<div class="field {{if .Err_PushMirrorAddress}}error{{end}}">
   261  												<label for="push_mirror_address">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.remote_url"}}</label>
   262  												<input id="push_mirror_address" name="push_mirror_address" value="{{.push_mirror_address}}" required>
   263  												<p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p>
   264  											</div>
   265  											<details class="ui optional field" {{if or .Err_PushMirrorAuth .push_mirror_username}}open{{end}}>
   266  												<summary class="tw-p-1">
   267  													{{ctx.Locale.Tr "repo.need_auth"}}
   268  												</summary>
   269  												<div class="tw-p-1">
   270  													<div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}">
   271  														<label for="push_mirror_username">{{ctx.Locale.Tr "username"}}</label>
   272  														<input id="push_mirror_username" name="push_mirror_username" value="{{.push_mirror_username}}">
   273  													</div>
   274  													<div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}">
   275  														<label for="push_mirror_password">{{ctx.Locale.Tr "password"}}</label>
   276  														<input id="push_mirror_password" name="push_mirror_password" type="password" value="{{.push_mirror_password}}" autocomplete="off">
   277  													</div>
   278  												</div>
   279  											</details>
   280  											<div class="field">
   281  												<div class="ui checkbox">
   282  													<input id="push_mirror_sync_on_commit" name="push_mirror_sync_on_commit" type="checkbox" {{if .push_mirror_sync_on_commit}}checked{{end}}>
   283  													<label for="push_mirror_sync_on_commit">{{ctx.Locale.Tr "repo.mirror_sync_on_commit"}}</label>
   284  												</div>
   285  											</div>
   286  											<div class="inline field {{if .Err_PushMirrorInterval}}error{{end}}">
   287  												<label for="push_mirror_interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
   288  												<input id="push_mirror_interval" name="push_mirror_interval" value="{{if .push_mirror_interval}}{{.push_mirror_interval}}{{else}}{{.DefaultMirrorInterval}}{{end}}">
   289  											</div>
   290  											<div class="field">
   291  												<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.add"}}</button>
   292  											</div>
   293  										</form>
   294  									</td>
   295  								</tr>
   296  							{{end}}
   297  						</tbody>
   298  					</table>
   299  				{{end}}
   300  			</div>
   301  		{{end}}
   302  
   303  		<h4 class="ui top attached header">
   304  			{{ctx.Locale.Tr "repo.settings.advanced_settings"}}
   305  		</h4>
   306  		<div class="ui attached segment">
   307  			<form class="ui form" method="post">
   308  				{{.CsrfTokenHtml}}
   309  				<input type="hidden" name="action" value="advanced">
   310  
   311  				{{$isCodeEnabled := .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeCode}}
   312  				{{$isCodeGlobalDisabled := ctx.Consts.RepoUnitTypeCode.UnitGlobalDisabled}}
   313  				<div class="inline field">
   314  					<label>{{ctx.Locale.Tr "repo.code"}}</label>
   315  					<div class="ui checkbox{{if $isCodeGlobalDisabled}} disabled{{end}}"{{if $isCodeGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   316  						<input class="enable-system" name="enable_code" type="checkbox"{{if $isCodeEnabled}} checked{{end}}>
   317  						<label>{{ctx.Locale.Tr "repo.code.desc"}}</label>
   318  					</div>
   319  				</div>
   320  
   321  				{{$isInternalWikiEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeWiki}}
   322  				{{$isExternalWikiEnabled := .Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypeExternalWiki}}
   323  				{{$isWikiEnabled := or $isInternalWikiEnabled $isExternalWikiEnabled}}
   324  				{{$isWikiGlobalDisabled := ctx.Consts.RepoUnitTypeWiki.UnitGlobalDisabled}}
   325  				{{$isExternalWikiGlobalDisabled := ctx.Consts.RepoUnitTypeExternalWiki.UnitGlobalDisabled}}
   326  				{{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}}
   327  				<div class="inline field">
   328  					<label>{{ctx.Locale.Tr "repo.wiki"}}</label>
   329  					<div class="ui checkbox{{if $isBothWikiGlobalDisabled}} disabled{{end}}"{{if $isBothWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   330  						<input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if $isWikiEnabled}}checked{{end}}>
   331  						<label>{{ctx.Locale.Tr "repo.settings.wiki_desc"}}</label>
   332  					</div>
   333  				</div>
   334  				<div class="field{{if not $isWikiEnabled}} disabled{{end}}" id="wiki_box">
   335  					<div class="field">
   336  						<div class="ui radio checkbox{{if $isWikiGlobalDisabled}} disabled{{end}}"{{if $isWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   337  							<input class="enable-system-radio" name="enable_external_wiki" type="radio" value="false" data-context="#internal_wiki_box" data-target="#external_wiki_box" {{if $isInternalWikiEnabled}}checked{{end}}>
   338  							<label>{{ctx.Locale.Tr "repo.settings.use_internal_wiki"}}</label>
   339  						</div>
   340  					</div>
   341  					<div id="internal_wiki_box" class="field tw-pl-4 {{if not $isInternalWikiEnabled}}disabled{{end}}">
   342  						<div class="inline field">
   343  							<label>{{ctx.Locale.Tr "repo.settings.default_wiki_branch_name"}}</label>
   344  							<input name="default_wiki_branch" value="{{.Repository.DefaultWikiBranch}}">
   345  						</div>
   346  						<div class="inline field">
   347  							{{$unitInternalWiki := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeWiki}}
   348  							<label>{{ctx.Locale.Tr "repo.settings.default_wiki_everyone_access"}}</label>
   349  							<select name="default_wiki_everyone_access" class="ui selection dropdown">
   350  								{{/* everyone access mode is different from others, none means it is unset and won't be applied */}}
   351  								<option value="none" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 0) "selected"}}>{{ctx.Locale.Tr "settings.permission_not_set"}}</option>
   352  								<option value="read" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 1) "selected"}}>{{ctx.Locale.Tr "settings.permission_read"}}</option>
   353  								<option value="write" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 2) "selected"}}>{{ctx.Locale.Tr "settings.permission_write"}}</option>
   354  							</select>
   355  						</div>
   356  					</div>
   357  					<div class="field">
   358  						<div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   359  							<input class="enable-system-radio" name="enable_external_wiki" type="radio" value="true" data-context="#internal_wiki_box" data-target="#external_wiki_box" {{if $isExternalWikiEnabled}}checked{{end}}>
   360  							<label>{{ctx.Locale.Tr "repo.settings.use_external_wiki"}}</label>
   361  						</div>
   362  					</div>
   363  					<div id="external_wiki_box" class="field tw-pl-4 {{if not $isExternalWikiEnabled}}disabled{{end}}">
   364  						<label for="external_wiki_url">{{ctx.Locale.Tr "repo.settings.external_wiki_url"}}</label>
   365  						<input id="external_wiki_url" name="external_wiki_url" type="url" value="{{(.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}">
   366  						<p class="help">{{ctx.Locale.Tr "repo.settings.external_wiki_url_desc"}}</p>
   367  					</div>
   368  				</div>
   369  
   370  				<div class="divider"></div>
   371  
   372  				{{$isIssuesEnabled := or (.Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeIssues) (.Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeExternalTracker)}}
   373  				{{$isIssuesGlobalDisabled := ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}}
   374  				{{$isExternalTrackerGlobalDisabled := ctx.Consts.RepoUnitTypeExternalTracker.UnitGlobalDisabled}}
   375  				{{$isIssuesAndExternalGlobalDisabled := and $isIssuesGlobalDisabled $isExternalTrackerGlobalDisabled}}
   376  				<div class="inline field">
   377  					<label>{{ctx.Locale.Tr "repo.issues"}}</label>
   378  					<div class="ui checkbox{{if $isIssuesAndExternalGlobalDisabled}} disabled{{end}}"{{if $isIssuesAndExternalGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   379  						<input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if $isIssuesEnabled}}checked{{end}}>
   380  						<label>{{ctx.Locale.Tr "repo.settings.issues_desc"}}</label>
   381  					</div>
   382  				</div>
   383  				<div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box">
   384  					<div class="field">
   385  						<div class="ui radio checkbox{{if $isIssuesGlobalDisabled}} disabled{{end}}"{{if $isIssuesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   386  							<input class="enable-system-radio" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeExternalTracker)}}checked{{end}}>
   387  							<label>{{ctx.Locale.Tr "repo.settings.use_internal_issue_tracker"}}</label>
   388  						</div>
   389  					</div>
   390  					<div class="field tw-pl-4 {{if (.Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeExternalTracker)}}disabled{{end}}" id="internal_issue_box">
   391  						{{if .Repository.CanEnableTimetracker}}
   392  							<div class="field">
   393  								<div class="ui checkbox">
   394  									<input name="enable_timetracker" class="enable-system" data-target="#only_contributors" type="checkbox" {{if .Repository.IsTimetrackerEnabled $.Context}}checked{{end}}>
   395  									<label>{{ctx.Locale.Tr "repo.settings.enable_timetracker"}}</label>
   396  								</div>
   397  							</div>
   398  							<div class="field {{if not (.Repository.IsTimetrackerEnabled $.Context)}}disabled{{end}}" id="only_contributors">
   399  								<div class="ui checkbox">
   400  									<input name="allow_only_contributors_to_track_time" type="checkbox" {{if .Repository.AllowOnlyContributorsToTrackTime $.Context}}checked{{end}}>
   401  									<label>{{ctx.Locale.Tr "repo.settings.allow_only_contributors_to_track_time"}}</label>
   402  								</div>
   403  							</div>
   404  						{{end}}
   405  						<div class="field">
   406  							<div class="ui checkbox">
   407  								<input name="enable_issue_dependencies" type="checkbox" {{if (.Repository.IsDependenciesEnabled $.Context)}}checked{{end}}>
   408  								<label>{{ctx.Locale.Tr "repo.issues.dependency.setting"}}</label>
   409  							</div>
   410  						</div>
   411  						<div class="ui checkbox">
   412  							<input name="enable_close_issues_via_commit_in_any_branch" type="checkbox" {{if .Repository.CloseIssuesViaCommitInAnyBranch}}checked{{end}}>
   413  							<label>{{ctx.Locale.Tr "repo.settings.admin_enable_close_issues_via_commit_in_any_branch"}}</label>
   414  						</div>
   415  					</div>
   416  					<div class="field">
   417  						<div class="ui radio checkbox{{if $isExternalTrackerGlobalDisabled}} disabled{{end}}"{{if $isExternalTrackerGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   418  							<input class="enable-system-radio" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeExternalTracker}}checked{{end}}>
   419  							<label>{{ctx.Locale.Tr "repo.settings.use_external_issue_tracker"}}</label>
   420  						</div>
   421  					</div>
   422  					<div class="field tw-pl-4 {{if not (.Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeExternalTracker)}}disabled{{end}}" id="external_issue_box">
   423  						<div class="field">
   424  							<label for="external_tracker_url">{{ctx.Locale.Tr "repo.settings.external_tracker_url"}}</label>
   425  							<input id="external_tracker_url" name="external_tracker_url" type="url" value="{{(.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerURL}}">
   426  							<p class="help">{{ctx.Locale.Tr "repo.settings.external_tracker_url_desc"}}</p>
   427  						</div>
   428  						<div class="field">
   429  							<label for="tracker_url_format">{{ctx.Locale.Tr "repo.settings.tracker_url_format"}}</label>
   430  							<input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="https://github.com/{user}/{repo}/issues/{index}">
   431  							<p class="help">{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc"}}</p>
   432  						</div>
   433  						<div class="inline fields">
   434  							<label for="issue_style">{{ctx.Locale.Tr "repo.settings.tracker_issue_style"}}</label>
   435  							<div class="field">
   436  								<div class="ui radio checkbox">
   437  								{{$externalTracker := (.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalTracker)}}
   438  								{{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}}
   439  									<input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="numeric" {{if eq $externalTrackerStyle "numeric"}}checked{{end}}>
   440  									<label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.numeric"}} <span class="ui light grey text">#1234</span></label>
   441  								</div>
   442  							</div>
   443  							<div class="field">
   444  								<div class="ui radio checkbox">
   445  									<input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="alphanumeric" {{if eq $externalTrackerStyle "alphanumeric"}}checked{{end}}>
   446  									<label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.alphanumeric"}} <span class="ui light grey text">ABC-123 , DEFG-234</span></label>
   447  								</div>
   448  							</div>
   449  							<div class="field">
   450  								<div class="ui radio checkbox">
   451  									<input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="regexp" {{if eq $externalTrackerStyle "regexp"}}checked{{end}}>
   452  									<label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp"}} <span class="ui light grey text">(ISSUE-\d+) , ISSUE-(\d+)</span></label>
   453  								</div>
   454  							</div>
   455  						</div>
   456  						<div class="field {{if ne $externalTrackerStyle "regexp"}}disabled{{end}}" id="tracker-issue-style-regex-box">
   457  							<label for="external_tracker_regexp_pattern">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern"}}</label>
   458  							<input id="external_tracker_regexp_pattern" name="external_tracker_regexp_pattern" value="{{(.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerRegexpPattern}}">
   459  							<p class="help">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc"}}</p>
   460  						</div>
   461  					</div>
   462  				</div>
   463  
   464  				<div class="divider"></div>
   465  
   466  				{{$isProjectsEnabled := .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeProjects}}
   467  				{{$isProjectsGlobalDisabled := ctx.Consts.RepoUnitTypeProjects.UnitGlobalDisabled}}
   468  				{{$projectsUnit := .Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeProjects}}
   469  				<div class="inline field">
   470  					<label>{{ctx.Locale.Tr "repo.project_board"}}</label>
   471  					<div class="ui checkbox{{if $isProjectsGlobalDisabled}} disabled{{end}}"{{if $isProjectsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   472  						<input class="enable-system" name="enable_projects" type="checkbox" data-target="#projects_box" {{if $isProjectsEnabled}}checked{{end}}>
   473  						<label>{{ctx.Locale.Tr "repo.settings.projects_desc"}}</label>
   474  					</div>
   475  				</div>
   476  				<div class="field {{if not $isProjectsEnabled}} disabled{{end}} tw-pl-4" id="projects_box">
   477  					<p>
   478  						{{ctx.Locale.Tr "repo.settings.projects_mode_desc"}}
   479  					</p>
   480  					<div class="ui dropdown selection">
   481  						<select name="projects_mode">
   482  							<option value="repo" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "repo")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}</option>
   483  							<option value="owner" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "owner")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}</option>
   484  							<option value="all" {{if or (not $isProjectsEnabled) (eq $projectsUnit.ProjectsConfig.GetProjectsMode "all")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}</option>
   485  						</select>
   486  						{{svg "octicon-triangle-down" 14 "dropdown icon"}}
   487  						<div class="default text">
   488  							{{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "repo")}}
   489  								{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}
   490  							{{end}}
   491  							{{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "owner")}}
   492  								{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}
   493  							{{end}}
   494  							{{if (eq $projectsUnit.ProjectsConfig.GetProjectsMode "all")}}
   495  								{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}
   496  							{{end}}
   497  						</div>
   498  						<div class="menu">
   499  							<div class="item" data-value="repo">{{ctx.Locale.Tr "repo.settings.projects_mode_repo"}}</div>
   500  							<div class="item" data-value="owner">{{ctx.Locale.Tr "repo.settings.projects_mode_owner"}}</div>
   501  							<div class="item" data-value="all">{{ctx.Locale.Tr "repo.settings.projects_mode_all"}}</div>
   502  						</div>
   503  					</div>
   504  				</div>
   505  
   506  				<div class="divider"></div>
   507  
   508  				{{$isReleasesEnabled := .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeReleases}}
   509  				{{$isReleasesGlobalDisabled := ctx.Consts.RepoUnitTypeReleases.UnitGlobalDisabled}}
   510  				<div class="inline field">
   511  					<label>{{ctx.Locale.Tr "repo.releases"}}</label>
   512  					<div class="ui checkbox{{if $isReleasesGlobalDisabled}} disabled{{end}}"{{if $isReleasesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   513  						<input class="enable-system" name="enable_releases" type="checkbox" {{if $isReleasesEnabled}}checked{{end}}>
   514  						<label>{{ctx.Locale.Tr "repo.settings.releases_desc"}}</label>
   515  					</div>
   516  				</div>
   517  
   518  				{{$isPackagesEnabled := .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypePackages}}
   519  				{{$isPackagesGlobalDisabled := ctx.Consts.RepoUnitTypePackages.UnitGlobalDisabled}}
   520  				<div class="inline field">
   521  					<label>{{ctx.Locale.Tr "repo.packages"}}</label>
   522  					<div class="ui checkbox{{if $isPackagesGlobalDisabled}} disabled{{end}}"{{if $isPackagesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   523  						<input class="enable-system" name="enable_packages" type="checkbox" {{if $isPackagesEnabled}}checked{{end}}>
   524  						<label>{{ctx.Locale.Tr "repo.settings.packages_desc"}}</label>
   525  					</div>
   526  				</div>
   527  
   528  				{{if .EnableActions}}
   529  					{{$isActionsEnabled := .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeActions}}
   530  					{{$isActionsGlobalDisabled := ctx.Consts.RepoUnitTypeActions.UnitGlobalDisabled}}
   531  					<div class="inline field">
   532  						<label>{{ctx.Locale.Tr "actions.actions"}}</label>
   533  							<div class="ui checkbox{{if $isActionsGlobalDisabled}} disabled{{end}}"{{if $isActionsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   534  							<input class="enable-system" name="enable_actions" type="checkbox" {{if $isActionsEnabled}}checked{{end}}>
   535  							<label>{{ctx.Locale.Tr "repo.settings.actions_desc"}}</label>
   536  						</div>
   537  					</div>
   538  				{{end}}
   539  
   540  				{{if not .IsMirror}}
   541  					<div class="divider"></div>
   542  					{{$pullRequestEnabled := .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypePullRequests}}
   543  					{{$pullRequestGlobalDisabled := ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}}
   544  					{{$prUnit := .Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypePullRequests}}
   545  					<div class="inline field">
   546  						<label>{{ctx.Locale.Tr "repo.pulls"}}</label>
   547  						<div class="ui checkbox{{if $pullRequestGlobalDisabled}} disabled{{end}}"{{if $pullRequestGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
   548  							<input class="enable-system" name="enable_pulls" type="checkbox" data-target="#pull_box" {{if $pullRequestEnabled}}checked{{end}}>
   549  							<label>{{ctx.Locale.Tr "repo.settings.pulls_desc"}}</label>
   550  						</div>
   551  					</div>
   552  					<div class="field{{if not $pullRequestEnabled}} disabled{{end}}" id="pull_box">
   553  						<div class="field">
   554  							<p>
   555  								{{ctx.Locale.Tr "repo.settings.merge_style_desc"}}
   556  							</p>
   557  						</div>
   558  						<div class="field">
   559  							<div class="ui checkbox">
   560  								<input name="pulls_allow_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowMerge)}}checked{{end}}>
   561  								<label>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</label>
   562  							</div>
   563  						</div>
   564  						<div class="field">
   565  							<div class="ui checkbox">
   566  								<input name="pulls_allow_rebase" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebase)}}checked{{end}}>
   567  								<label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</label>
   568  							</div>
   569  						</div>
   570  						<div class="field">
   571  							<div class="ui checkbox">
   572  								<input name="pulls_allow_rebase_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseMerge)}}checked{{end}}>
   573  								<label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</label>
   574  							</div>
   575  						</div>
   576  						<div class="field">
   577  							<div class="ui checkbox">
   578  								<input name="pulls_allow_squash" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowSquash)}}checked{{end}}>
   579  								<label>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</label>
   580  							</div>
   581  						</div>
   582  						<div class="field">
   583  							<div class="ui checkbox">
   584  								<input name="pulls_allow_fast_forward_only" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowFastForwardOnly)}}checked{{end}}>
   585  								<label>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</label>
   586  							</div>
   587  						</div>
   588  						<div class="field">
   589  							<div class="ui checkbox">
   590  								<input name="pulls_allow_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowManualMerge)}}checked{{end}}>
   591  								<label>{{ctx.Locale.Tr "repo.pulls.merge_manually"}}</label>
   592  							</div>
   593  						</div>
   594  
   595  						<div class="field">
   596  							<p>
   597  								{{ctx.Locale.Tr "repo.settings.default_merge_style_desc"}}
   598  							</p>
   599  							<div class="ui dropdown selection">
   600  								<select name="pulls_default_merge_style">
   601  									<option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</option>
   602  									<option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</option>
   603  									<option value="rebase-merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</option>
   604  									<option value="squash" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</option>
   605  									<option value="fast-forward-only" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</option>
   606  								</select>{{svg "octicon-triangle-down" 14 "dropdown icon"}}
   607  								<div class="default text">
   608  									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}
   609  										{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}
   610  									{{end}}
   611  									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}
   612  										{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}
   613  									{{end}}
   614  									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}
   615  										{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}
   616  									{{end}}
   617  									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}
   618  										{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}
   619  									{{end}}
   620  									{{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}}
   621  										{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}
   622  									{{end}}
   623  								</div>
   624  								<div class="menu">
   625  									<div class="item" data-value="merge">{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</div>
   626  									<div class="item" data-value="rebase">{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
   627  									<div class="item" data-value="rebase-merge">{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div>
   628  									<div class="item" data-value="squash">{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</div>
   629  									<div class="item" data-value="fast-forward-only">{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</div>
   630  								</div>
   631  							</div>
   632  						</div>
   633  						<div class="field">
   634  							<div class="ui checkbox">
   635  								<input name="default_allow_maintainer_edit" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultAllowMaintainerEdit)}}checked{{end}}>
   636  								<label>{{ctx.Locale.Tr "repo.settings.pulls.default_allow_edits_from_maintainers"}}</label>
   637  							</div>
   638  						</div>
   639  						<div class="field">
   640  							<div class="ui checkbox">
   641  								<input name="pulls_allow_rebase_update" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseUpdate)}}checked{{end}}>
   642  								<label>{{ctx.Locale.Tr "repo.settings.pulls.allow_rebase_update"}}</label>
   643  							</div>
   644  						</div>
   645  						<div class="field">
   646  							<div class="ui checkbox">
   647  								<input name="default_delete_branch_after_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge)}}checked{{end}}>
   648  								<label>{{ctx.Locale.Tr "repo.settings.pulls.default_delete_branch_after_merge"}}</label>
   649  							</div>
   650  						</div>
   651  						<div class="field">
   652  							<div class="ui checkbox">
   653  								<input name="enable_autodetect_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AutodetectManualMerge)}}checked{{end}}>
   654  								<label>{{ctx.Locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge"}}</label>
   655  							</div>
   656  						</div>
   657  						<div class="field">
   658  							<div class="ui checkbox">
   659  								<input name="pulls_ignore_whitespace" type="checkbox" {{if and $pullRequestEnabled ($prUnit.PullRequestsConfig.IgnoreWhitespaceConflicts)}}checked{{end}}>
   660  								<label>{{ctx.Locale.Tr "repo.settings.pulls.ignore_whitespace"}}</label>
   661  							</div>
   662  						</div>
   663  					</div>
   664  				{{end}}
   665  
   666  				<div class="divider"></div>
   667  				<div class="field">
   668  					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
   669  				</div>
   670  			</form>
   671  		</div>
   672  
   673  		<h4 class="ui top attached header">
   674  			{{ctx.Locale.Tr "repo.settings.signing_settings"}}
   675  		</h4>
   676  		<div class="ui attached segment">
   677  			<form class="ui form" method="post">
   678  				{{.CsrfTokenHtml}}
   679  				<input type="hidden" name="action" value="signing">
   680  				<div class="field">
   681  					<label>{{ctx.Locale.Tr "repo.settings.trust_model"}}</label><br>
   682  					<div class="field">
   683  						<div class="ui radio checkbox">
   684  							<input type="radio" id="trust_model_default" name="trust_model" {{if eq .Repository.TrustModel.String "default"}}checked="checked"{{end}} value="default">
   685  							<label for="trust_model_default">{{ctx.Locale.Tr "repo.settings.trust_model.default"}}</label>
   686  							<p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.default.desc"}}</p>
   687  						</div>
   688  					</div>
   689  					<div class="field">
   690  						<div class="ui radio checkbox">
   691  							<input type="radio" id="trust_model_collaborator" name="trust_model" {{if eq .Repository.TrustModel.String "collaborator"}}checked="checked"{{end}} value="collaborator">
   692  							<label for="trust_model_collaborator">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.long"}}</label>
   693  							<p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.desc"}}</p>
   694  						</div>
   695  					</div>
   696  					<div class="field">
   697  						<div class="ui radio checkbox">
   698  							<input type="radio" name="trust_model" id="trust_model_committer" {{if eq .Repository.TrustModel.String "committer"}}checked="checked"{{end}} value="committer">
   699  							<label for="trust_model_committer">{{ctx.Locale.Tr "repo.settings.trust_model.committer.long"}}</label>
   700  							<p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.committer.desc"}}</p>
   701  						</div>
   702  					</div>
   703  					<div class="field">
   704  						<div class="ui radio checkbox">
   705  							<input type="radio" name="trust_model" id="trust_model_collaboratorcommitter" {{if eq .Repository.TrustModel.String "collaboratorcommitter"}}checked="checked"{{end}} value="collaboratorcommitter">
   706  							<label for="trust_model_collaboratorcommitter">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.long"}}</label>
   707  							<p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc"}}</p>
   708  						</div>
   709  					</div>
   710  				</div>
   711  
   712  				<div class="divider"></div>
   713  				<div class="field">
   714  					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
   715  				</div>
   716  			</form>
   717  		</div>
   718  
   719  		{{if .IsAdmin}}
   720  		<h4 class="ui top attached header">
   721  			{{ctx.Locale.Tr "repo.settings.admin_settings"}}
   722  		</h4>
   723  		<div class="ui attached segment">
   724  			<form class="ui form" method="post">
   725  				{{.CsrfTokenHtml}}
   726  				<input type="hidden" name="action" value="admin">
   727  				<div class="field">
   728  					<div class="ui checkbox">
   729  						<input name="enable_health_check" type="checkbox" {{if .Repository.IsFsckEnabled}}checked{{end}}>
   730  						<label>{{ctx.Locale.Tr "repo.settings.admin_enable_health_check"}}</label>
   731  					</div>
   732  				</div>
   733  
   734  				<div class="field">
   735  					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
   736  				</div>
   737  			</form>
   738  
   739  			<div class="divider"></div>
   740  			<form class="ui form" method="post">
   741  				{{.CsrfTokenHtml}}
   742  				<input type="hidden" name="action" value="admin_index">
   743  				{{if .IsRepoIndexerEnabled}}
   744  					<h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_code_indexer"}}</h4>
   745  					<div class="inline fields">
   746  						<label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label>
   747  						<span class="field">
   748  							{{if .CodeIndexerStatus}}
   749  								<a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.CodeIndexerStatus.CommitSha}}">
   750  									<span class="shortsha">{{ShortSha .CodeIndexerStatus.CommitSha}}</span>
   751  								</a>
   752  							{{else}}
   753  									<span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span>
   754  							{{end}}
   755  						</span>
   756  						<div class="field">
   757  							<button class="ui primary button" name="request_reindex_type" value="code">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button>
   758  						</div>
   759  					</div>
   760  				{{end}}
   761  				<h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_stats_indexer"}}</h4>
   762  				<div class="inline fields">
   763  					{{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}}
   764  						<label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label>
   765  					{{end}}
   766  					<span class="field">
   767  						{{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}}
   768  							<a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.StatsIndexerStatus.CommitSha}}">
   769  								<span class="shortsha">{{ShortSha .StatsIndexerStatus.CommitSha}}</span>
   770  							</a>
   771  						{{else}}
   772  							<span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span>
   773  						{{end}}
   774  					</span>
   775  					<div class="field">
   776  						<button class="ui primary button" name="request_reindex_type" value="stats">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button>
   777  					</div>
   778  				</div>
   779  			</form>
   780  		</div>
   781  		{{end}}
   782  
   783  		{{if .Permission.IsOwner}}
   784  		<h4 class="ui top attached error header">
   785  			{{ctx.Locale.Tr "repo.settings.danger_zone"}}
   786  		</h4>
   787  		<div class="ui attached error danger segment">
   788  			<div class="flex-list">
   789  				{{if .Repository.IsMirror}}
   790  					<div class="flex-item">
   791  						<div class="flex-item-main">
   792  							<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert"}}</div>
   793  							<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_desc"}}</div>
   794  						</div>
   795  						<div class="flex-item-trailing">
   796  							<button class="ui basic red show-modal button" data-modal="#convert-mirror-repo-modal">{{ctx.Locale.Tr "repo.settings.convert"}}</button>
   797  						</div>
   798  					</div>
   799  				{{end}}
   800  				{{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
   801  					<div class="flex-item">
   802  						<div class="flex-item-main">
   803  							<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</div>
   804  							<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_fork_desc"}}</div>
   805  						</div>
   806  						<div class="flex-item-trailing">
   807  							<button class="ui basic red show-modal button" data-modal="#convert-fork-repo-modal">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</button>
   808  						</div>
   809  					</div>
   810  				{{end}}
   811  				<div class="flex-item">
   812  					<div class="flex-item-main">
   813  						<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.transfer"}}</div>
   814  						<div class="flex-item-body">
   815  							{{if .RepoTransfer}}
   816  								{{ctx.Locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName}}
   817  							{{else}}
   818  								{{ctx.Locale.Tr "repo.settings.transfer_desc"}}
   819  							{{end}}
   820  						</div>
   821  					</div>
   822  					<div class="flex-item-trailing">
   823  						{{if .RepoTransfer}}
   824  							<form class="ui form" action="{{.Link}}" method="post">
   825  								{{.CsrfTokenHtml}}
   826  								<input type="hidden" name="action" value="cancel_transfer">
   827  								<button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_abort"}}</button>
   828  							</form>
   829  						{{else}}
   830  							<button class="ui basic red show-modal button" data-modal="#transfer-repo-modal">{{ctx.Locale.Tr "repo.settings.transfer"}}</button>
   831  						{{end}}
   832  					</div>
   833  				</div>
   834  				{{if .Permission.CanRead ctx.Consts.RepoUnitTypeWiki}}
   835  					<div class="flex-item">
   836  						<div class="flex-item-main">
   837  							<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</div>
   838  							<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.wiki_delete_desc"}}</div>
   839  						</div>
   840  						<div class="flex-item-trailing">
   841  							<button class="ui basic red show-modal button" data-modal="#delete-wiki-modal">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</button>
   842  						</div>
   843  					</div>
   844  				{{end}}
   845  				<div class="flex-item">
   846  					<div class="flex-item-main">
   847  						<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.delete"}}</div>
   848  						<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.delete_desc"}}</div>
   849  					</div>
   850  					<div class="flex-item-trailing">
   851  						<button class="ui basic red show-modal button" data-modal="#delete-repo-modal">{{ctx.Locale.Tr "repo.settings.delete"}}</button>
   852  					</div>
   853  				</div>
   854  				{{if not .Repository.IsMirror}}
   855  					<div class="flex-item tw-items-center">
   856  						<div class="flex-item-main">
   857  							{{if .Repository.IsArchived}}
   858  								<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.unarchive.header"}}</div>
   859  								<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.unarchive.text"}}</div>
   860  							{{else}}
   861  								<div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.archive.header"}}</div>
   862  								<div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.archive.text"}}</div>
   863  							{{end}}
   864  						</div>
   865  						<div class="flex-item-trailing">
   866  							<button class="ui basic red show-modal button" data-modal="#archive-repo-modal">
   867  								{{if .Repository.IsArchived}}
   868  									{{ctx.Locale.Tr "repo.settings.unarchive.button"}}
   869  								{{else}}
   870  									{{ctx.Locale.Tr "repo.settings.archive.button"}}
   871  								{{end}}
   872  							</button>
   873  						</div>
   874  					</div>
   875  				{{end}}
   876  			</div>
   877  		</div>
   878  		{{end}}
   879  	</div>
   880  {{template "repo/settings/layout_footer" .}}
   881  
   882  {{if .Permission.IsOwner}}
   883  	{{if .Repository.IsMirror}}
   884  		<div class="ui small modal" id="convert-mirror-repo-modal">
   885  			<div class="header">
   886  				{{ctx.Locale.Tr "repo.settings.convert"}}
   887  			</div>
   888  			<div class="content">
   889  				<div class="ui warning message">
   890  					{{ctx.Locale.Tr "repo.settings.convert_notices_1"}}
   891  				</div>
   892  				<form class="ui form" action="{{.Link}}" method="post">
   893  					{{.CsrfTokenHtml}}
   894  					<input type="hidden" name="action" value="convert">
   895  					<div class="field">
   896  						<label>
   897  							{{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
   898  							<span class="text red">{{.Repository.Name}}</span>
   899  						</label>
   900  					</div>
   901  					<div class="required field">
   902  						<label>{{ctx.Locale.Tr "repo.repo_name"}}</label>
   903  						<input name="repo_name" required maxlength="100">
   904  					</div>
   905  
   906  					<div class="text right actions">
   907  						<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
   908  						<button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_confirm"}}</button>
   909  					</div>
   910  				</form>
   911  			</div>
   912  		</div>
   913  	{{end}}
   914  	{{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
   915  		<div class="ui small modal" id="convert-fork-repo-modal">
   916  			<div class="header">
   917  				{{ctx.Locale.Tr "repo.settings.convert_fork"}}
   918  			</div>
   919  			<div class="content">
   920  				<div class="ui warning message">
   921  					{{ctx.Locale.Tr "repo.settings.convert_fork_notices_1"}}
   922  				</div>
   923  				<form class="ui form" action="{{.Link}}" method="post">
   924  					{{.CsrfTokenHtml}}
   925  					<input type="hidden" name="action" value="convert_fork">
   926  					<div class="field">
   927  						<label>
   928  							{{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
   929  							<span class="text red">{{.Repository.Name}}</span>
   930  						</label>
   931  					</div>
   932  					<div class="required field">
   933  						<label>{{ctx.Locale.Tr "repo.repo_name"}}</label>
   934  						<input name="repo_name" required>
   935  					</div>
   936  
   937  					<div class="text right actions">
   938  						<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
   939  						<button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_fork_confirm"}}</button>
   940  					</div>
   941  				</form>
   942  			</div>
   943  		</div>
   944  	{{end}}
   945  	<div class="ui small modal" id="transfer-repo-modal">
   946  		<div class="header">
   947  			{{ctx.Locale.Tr "repo.settings.transfer"}}
   948  		</div>
   949  		<div class="content">
   950  			<div class="ui warning message">
   951  				{{ctx.Locale.Tr "repo.settings.transfer_notices_1"}} <br>
   952  				{{ctx.Locale.Tr "repo.settings.transfer_notices_2"}} <br>
   953  				{{ctx.Locale.Tr "repo.settings.transfer_notices_3"}} <br>
   954  				{{ctx.Locale.Tr "repo.settings.transfer_notices_4"}}
   955  			</div>
   956  			<form class="ui form" action="{{.Link}}" method="post">
   957  				{{.CsrfTokenHtml}}
   958  				<input type="hidden" name="action" value="transfer">
   959  				<div class="field">
   960  					<label>
   961  						{{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
   962  						<span class="text red">{{.Repository.Name}}</span>
   963  					</label>
   964  				</div>
   965  				<div class="required field">
   966  					<label>{{ctx.Locale.Tr "repo.repo_name"}}</label>
   967  					<input name="repo_name" required>
   968  				</div>
   969  				<div class="required field">
   970  					<label for="new_owner_name">{{ctx.Locale.Tr "repo.settings.transfer_owner"}}</label>
   971  					<input id="new_owner_name" name="new_owner_name" required>
   972  				</div>
   973  
   974  				<div class="text right actions">
   975  					<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
   976  					<button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_perform"}}</button>
   977  				</div>
   978  			</form>
   979  		</div>
   980  	</div>
   981  
   982  	<div class="ui small modal" id="delete-repo-modal">
   983  		<div class="header">
   984  			{{ctx.Locale.Tr "repo.settings.delete"}}
   985  		</div>
   986  		<div class="content">
   987  			<div class="ui warning message">
   988  				{{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br>
   989  				{{ctx.Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName}}
   990  				{{if .Repository.NumForks}}<br>
   991  				{{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}}
   992  				{{end}}
   993  			</div>
   994  			<form class="ui form" action="{{.Link}}" method="post">
   995  				{{.CsrfTokenHtml}}
   996  				<input type="hidden" name="action" value="delete">
   997  				<div class="field">
   998  					<label>
   999  						{{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
  1000  						<span class="text red">{{.Repository.Name}}</span>
  1001  					</label>
  1002  				</div>
  1003  				<div class="required field">
  1004  					<label for="repo_name_to_delete">{{ctx.Locale.Tr "repo.repo_name"}}</label>
  1005  					<input id="repo_name_to_delete" name="repo_name" required>
  1006  				</div>
  1007  
  1008  				<div class="text right actions">
  1009  					<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  1010  					<button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button>
  1011  				</div>
  1012  			</form>
  1013  		</div>
  1014  	</div>
  1015  
  1016  	{{if .Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypeWiki}}
  1017  	<div class="ui small modal" id="delete-wiki-modal">
  1018  		<div class="header">
  1019  			{{ctx.Locale.Tr "repo.settings.wiki_delete"}}
  1020  		</div>
  1021  		<div class="content">
  1022  			<div class="ui warning message">
  1023  				{{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br>
  1024  				{{ctx.Locale.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name}}
  1025  			</div>
  1026  			<form class="ui form" action="{{.Link}}" method="post">
  1027  				{{.CsrfTokenHtml}}
  1028  				<input type="hidden" name="action" value="delete-wiki">
  1029  				<div class="field">
  1030  					<label>
  1031  						{{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
  1032  						<span class="text red">{{.Repository.Name}}</span>
  1033  					</label>
  1034  				</div>
  1035  				<div class="required field">
  1036  					<label>{{ctx.Locale.Tr "repo.repo_name"}}</label>
  1037  					<input name="repo_name" required>
  1038  				</div>
  1039  
  1040  				<div class="text right actions">
  1041  					<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  1042  					<button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_delete"}}</button>
  1043  				</div>
  1044  			</form>
  1045  		</div>
  1046  	</div>
  1047  	{{end}}
  1048  
  1049  	{{if not .Repository.IsMirror}}
  1050  		<div class="ui g-modal-confirm modal" id="archive-repo-modal">
  1051  			<div class="header">
  1052  				{{if .Repository.IsArchived}}
  1053  					{{ctx.Locale.Tr "repo.settings.unarchive.header"}}
  1054  				{{else}}
  1055  					{{ctx.Locale.Tr "repo.settings.archive.header"}}
  1056  				{{end}}
  1057  			</div>
  1058  			<div class="content">
  1059  				<p>
  1060  					{{if .Repository.IsArchived}}
  1061  						{{ctx.Locale.Tr "repo.settings.unarchive.text"}}
  1062  					{{else}}
  1063  						{{ctx.Locale.Tr "repo.settings.archive.text"}}
  1064  					{{end}}
  1065  				</p>
  1066  			</div>
  1067  			<form action="{{.Link}}" method="post">
  1068  				{{.CsrfTokenHtml}}
  1069  				<input type="hidden" name="action" value="{{if .Repository.IsArchived}}unarchive{{else}}archive{{end}}">
  1070  				<input type="hidden" name="repo_id" value="{{.Repository.ID}}">
  1071  				{{template "base/modal_actions_confirm" .}}
  1072  			</form>
  1073  		</div>
  1074  	{{end}}
  1075  {{end}}
  1076  
  1077  {{template "repo/settings/push_mirror_sync_modal" .}}