Skip to content

Commit

Permalink
Move team access mode text logic to template.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsvantesson committed Sep 23, 2019
1 parent 28d3e37 commit 8f0a474
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
16 changes: 0 additions & 16 deletions models/repo_collaboration.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,3 @@ func (repo *Repository) getRepoTeams(e Engine) (teams []*Team, err error) {
func (repo *Repository) GetRepoTeams() ([]*Team, error) {
return repo.getRepoTeams(x)
}

// ModeI18nKey returns the i18n key to describe collaboration modes
func (t *Team) ModeI18nKey() string {
switch t.Authorize {
case AccessModeRead:
return "repo.settings.collaboration.read"
case AccessModeWrite:
return "repo.settings.collaboration.write"
case AccessModeAdmin:
return "repo.settings.collaboration.admin"
case AccessModeOwner:
return "repo.settings.collaboration.owner"
default:
return "repo.settings.collaboration.undefined"
}
}
2 changes: 1 addition & 1 deletion templates/repo/settings/collaboration.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<div class="ui eight wide column poping up" data-content="Team's permission is set on the team setting page and can't be changed per repository">
<span class="octicon octicon-shield"></span>
<div class="ui inline dropdown">
<div class="text">{{$.i18n.Tr .ModeI18nKey}}</div>
<div class="text">{{if eq .Authorize 1}}{{$.i18n.Tr "repo.settings.collaboration.read"}}{{else if eq .Authorize 2}}{{$.i18n.Tr "repo.settings.collaboration.write"}}{{else if eq .Authorize 3}}{{$.i18n.Tr "repo.settings.collaboration.admin"}}{{else if eq .Authorize 4}}{{$.i18n.Tr "repo.settings.collaboration.owner"}}{{else}}{{$.i18n.Tr "repo.settings.collaboration.undefined"}}{{end}}</div>
</div>
{{ if or (eq .Authorize 1) (eq .Authorize 2) }}
{{ $first := true }}
Expand Down

0 comments on commit 8f0a474

Please sign in to comment.