Skip to content

Commit 7afa52e

Browse files
author
root
committed
Show ProtectedBranch feature in repositories list
1 parent a8f91d4 commit 7afa52e

File tree

6 files changed

+31
-22
lines changed

6 files changed

+31
-22
lines changed

Diff for: app/helpers/git_hosting_helper.rb

+24-19
Original file line numberDiff line numberDiff line change
@@ -92,46 +92,51 @@ def reldir_add_dotslash(path)
9292

9393

9494
def render_feature(repository, feature)
95-
css_class = 'icon icon-git'
95+
css_class = [ 'icon icon-git' ]
9696

9797
case feature
9898

99-
when :repository_deployment_credentials
100-
label = l(:label_deployment_credentials)
101-
css_class << ' icon-deployment-credentials'
99+
when :deployment_credentials
100+
label = [ l(:label_deployment_credentials) ]
101+
css_class << 'icon-deployment-credentials'
102102
enabled = repository.deployment_credentials.active.any?
103103

104-
when :repository_post_receive_urls
105-
label = l(:label_post_receive_urls)
106-
css_class << ' icon-post-receive-urls'
104+
when :post_receive_urls
105+
label = [ l(:label_post_receive_urls) ]
106+
css_class << 'icon-post-receive-urls'
107107
enabled = repository.post_receive_urls.active.any?
108108

109-
when :repository_mirrors
110-
label = l(:label_repository_mirrors)
111-
css_class << ' icon-mirrors'
109+
when :mirrors
110+
label = [ l(:label_repository_mirrors) ]
111+
css_class << 'icon-mirrors'
112112
enabled = repository.mirrors.active.any?
113113

114114
when :git_daemon
115-
label = l(:label_git_daemon)
116-
css_class << ' icon-git-daemon'
115+
label = [ l(:label_git_daemon) ]
116+
css_class << 'icon-git-daemon'
117117
enabled = (repository.project.is_public && repository.extra[:git_daemon])
118118

119119
when :git_http
120-
label = l(:label_smart_http)
121-
css_class << ' icon-git-smarthttp'
120+
label = [ l(:label_smart_http) ]
121+
css_class << 'icon-git-smarthttp'
122122
enabled = repository.extra[:git_http] != 0
123123

124124
when :git_notify
125-
label = l(:label_git_notify)
126-
css_class << ' icon-git-notify'
125+
label = [ l(:label_git_notify) ]
126+
css_class << 'icon-git-notify'
127127
enabled = repository.extra[:git_notify]
128128

129+
when :protected_branch
130+
label = [ l(:label_protected_branch) ]
131+
css_class << 'icon-git-protected-branch'
132+
enabled = repository.extra[:protected_branch]
133+
129134
end
130135

131-
label << (!enabled ? " (#{l(:label_disabled)})" : '')
132-
css_class << (!enabled ? ' icon-git-disabled' : '')
136+
label << "(#{l(:label_disabled)})" if !enabled
137+
css_class << 'icon-git-disabled' if !enabled
133138

134-
content_tag(:span, '', :title => label, :class => css_class)
139+
content_tag(:span, '', :title => label.join(' '), :class => css_class.join(' '))
135140
end
136141

137142

Diff for: app/views/projects/settings/_repositories.html.erb

+4-3
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@
3535
</td>
3636
<td align="center">
3737
<% if repository.is_a?(Repository::Git) %>
38-
<%= render_feature(repository, :repository_deployment_credentials) %>
39-
<%= render_feature(repository, :repository_post_receive_urls) %>
40-
<%= render_feature(repository, :repository_mirrors) %>
38+
<%= render_feature(repository, :deployment_credentials) %>
39+
<%= render_feature(repository, :post_receive_urls) %>
40+
<%= render_feature(repository, :mirrors) %>
4141
<%= render_feature(repository, :git_daemon) %>
4242
<%= render_feature(repository, :git_http) %>
4343
<%= render_feature(repository, :git_notify) %>
44+
<%= render_feature(repository, :protected_branch) %>
4445
<% end %>
4546
</td>
4647
<td class="buttons">

Diff for: assets/images/locked.png

1013 Bytes
Loading

Diff for: assets/stylesheets/application.css

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ PLUGIN ICONS
1212
.icon-git-daemon { background-image: url("../images/changeset.png"); }
1313
.icon-git-smarthttp { background-image: url("../images/web.png"); }
1414
.icon-git-notify { background-image: url("../images/email.png"); }
15+
.icon-git-protected-branch { background-image: url("../images/locked.png"); }
1516

1617
.icon-git { padding-right: 15px; }
1718
.icon-git-disabled { opacity: 0.5; }

Diff for: config/locales/plugin_interface/en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ en:
222222
label_git_daemon: Git Daemon
223223
label_smart_http: Smart HTTP
224224
label_git_notify: Git Notifications
225+
label_protected_branch: Protected Branches
225226
label_repository_default_branch: Repository default branch
226227
label_init_repo_with_readme: Initialize this repository with a README
227228
label_browse_repository: Browse repository

Diff for: config/locales/plugin_interface/fr.yml

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ fr:
222222
label_git_daemon: Daemon Git
223223
label_smart_http: Smart HTTP
224224
label_git_notify: Notifications Git
225+
label_protected_branch: Branches Protégées
225226
label_repository_default_branch: Branche par défaut
226227
label_init_repo_with_readme: Initialiser le dépôt avec un fichier README
227228
label_browse_repository: Parcourir les sources

0 commit comments

Comments
 (0)