summaryrefslogtreecommitdiffstats
path: root/templates/repo/settings/units/wiki.tmpl
blob: 23df294bd31a6df82f78346caddf3265d169f5ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<h4 class="ui top attached header" id="wiki">
	{{ctx.Locale.Tr "repo.wiki"}}
</h4>
<div class="ui attached segment">
	{{$isWikiEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeWiki) (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}
	{{$isWikiGlobalDisabled := .UnitTypeWiki.UnitGlobalDisabled}}
	{{$isExternalWikiGlobalDisabled := .UnitTypeExternalWiki.UnitGlobalDisabled}}
	{{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}}
	<div class="inline field">
		<label>{{ctx.Locale.Tr "repo.wiki"}}</label>
		<div class="ui checkbox{{if $isBothWikiGlobalDisabled}} disabled{{end}}"{{if $isBothWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
			<input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if $isWikiEnabled}}checked{{end}}>
			<label>{{ctx.Locale.Tr "repo.settings.wiki_desc"}}</label>
		</div>
	</div>
	<div class="field{{if not $isWikiEnabled}} disabled{{end}}" id="wiki_box">
		<div class="field">
			<div class="ui radio checkbox{{if $isWikiGlobalDisabled}} disabled{{end}}"{{if $isWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
				<input class="enable-system-radio" name="enable_external_wiki" type="radio" value="false" data-context="#globally_writeable_checkbox" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}checked{{end}}>
				<label>{{ctx.Locale.Tr "repo.settings.use_internal_wiki"}}</label>
			</div>
		</div>
		{{if (not .Repository.IsPrivate)}}
			<div class="field {{if (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}disabled{{end}}" id="globally_writeable_checkbox">
				<div class="field tw-pl-4">
					<div class="ui checkbox">
						<input name="globally_writeable_wiki" type="checkbox" {{if .Permission.IsGloballyWriteable $.UnitTypeWiki}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.wiki_globally_editable"}}</label>
					</div>
				</div>
			</div>
		{{end}}
		<div class="field">
			<div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
				<input class="enable-system-radio" name="enable_external_wiki" type="radio" value="true" data-context="#globally_writeable_checkbox" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki}}checked{{end}}>
				<label>{{ctx.Locale.Tr "repo.settings.use_external_wiki"}}</label>
			</div>
		</div>
		<div class="field tw-pl-4 {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}disabled{{end}}" id="external_wiki_box">
			<label for="external_wiki_url">{{ctx.Locale.Tr "repo.settings.external_wiki_url"}}</label>
			<input id="external_wiki_url" name="external_wiki_url" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}">
			<p class="help">{{ctx.Locale.Tr "repo.settings.external_wiki_url_desc"}}</p>
		</div>
	</div>

	<div class="divider"></div>

	<div class="field">
		<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
	</div>
</div>