Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
18b445ad
Commit
18b445ad
authored
Mar 30, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protected tags can be added/listed via UI
parent
f51eac1d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
10 deletions
+56
-10
app/assets/javascripts/protected_tags/protected_tag_dropdown.js
...sets/javascripts/protected_tags/protected_tag_dropdown.js
+2
-2
app/views/projects/protected_tags/_create_protected_tag.html.haml
...s/projects/protected_tags/_create_protected_tag.html.haml
+2
-2
app/views/projects/protected_tags/_index.html.haml
app/views/projects/protected_tags/_index.html.haml
+1
-1
app/views/projects/protected_tags/_protected_tag.html.haml
app/views/projects/protected_tags/_protected_tag.html.haml
+21
-0
app/views/projects/protected_tags/_tags_list.html.haml
app/views/projects/protected_tags/_tags_list.html.haml
+25
-5
app/views/projects/protected_tags/_update_protected_tag.haml
app/views/projects/protected_tags/_update_protected_tag.haml
+5
-0
No files found.
app/assets/javascripts/protected_tags/protected_tag_dropdown.js
View file @
18b445ad
...
...
@@ -53,9 +53,9 @@ class ProtectedTagDropdown {
getProtectedTags
(
term
,
callback
)
{
if
(
this
.
selectedTag
)
{
callback
(
gon
.
open_
branche
s
.
concat
(
this
.
selectedTag
));
callback
(
gon
.
open_
tag
s
.
concat
(
this
.
selectedTag
));
}
else
{
callback
(
gon
.
open_
branche
s
);
callback
(
gon
.
open_
tag
s
);
}
}
...
...
app/views/projects/protected_tags/_create_protected_tag.html.haml
View file @
18b445ad
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@protected_
branch
],
html:
{
class:
'new_protected_tag'
}
do
|
f
|
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@protected_
tag
],
html:
{
class:
'new_protected_tag'
}
do
|
f
|
.panel.panel-default
.panel-heading
%h3
.panel-title
Protect a tag
.panel-body
.form-horizontal
=
form_errors
(
@protected_
branch
)
=
form_errors
(
@protected_
tag
)
.form-group
=
f
.
label
:name
,
class:
'col-md-2 text-right'
do
Tag:
...
...
app/views/projects/protected_tags/_index.html.haml
View file @
18b445ad
...
...
@@ -6,7 +6,7 @@
%h4
.prepend-top-0
Protected tags
%p
.prepend-top-20
By default, Protected
branche
s are designed to:
By default, Protected
tag
s are designed to:
%ul
%li
Prevent tag pushes from everybody except Masters
%li
Prevent
<strong>
anyone
</strong>
from force pushing to the tag
...
...
app/views/projects/protected_tags/_protected_tag.html.haml
0 → 100644
View file @
18b445ad
%tr
.js-protected-tag-edit-form
{
data:
{
url:
namespace_project_protected_tag_path
(
@project
.
namespace
,
@project
,
protected_tag
)
}
}
%td
=
protected_tag
.
name
-
if
@project
.
root_ref?
(
protected_tag
.
name
)
%span
.label.label-info.prepend-left-5
default
%td
-
if
protected_tag
.
wildcard?
-
matching_tags
=
protected_tag
.
matching
(
repository
.
tags
)
=
link_to
pluralize
(
matching_tags
.
count
,
"matching tag"
),
namespace_project_protected_tag_path
(
@project
.
namespace
,
@project
,
protected_tag
)
-
else
-
if
commit
=
protected_tag
.
commit
=
link_to
(
commit
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
'commit_short_id'
)
=
time_ago_with_tooltip
(
commit
.
committed_date
)
-
else
(tag was removed from repository)
=
render
partial:
'projects/protected_tags/update_protected_tag'
,
locals:
{
protected_tag:
protected_tag
}
-
if
can_admin_project
%td
=
link_to
'Unprotect'
,
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
protected_tag
],
data:
{
confirm:
'tag will be writable for developers. Are you sure?'
},
method: :delete
,
class:
'btn btn-warning'
app/views/projects/protected_tags/_tags_list.html.haml
View file @
18b445ad
.panel.panel-default.protected-tags-list
.panel-heading
%h3
.panel-title
Protected tag (0)
%p
.settings-message.text-center
There are currently no protected tags, protect a tag with the form above.
-
if
@protected_tags
.
empty?
.panel-heading
%h3
.panel-title
Protected tag (
#{
@protected_tags
.
size
}
)
%p
.settings-message.text-center
There are currently no protected tags, protect a tag with the form above.
-
else
-
can_admin_project
=
can?
(
current_user
,
:admin_project
,
@project
)
%table
.table.table-bordered
%colgroup
%col
{
width:
"25%"
}
%col
{
width:
"55%"
}
%col
{
width:
"20%"
}
%thead
%tr
%th
Protected tag (
#{
@protected_tags
.
size
}
)
%th
Last commit
%th
Allowed to push
-
if
can_admin_project
%th
%tbody
=
render
partial:
'projects/protected_tags/protected_tag'
,
collection:
@protected_tags
,
locals:
{
can_admin_project:
can_admin_project
}
=
paginate
@protected_tags
,
theme:
'gitlab'
app/views/projects/protected_tags/_update_protected_tag.haml
0 → 100644
View file @
18b445ad
%td
=
hidden_field_tag
"allowed_to_push_
#{
protected_tag
.
id
}
"
,
protected_tag
.
push_access_levels
.
first
.
access_level
/ = dropdown_tag( (protected_tag.push_access_levels.first.humanize || 'Select') ,
/ options: { toggle_class: 'js-allowed-to-push', dropdown_class: 'dropdown-menu-selectable js-allowed-to-push-container',
/ data: { field_name: "allowed_to_push_#{protected_tag.id}", access_level_id: protected_tag.push_access_levels.first.id }})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment