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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
042afb73
Commit
042afb73
authored
Jul 10, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse shared partials in EE views for protected tags
parent
846d6a93
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
133 deletions
+22
-133
app/assets/javascripts/protected_tags/ee/protected_tag_access_dropdown.js
...cripts/protected_tags/ee/protected_tag_access_dropdown.js
+2
-2
app/views/projects/protected_tags/ee/_create_protected_tag.html.haml
...rojects/protected_tags/ee/_create_protected_tag.html.haml
+11
-35
app/views/projects/protected_tags/ee/_dropdown.html.haml
app/views/projects/protected_tags/ee/_dropdown.html.haml
+0
-15
app/views/projects/protected_tags/ee/_index.html.haml
app/views/projects/protected_tags/ee/_index.html.haml
+5
-21
app/views/projects/protected_tags/ee/_matching_tag.html.haml
app/views/projects/protected_tags/ee/_matching_tag.html.haml
+0
-10
app/views/projects/protected_tags/ee/_protected_tag.html.haml
...views/projects/protected_tags/ee/_protected_tag.html.haml
+1
-21
app/views/projects/protected_tags/ee/_tags_list.html.haml
app/views/projects/protected_tags/ee/_tags_list.html.haml
+3
-29
No files found.
app/assets/javascripts/protected_tags/ee/protected_tag_access_dropdown.js
View file @
042afb73
...
...
@@ -18,8 +18,8 @@ export default class ProtectedTagAccessDropdown {
this
.
$dropdown
=
$dropdown
;
this
.
$wrap
=
this
.
$dropdown
.
closest
(
`.
${
this
.
accessLevel
}
-container`
);
this
.
$protectedTagsContainer
=
$
(
'
.js-protected-tags-container
'
);
this
.
usersPath
=
this
.
$protectedTagsContainer
.
data
(
'
users-autocomplete
'
)
;
this
.
groupsPath
=
this
.
$protectedTagsContainer
.
data
(
'
groups-autocomplete
'
)
;
this
.
usersPath
=
'
/autocomplete/users.json
'
;
this
.
groupsPath
=
'
/autocomplete/project_groups.json
'
;
this
.
defaultLabel
=
this
.
$dropdown
.
data
(
'
defaultLabel
'
);
this
.
setSelectedItems
([]);
...
...
app/views/projects/protected_tags/ee/_create_protected_tag.html.haml
View file @
042afb73
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@protected_tag
],
html:
{
class:
'new-protected-tag js-new-protected-tag'
}
do
|
f
|
.panel.panel-default
.panel-heading
%h3
.panel-title
Protect a tag
.panel-body
.form-horizontal
=
form_errors
(
@protected_tag
)
.form-group
=
f
.
label
:name
,
class:
'col-md-2 text-right'
do
Tag:
.col-md-10.protected-tags-dropdown
=
render
partial:
"projects/protected_tags/ee/dropdown"
,
locals:
{
f:
f
}
.help-block
=
link_to
'Wildcards'
,
help_page_path
(
'user/project/protected_tags'
,
anchor:
'wildcard-protected-tags'
)
such as
%code
v*
or
%code
*-release
are supported
.form-group
%label
.col-md-2.text-right
{
for:
'create_access_levels_attributes'
}
Allowed to create:
.col-md-10
.create_access_levels-container
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-create js-multiselect wide'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable'
,
filter:
true
,
data:
{
input_id:
'create_access_levels_attributes'
,
default_label:
'Select'
}
})
.help-block
Only groups that
=
link_to
'have this project shared'
,
help_page_path
(
'workflow/share_projects_with_other_groups'
)
can be added here
-
content_for
:create_access_levels
do
.create_access_levels-container
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-create js-multiselect wide'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable'
,
filter:
true
,
data:
{
input_id:
'create_access_levels_attributes'
,
default_label:
'Select'
}
})
.help-block
Only groups that
=
link_to
'have this project shared'
,
help_page_path
(
'workflow/share_projects_with_other_groups'
)
can be added here
.panel-footer
=
f
.
submit
'Protect'
,
class:
'btn-create btn'
,
disabled:
true
=
render
'projects/protected_tags/shared/create_protected_tag'
app/views/projects/protected_tags/ee/_dropdown.html.haml
deleted
100644 → 0
View file @
846d6a93
=
f
.
hidden_field
(
:name
)
=
dropdown_tag
(
'Select tag or create wildcard'
,
options:
{
toggle_class:
'js-protected-tag-select js-filter-submit wide git-revision-dropdown-toggle'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable capitalize-header git-revision-dropdown"
,
placeholder:
"Search protected tags"
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
show_upcoming:
true
,
selected:
params
[
:protected_tag_name
],
project_id:
@project
.
try
(
:id
)
}
})
do
%ul
.dropdown-footer-list
%li
%button
{
class:
"create-new-protected-tag-button js-create-new-protected-tag"
,
title:
"New Protected Tag"
}
Create wildcard
%code
app/views/projects/protected_tags/ee/_index.html.haml
View file @
042afb73
-
expanded
=
Rails
.
env
.
test?
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_bundle_tag
(
'ee_protected_tags'
)
%section
.settings.js-protected-tags-container
{
data:
{
"groups-autocomplete"
=>
"#{autocomplete_project_groups_path(format: :json)}"
,
"users-autocomplete"
=>
"#{autocomplete_users_path(format: :json)}"
}
}
.settings-header
%h4
Protected Tags
%button
.btn.js-settings-toggle
=
expanded
?
'Collapse'
:
'Expand'
%p
Limit access to creating and updating tags.
.settings-content.no-animate
{
class:
(
'expanded'
if
expanded
)
}
%p
By default, protected tags are designed to:
%ul
%li
Prevent tag creation by everybody except Masters
%li
Prevent
<strong>
anyone
</strong>
from updating the tag
%li
Prevent
<strong>
anyone
</strong>
from deleting the tag
-
content_for
:create_protected_tag
do
=
render
'projects/protected_tags/ee/create_protected_tag'
%p
Read more about
#{
link_to
"protected tags"
,
help_page_path
(
"user/project/protected_tags"
),
class:
"underlined-link"
}
.
-
content_for
:tag_list
do
=
render
"projects/protected_tags/ee/tags_list"
-
if
can?
current_user
,
:admin_project
,
@project
=
render
'projects/protected_tags/ee/create_protected_tag'
=
render
"projects/protected_tags/ee/tags_list"
=
render
'projects/protected_tags/shared/index'
app/views/projects/protected_tags/ee/_matching_tag.html.haml
deleted
100644 → 0
View file @
846d6a93
%tr
%td
=
link_to
matching_tag
.
name
,
project_ref_path
(
@project
,
matching_tag
.
name
),
class:
'ref-name'
-
if
@project
.
root_ref?
(
matching_tag
.
name
)
%span
.label.label-info.prepend-left-5
default
%td
-
commit
=
@project
.
commit
(
matching_tag
.
name
)
=
link_to
(
commit
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
'commit-sha'
)
=
time_ago_with_tooltip
(
commit
.
committed_date
)
app/views/projects/protected_tags/ee/_protected_tag.html.haml
View file @
042afb73
%tr
.js-protected-tag-edit-form
{
data:
{
url:
namespace_project_protected_tag_path
(
@project
.
namespace
,
@project
,
protected_tag
)
}
}
%td
%span
.ref-name
=
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-sha'
)
=
time_ago_with_tooltip
(
commit
.
committed_date
)
-
else
(tag was removed from repository)
=
render
layout:
'projects/protected_tags/shared/protected_tag'
,
locals:
{
protected_tag:
protected_tag
}
do
=
render
partial:
'projects/protected_tags/ee/protected_tag_access_summary'
,
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/ee/_tags_list.html.haml
View file @
042afb73
.panel.panel-default.protected-tags-list
-
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
)
-
can_admin_project
=
can?
(
current_user
,
:admin_project
,
@project
)
%table
.table.table-bordered
%colgroup
%col
{
width:
"25%"
}
%col
{
width:
"25%"
}
%col
{
width:
"50%"
}
-
if
can_admin_project
%col
%thead
%tr
%th
Protected tag (
#{
@protected_tags
.
size
}
)
%th
Last commit
%th
Allowed to create
-
if
can_admin_project
%th
%tbody
%tr
%td
.flash-container
{
colspan:
4
}
=
render
partial:
'projects/protected_tags/ee/protected_tag'
,
collection:
@protected_tags
,
locals:
{
can_admin_project:
can_admin_project
}
=
paginate
@protected_tags
,
theme:
'gitlab'
=
render
layout:
'projects/protected_tags/shared/tags_list'
do
=
render
partial:
'projects/protected_tags/ee/protected_tag'
,
collection:
@protected_tags
,
locals:
{
can_admin_project:
can_admin_project
}
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