summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorRémy Boulanouar <rboulanouar@gmail.com>2019-02-18 17:00:27 +0100
committerLauris BH <lauris@nix.lv>2019-02-18 18:00:27 +0200
commit64ce159a6eacc81962d07a8f5ef7f69c17365363 (patch)
treed6b94d035de14df8b1a773d97ab35937cce1d00a /templates
parentae3a913122d3430ccf14da22f09daf6f636a00f8 (diff)
downloadgitea-64ce159a6eacc81962d07a8f5ef7f69c17365363.tar.gz
gitea-64ce159a6eacc81962d07a8f5ef7f69c17365363.zip
Allow to set organization visibility (public, internal, private) (#1763)
Diffstat (limited to 'templates')
-rw-r--r--templates/admin/config.tmpl3
-rw-r--r--templates/admin/org/list.tmpl7
-rw-r--r--templates/admin/repo/list.tmpl7
-rw-r--r--templates/explore/organizations.tmpl7
-rw-r--r--templates/explore/repo_list.tmpl5
-rw-r--r--templates/org/create.tmpl22
-rw-r--r--templates/org/settings/options.tmpl23
-rw-r--r--templates/user/profile.tmpl6
8 files changed, 74 insertions, 6 deletions
diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl
index 2d660117d5..becaca61e5 100644
--- a/templates/admin/config.tmpl
+++ b/templates/admin/config.tmpl
@@ -148,6 +148,9 @@
<dt>{{.i18n.Tr "admin.config.default_allow_only_contributors_to_track_time"}}</dt>
<dd><i class="fa fa{{if .Service.DefaultAllowOnlyContributorsToTrackTime}}-check{{end}}-square-o"></i></dd>
{{end}}
+ <dt>{{.i18n.Tr "admin.config.default_visibility_organization"}}</dt>
+ <dd>{{.Service.DefaultOrgVisibility}}</dd>
+
<dt>{{.i18n.Tr "admin.config.no_reply_address"}}</dt>
<dd>{{if .Service.NoReplyAddress}}{{.Service.NoReplyAddress}}{{else}}-{{end}}</dd>
<dt>{{.i18n.Tr "admin.config.default_enable_dependencies"}}</dt>
diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl
index 141628c5b3..e9dbc7f877 100644
--- a/templates/admin/org/list.tmpl
+++ b/templates/admin/org/list.tmpl
@@ -29,7 +29,12 @@
{{range .Users}}
<tr>
<td>{{.ID}}</td>
- <td><a href="{{.HomeLink}}">{{.Name}}</a></td>
+ <td>
+ <a href="{{.HomeLink}}">{{.Name}}</a>
+ {{if .Visibility.IsPrivate}}
+ <span class="text gold"><i class="octicon octicon-lock"></i></span>
+ {{end}}
+ </td>
<td>{{.NumTeams}}</td>
<td>{{.NumMembers}}</td>
<td>{{.NumRepos}}</td>
diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl
index 5d78e8c84e..423de6a3d8 100644
--- a/templates/admin/repo/list.tmpl
+++ b/templates/admin/repo/list.tmpl
@@ -30,7 +30,12 @@
{{range .Repos}}
<tr>
<td>{{.ID}}</td>
- <td><a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a></td>
+ <td>
+ <a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
+ {{if .Owner.Visibility.IsPrivate}}
+ <span class="text gold"><i class="octicon octicon-lock"></i></span>
+ {{end}}
+ </td>
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></td>
<td><i class="fa fa{{if .IsPrivate}}-check{{end}}-square-o"></i></td>
<td>{{.NumWatches}}</td>
diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl
index b977da4e4d..4e2bfc9fd9 100644
--- a/templates/explore/organizations.tmpl
+++ b/templates/explore/organizations.tmpl
@@ -9,7 +9,12 @@
<div class="item">
<img class="ui avatar image" src="{{.RelAvatarLink}}">
<div class="content">
- <span class="header"><a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}</span>
+ <span class="header">
+ <a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}
+ {{if .Visibility.IsPrivate}}
+ <span class="text gold"><i class="octicon octicon-lock"></i></span>
+ {{end}}
+ </span>
<div class="description">
{{if .Location}}
<i class="octicon octicon-location"></i> {{.Location}}
diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl
index 660299157b..94ce293389 100644
--- a/templates/explore/repo_list.tmpl
+++ b/templates/explore/repo_list.tmpl
@@ -12,8 +12,11 @@
<span><i class="octicon octicon-repo-forked"></i></span>
{{else if .IsMirror}}
<span><i class="octicon octicon-repo-clone"></i></span>
+ {{else if .Owner}}
+ {{if .Owner.Visibility.IsPrivate}}
+ <span class="text gold"><i class="octicon octicon-lock"></i></span>
+ {{end}}
{{end}}
-
<div class="ui right metas">
<span class="text grey"><i class="octicon octicon-star"></i> {{.NumStars}}</span>
<span class="text grey"><i class="octicon octicon-git-branch"></i> {{.NumForks}}</span>
diff --git a/templates/org/create.tmpl b/templates/org/create.tmpl
index 765ef240e5..acf914c9d4 100644
--- a/templates/org/create.tmpl
+++ b/templates/org/create.tmpl
@@ -15,6 +15,28 @@
<span class="help">{{.i18n.Tr "org.org_name_helper"}}</span>
</div>
+ <div class="inline required field {{if .Err_OrgVisibility}}error{{end}}">
+ <label for="visibility">{{.i18n.Tr "org.settings.visibility"}}</label>
+ <div class="field">
+ <div class="ui radio checkbox">
+ <input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if .DefaultOrgVisibilityMode.IsPublic}}checked{{end}}/>
+ <label>{{.i18n.Tr "org.settings.visibility.public"}}</label>
+ </div>
+ </div>
+ <div class="field">
+ <div class="ui radio checkbox">
+ <input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if .DefaultOrgVisibilityMode.IsLimited}}checked{{end}}/>
+ <label>{{.i18n.Tr "org.settings.visibility.limited"}}</label>
+ </div>
+ </div>
+ <div class="field">
+ <div class="ui radio checkbox">
+ <input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if .DefaultOrgVisibilityMode.IsPrivate}}checked{{end}}/>
+ <label>{{.i18n.Tr "org.settings.visibility.private"}}</label>
+ </div>
+ </div>
+ </div>
+
<div class="inline field">
<label></label>
<button class="ui green button">
diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl
index 8041365434..e8cfd97d4e 100644
--- a/templates/org/settings/options.tmpl
+++ b/templates/org/settings/options.tmpl
@@ -33,6 +33,29 @@
<input id="location" name="location" value="{{.Org.Location}}">
</div>
+ <div class="ui divider"></div>
+ <div class="field" id="visibility_box">
+ <label for="visibility">{{.i18n.Tr "org.settings.visibility"}}</label>
+ <div class="field">
+ <div class="ui radio checkbox">
+ <input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if eq .CurrentVisibility 0}}checked{{end}}/>
+ <label>{{.i18n.Tr "org.settings.visibility.public"}}</label>
+ </div>
+ </div>
+ <div class="field">
+ <div class="ui radio checkbox">
+ <input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}/>
+ <label>{{.i18n.Tr "org.settings.visibility.limited"}}</label>
+ </div>
+ </div>
+ <div class="field">
+ <div class="ui radio checkbox">
+ <input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}/>
+ <label>{{.i18n.Tr "org.settings.visibility.private"}}</label>
+ </div>
+ </div>
+ </div>
+
{{if .SignedUser.IsAdmin}}
<div class="ui divider"></div>
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
index 5e6fbf4bb8..b3a500e9f6 100644
--- a/templates/user/profile.tmpl
+++ b/templates/user/profile.tmpl
@@ -61,10 +61,12 @@
</a>
</li>
*/}}
- {{if .Orgs}}
+ {{if and .Orgs .HasOrgsVisible}}
<li>
{{range .Orgs}}
- <a href="{{.HomeLink}}"><img class="ui mini image poping up" src="{{.RelAvatarLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted"></a>
+ {{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.IsUserPartOfOrg $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
+ <a href="{{.HomeLink}}"><img class="ui mini image poping up" src="{{.RelAvatarLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted"></a>
+ {{end}}
{{end}}
</li>
{{end}}