Commit 553cf9ea authored by James Edwards-Jones's avatar James Edwards-Jones

Added ‘protected’ label and disabled delete button for tags index/show

parent ab46353f
...@@ -21,4 +21,8 @@ module TagsHelper ...@@ -21,4 +21,8 @@ module TagsHelper
html.html_safe html.html_safe
end end
def protected_tag?(project, tag)
project.protected_tag?(tag.name)
end
end end
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
%span.item-title %span.item-title
= icon('tag') = icon('tag')
= tag.name = tag.name
- if protected_tag?(@project, tag)
%span.label.label-success
protected
- if tag.message.present? - if tag.message.present?
   
= strip_gpg_signature(tag.message) = strip_gpg_signature(tag.message)
...@@ -30,5 +35,5 @@ ...@@ -30,5 +35,5 @@
= icon("pencil") = icon("pencil")
- if can?(current_user, :admin_project, @project) - if can?(current_user, :admin_project, @project)
= link_to namespace_project_tag_path(@project.namespace, @project, tag.name), class: 'btn btn-remove remove-row has-tooltip', title: "Delete tag", method: :delete, data: { confirm: "Deleting the '#{tag.name}' tag cannot be undone. Are you sure?", container: 'body' }, remote: true do = link_to namespace_project_tag_path(@project.namespace, @project, tag.name), class: "btn btn-remove remove-row has-tooltip #{protected_tag?(@project, tag) ? 'disabled' : ''}", title: "Delete tag", method: :delete, data: { confirm: "Deleting the '#{tag.name}' tag cannot be undone. Are you sure?", container: 'body' }, remote: true do
= icon("trash-o") = icon("trash-o")
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
.nav-text .nav-text
.title .title
%span.item-title= @tag.name %span.item-title= @tag.name
- if protected_tag?(@project, @tag)
%span.label.label-success
protected
- if @commit - if @commit
= render 'projects/branches/commit', commit: @commit, project: @project = render 'projects/branches/commit', commit: @commit, project: @project
- else - else
...@@ -24,7 +27,7 @@ ...@@ -24,7 +27,7 @@
= render 'projects/buttons/download', project: @project, ref: @tag.name = render 'projects/buttons/download', project: @project, ref: @tag.name
- if can?(current_user, :admin_project, @project) - if can?(current_user, :admin_project, @project)
.btn-container.controls-item-full .btn-container.controls-item-full
= link_to namespace_project_tag_path(@project.namespace, @project, @tag.name), class: 'btn btn-remove remove-row has-tooltip', title: "Delete tag", method: :delete, data: { confirm: "Deleting the '#{@tag.name}' tag cannot be undone. Are you sure?" } do = link_to namespace_project_tag_path(@project.namespace, @project, @tag.name), class: "btn btn-remove remove-row has-tooltip #{protected_tag?(@project, @tag) ? 'disabled' : ''}", title: "Delete tag", method: :delete, data: { confirm: "Deleting the '#{@tag.name}' tag cannot be undone. Are you sure?" } do
%i.fa.fa-trash-o %i.fa.fa-trash-o
- if @tag.message.present? - if @tag.message.present?
......
...@@ -80,7 +80,7 @@ module Gitlab ...@@ -80,7 +80,7 @@ module Gitlab
end end
if !user_access.can_push_tag?(@tag_name) if !user_access.can_push_tag?(@tag_name)
return "You are not allowed to create protected tags on this project." #TODO: Wording, it is a specific tag which you don't have access too, not all protected tags which might have different levels return "You are not allowed to create this tag as it is protected."
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment