aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/settings/options.tmpl
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-02-04 23:53:46 +0800
committerGitHub <noreply@github.com>2017-02-04 23:53:46 +0800
commit8a421b1fd702d99e8438f6ef6f4ee339f1eaa130 (patch)
treec69e598ca9dca29dc64a4e1d8525165ec794106f /templates/repo/settings/options.tmpl
parent49fa03bf4286bd2cbf90b271fb65d4f70e5de57f (diff)
downloadgitea-8a421b1fd702d99e8438f6ef6f4ee339f1eaa130.tar.gz
gitea-8a421b1fd702d99e8438f6ef6f4ee339f1eaa130.zip
Add units concept for modulable functions of a repository (#742)
* Add units concept for modulable functions of a repository * remove unused comment codes & fix lints and tests * remove unused comment codes * use struct config instead of map * fix lint * rm wrong files * fix tests
Diffstat (limited to 'templates/repo/settings/options.tmpl')
-rw-r--r--templates/repo/settings/options.tmpl38
1 files changed, 20 insertions, 18 deletions
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 2588966c9d..911d3693ce 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -114,26 +114,26 @@
<div class="inline field">
<label>{{.i18n.Tr "repo.wiki"}}</label>
<div class="ui checkbox">
- <input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if .Repository.EnableWiki}}checked{{end}}>
+ <input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if or (.Repository.EnableUnit $.UnitTypeWiki) (.Repository.EnableUnit $.UnitTypeExternalWiki)}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.wiki_desc"}}</label>
</div>
</div>
- <div class="field {{if not .Repository.EnableWiki}}disabled{{end}}" id="wiki_box">
+ <div class="field {{if not (.Repository.EnableUnit $.UnitTypeWiki)}}disabled{{end}}" id="wiki_box">
<div class="field">
<div class="ui radio checkbox">
- <input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not .Repository.EnableExternalWiki}}checked{{end}}/>
+ <input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.EnableUnit $.UnitTypeExternalWiki)}}checked{{end}}/>
<label>{{.i18n.Tr "repo.settings.use_internal_wiki"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
- <input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.EnableExternalWiki}}checked{{end}}/>
+ <input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.EnableUnit $.UnitTypeExternalWiki}}checked{{end}}/>
<label>{{.i18n.Tr "repo.settings.use_external_wiki"}}</label>
</div>
</div>
- <div class="field {{if not .Repository.EnableExternalWiki}}disabled{{end}}" id="external_wiki_box">
+ <div class="field {{if not (.Repository.EnableUnit $.UnitTypeExternalWiki)}}disabled{{end}}" id="external_wiki_box">
<label for="external_wiki_url">{{.i18n.Tr "repo.settings.external_wiki_url"}}</label>
- <input id="external_wiki_url" name="external_wiki_url" type="url" value="{{.Repository.ExternalWikiURL}}">
+ <input id="external_wiki_url" name="external_wiki_url" type="url" value="{{(.Repository.MustGetUnit $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}">
<p class="help">{{.i18n.Tr "repo.settings.external_wiki_url_desc"}}</p>
</div>
</div>
@@ -143,45 +143,47 @@
<div class="inline field">
<label>{{.i18n.Tr "repo.issues"}}</label>
<div class="ui checkbox">
- <input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if .Repository.EnableIssues}}checked{{end}}>
+ <input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if or (.Repository.EnableUnit $.UnitTypeIssues) (.Repository.EnableUnit $.UnitTypeExternalTracker)}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.issues_desc"}}</label>
</div>
</div>
- <div class="field {{if not .Repository.EnableIssues}}disabled{{end}}" id="issue_box">
+ <div class="field {{if not (.Repository.EnableUnit $.UnitTypeIssues)}}disabled{{end}}" id="issue_box">
<div class="field">
<div class="ui radio checkbox">
- <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-target="#external_issue_box" {{if not .Repository.EnableExternalTracker}}checked{{end}}/>
+ <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-target="#external_issue_box" {{if not (.Repository.EnableUnit $.UnitTypeExternalTracker)}}checked{{end}}/>
<label>{{.i18n.Tr "repo.settings.use_internal_issue_tracker"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
- <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-target="#external_issue_box" {{if .Repository.EnableExternalTracker}}checked{{end}}/>
+ <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-target="#external_issue_box" {{if .Repository.EnableUnit $.UnitTypeExternalTracker}}checked{{end}}/>
<label>{{.i18n.Tr "repo.settings.use_external_issue_tracker"}}</label>
</div>
</div>
- <div class="field {{if not .Repository.EnableExternalTracker}}disabled{{end}}" id="external_issue_box">
+ <div class="field {{if not (.Repository.EnableUnit $.UnitTypeExternalTracker)}}disabled{{end}}" id="external_issue_box">
<div class="field">
<label for="external_tracker_url">{{.i18n.Tr "repo.settings.external_tracker_url"}}</label>
- <input id="external_tracker_url" name="external_tracker_url" type="url" value="{{.Repository.ExternalTrackerURL}}">
+ <input id="external_tracker_url" name="external_tracker_url" type="url" value="{{(.Repository.MustGetUnit $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerURL}}">
<p class="help">{{.i18n.Tr "repo.settings.external_tracker_url_desc"}}</p>
</div>
<div class="field">
<label for="tracker_url_format">{{.i18n.Tr "repo.settings.tracker_url_format"}}</label>
- <input id="tracker_url_format" name="tracker_url_format" type="url" value="{{.Repository.ExternalTrackerFormat}}" placeholder="e.g. https://github.com/{user}/{repo}/issues/{index}">
+ <input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="e.g. https://github.com/{user}/{repo}/issues/{index}">
<p class="help">{{.i18n.Tr "repo.settings.tracker_url_format_desc" | Str2html}}</p>
</div>
<div class="inline fields">
<label for="issue_style">{{.i18n.Tr "repo.settings.tracker_issue_style"}}</label>
<div class="field">
<div class="ui radio checkbox">
- <input class="hidden" tabindex="0" name="tracker_issue_style" type="radio" value="numeric" {{if eq .Repository.ExternalTrackerStyle "numeric"}}checked=""{{end}}/>
+ {{$externalTracker := (.Repository.MustGetUnit $.UnitTypeExternalTracker)}}
+ {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}}
+ <input class="hidden" tabindex="0" name="tracker_issue_style" type="radio" value="numeric" {{if $externalTrackerStyle}}{{if eq $externalTrackerStyle "numeric"}}checked=""{{end}}{{end}}/>
<label>{{.i18n.Tr "repo.settings.tracker_issue_style.numeric"}} <span class="ui light grey text">(#1234)</span></label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
- <input class="hidden" tabindex="0" name="tracker_issue_style" type="radio" value="alphanumeric" {{if eq .Repository.ExternalTrackerStyle "alphanumeric"}}checked=""{{end}}/>
+ <input class="hidden" tabindex="0" name="tracker_issue_style" type="radio" value="alphanumeric" {{if $externalTrackerStyle}}{{if eq $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle "alphanumeric"}}checked=""{{end}}{{end}} />
<label>{{.i18n.Tr "repo.settings.tracker_issue_style.alphanumeric"}} <span class="ui light grey text">(ABC-123, DEFG-234)</span></label>
</div>
</div>
@@ -195,7 +197,7 @@
<div class="inline field">
<label>{{.i18n.Tr "repo.pulls"}}</label>
<div class="ui checkbox">
- <input name="enable_pulls" type="checkbox" {{if .Repository.EnablePulls}}checked{{end}}>
+ <input name="enable_pulls" type="checkbox" {{if .Repository.EnableUnit $.UnitTypePullRequests}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.pulls_desc"}}</label>
</div>
</div>
@@ -236,7 +238,7 @@
</div>
</div>
- {{if .Repository.EnableWiki}}
+ {{if .Repository.EnableUnit $.UnitTypeWiki}}
<div class="ui divider"></div>
<div class="item">
@@ -370,7 +372,7 @@
</div>
</div>
- {{if .Repository.EnableWiki}}
+ {{if .Repository.EnableUnit $.UnitTypeWiki}}
<div class="ui small modal" id="delete-wiki-modal">
<div class="header">
{{.i18n.Tr "repo.settings.wiki-delete"}}