Skip to content

Commit

Permalink
Adding visual cue for "Limited" & "Private" organizations. (#13040)
Browse files Browse the repository at this point in the history
* Adding visual cue for "Limited" & "Private" organizations.

* Moving org visibility CSS styles to .less files.

Co-authored-by: Gitea <gitea@fake.local>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
  • Loading branch information
3 people authored Oct 6, 2020
1 parent df4bbcd commit 6eea301
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,9 @@ settings.repoadminchangeteam = Repository admin can add and remove access for te
settings.visibility = Visibility
settings.visibility.public = Public
settings.visibility.limited = Limited (Visible to logged in users only)
settings.visibility.limited_shortname = Limited
settings.visibility.private = Private (Visible only to organization members)
settings.visibility.private_shortname = Private

settings.update_settings = Update Settings
settings.update_setting_success = Organization settings have been updated.
Expand Down
5 changes: 4 additions & 1 deletion templates/org/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<div class="ui header">
<img class="ui image" src="{{.SizedRelAvatarLink 100}}">
<span class="text thin grey"><a href="{{.HomeLink}}">{{.DisplayName}}</a></span>

<span class="org-visibility">
{{if .Visibility.IsLimited}}<div class="ui medium orange horizontal label">{{$.i18n.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
{{if .Visibility.IsPrivate}}<div class="ui medium red horizontal label">{{$.i18n.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
</span>
<div class="ui right">
<div class="ui menu">
<a class="{{if $.PageIsOrgMembers}}active{{end}} item" href="{{$.OrgLink}}/members">
Expand Down
4 changes: 4 additions & 0 deletions templates/org/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<div id="org-info">
<div class="ui header">
{{.Org.DisplayName}}
<span class="org-visibility">
{{if .Org.Visibility.IsLimited}}<div class="ui large orange horizontal label">{{.i18n.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
{{if .Org.Visibility.IsPrivate}}<div class="ui large red horizontal label">{{.i18n.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
</span>
{{if .IsOrganizationOwner}}<a class="middle text grey" href="{{.OrgLink}}/settings">{{svg "octicon-gear"}}</a>{{end}}
</div>
{{if .Org.Description}}<p class="desc">{{.Org.Description}}</p>{{end}}
Expand Down
10 changes: 10 additions & 0 deletions templates/user/dashboard/navbar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<span class="text">
<img class="ui avatar image" src="{{.ContextUser.RelAvatarLink}}" title="{{.ContextUser.Name}}" width="28" height="28">
{{.ContextUser.ShortName 20}}
{{if .ContextUser.IsOrganization}}
<span class="org-visibility">
{{if .ContextUser.Visibility.IsLimited}}<div class="ui orange tiny horizontal label">{{.i18n.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
{{if .ContextUser.Visibility.IsPrivate}}<div class="ui red tiny horizontal label">{{.i18n.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
</span>
{{end}}
<i class="dropdown icon"></i>
</span>
<div class="context user overflow menu" tabindex="-1">
Expand All @@ -20,6 +26,10 @@
<a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item" title="{{.Name}}" href="{{AppSubUrl}}/org/{{.Name}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}">
<img class="ui avatar image" src="{{.RelAvatarLink}}" width="28" height="28">
{{.ShortName 20}}
<span class="org-visibility">
{{if .Visibility.IsLimited}}<div class="ui orange tiny horizontal label">{{$.i18n.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
{{if .Visibility.IsPrivate}}<div class="ui red tiny horizontal label">{{$.i18n.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
</span>
</a>
{{end}}
</div>
Expand Down
3 changes: 3 additions & 0 deletions web_src/less/_dashboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
.dashboard-navbar {
width: 100vw;
padding: 0 .5rem;
.org-visibility .label {
margin-left: 5px;
}
}
}

Expand Down
9 changes: 8 additions & 1 deletion web_src/less/_organization.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
font-size: 1.6rem;
margin-left: 15px;
}

.org-visibility .label {
margin-left: 5px;
margin-top: 5px;
}
.ui.right {
margin-top: 5px;
}
Expand Down Expand Up @@ -43,6 +46,10 @@
.ui.header {
font-size: 36px;
margin-bottom: 0;
.org-visibility .label {
margin-left: 5px;
margin-top: 2px;
}
}

.desc {
Expand Down

0 comments on commit 6eea301

Please sign in to comment.