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
75ac9804
Commit
75ac9804
authored
Aug 17, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set dropdowns for protected branches list
[ci skip]
parent
304fc4ae
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
17 deletions
+28
-17
app/assets/javascripts/protected_branch_access_dropdown.js.es6
...ssets/javascripts/protected_branch_access_dropdown.js.es6
+4
-0
app/assets/javascripts/protected_branch_edit.js.es6
app/assets/javascripts/protected_branch_edit.js.es6
+2
-2
app/views/projects/protected_branches/_access_level_dropdown.html.haml
...jects/protected_branches/_access_level_dropdown.html.haml
+13
-0
app/views/projects/protected_branches/_branches_list.html.haml
...iews/projects/protected_branches/_branches_list.html.haml
+5
-4
app/views/projects/protected_branches/_create_protected_branch.html.haml
...cts/protected_branches/_create_protected_branch.html.haml
+2
-2
app/views/projects/protected_branches/_protected_branch.html.haml
...s/projects/protected_branches/_protected_branch.html.haml
+0
-3
app/views/projects/protected_branches/_protected_branch_access_summary.html.haml
...ected_branches/_protected_branch_access_summary.html.haml
+2
-6
No files found.
app/assets/javascripts/protected_branch_access_dropdown.js.es6
View file @
75ac9804
...
...
@@ -26,6 +26,10 @@
// Here because last selected item is not considered after first close
this.activeIds = self.getActiveIds();
},
setActiveIds() {
// Needed for pre select options
this.activeIds = self.getActiveIds();
},
clicked(item, $el, e) {
e.preventDefault();
self.inputCount++;
...
...
app/assets/javascripts/protected_branch_edit.js.es6
View file @
75ac9804
...
...
@@ -13,14 +13,14 @@
buildDropdowns() {
// Allowed to merge dropdown
new gl.
ProtectedBranchAccess
Dropdown({
new gl.
allowedToMerge
Dropdown({
$dropdown: this.$allowedToMergeDropdown,
data: gon.merge_access_levels,
onSelect: this.onSelect.bind(this)
});
// Allowed to push dropdown
new gl.
ProtectedBranchAccess
Dropdown({
new gl.
allowedToPush
Dropdown({
$dropdown: this.$allowedToPushDropdown,
data: gon.push_access_levels,
onSelect: this.onSelect.bind(this)
...
...
app/views/projects/protected_branches/_access_level_dropdown.html.haml
0 → 100644
View file @
75ac9804
-
if
access_levels
.
present?
-
access_levels
.
map
.
with_index
do
|
level
,
i
|
-
if
(
level
.
type
==
:user
)
-
fieldKey
=
'user_id'
-
value
=
level
.
user_id
-
else
-
fieldKey
=
'access_level'
-
value
=
level
.
access_level
%input
{
type:
'hidden'
,
name:
"protected_branch[#{input_basic_name}][#{i}][#{fieldKey}]"
,
value:
value
,
data:
{
type:
level
.
type
}
}
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
"
#{
toggle_class
}
js-multiselect"
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable'
,
filter:
true
,
data:
{
input_id:
input_basic_name
,
default_label:
'Select'
}
})
app/views/projects/protected_branches/_branches_list.html.haml
View file @
75ac9804
...
...
@@ -10,17 +10,18 @@
%table
.table.table-bordered
%colgroup
%col
{
width:
"25%"
}
%col
{
width:
"30%"
}
%col
{
width:
"25%"
}
%col
{
width:
"20%"
}
%col
{
width:
"20%"
}
%col
{
width:
"20%"
}
%col
{
width:
"20%"
}
-
if
can_admin_project
%col
%thead
%tr
%th
Protected branch (
#{
@protected_branches
.
size
}
)
%th
Last commit
%th
Allowed to merge
%th
Allowed to push
%th
-
if
can_admin_project
%th
%tbody
...
...
app/views/projects/protected_branches/_create_protected_branch.html.haml
View file @
75ac9804
...
...
@@ -24,14 +24,14 @@
.col-md-10
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-merge wide js-multiselect'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable'
,
filter:
true
,
data:
{
input_id:
'merge_access_levels_attributes'
,
default_label:
'Select'
}})
data:
{
input_id:
'merge_access_levels_attributes'
,
default_label:
'Select'
}
})
.form-group
%label
.col-md-2.text-right
{
for:
'push_access_levels_attributes'
}
Allowed to push:
.col-md-10
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-push wide js-multiselect'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable'
,
filter:
true
,
data:
{
input_id:
'push_access_levels_attributes'
,
default_label:
'Select'
}})
data:
{
input_id:
'push_access_levels_attributes'
,
default_label:
'Select'
}
})
.panel-footer
=
f
.
submit
'Protect'
,
class:
'btn-create btn'
,
disabled:
true
app/views/projects/protected_branches/_protected_branch.html.haml
View file @
75ac9804
...
...
@@ -16,9 +16,6 @@
=
render
partial:
'protected_branch_access_summary'
,
locals:
{
protected_branch:
protected_branch
}
%td
=
link_to
"Settings"
,
namespace_project_protected_branch_path
(
@project
.
namespace
,
@project
,
protected_branch
),
class:
"btn btn-info"
-
if
can_admin_project
%td
=
link_to
'Unprotect'
,
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
protected_branch
],
data:
{
confirm:
'Branch will be writable for developers. Are you sure?'
},
method: :delete
,
class:
'btn btn-warning'
app/views/projects/protected_branches/_protected_branch_access_summary.html.haml
View file @
75ac9804
%td
-
access_by_type
=
protected_branch
.
merge_access_level_frequencies
-
tooltip_text
=
protected_branch
.
merge_access_levels
.
map
{
|
access_level
|
"<li>
#{
access_level
.
humanize
}
</li>"
}.
join
%span
.has-tooltip
{
title:
tooltip_text
,
data:
{
container:
"body"
,
html:
1
}
}=
[
pluralize
(
access_by_type
[
:user
],
'user'
),
pluralize
(
access_by_type
[
:role
],
'role'
)].
to_sentence
=
render
partial:
'access_level_dropdown'
,
locals:
{
protected_branch:
protected_branch
,
access_levels:
protected_branch
.
merge_access_levels
,
input_basic_name:
'merge_access_levels_attributes'
,
toggle_class:
'js-allowed-to-merge'
}
%td
-
access_by_type
=
protected_branch
.
push_access_level_frequencies
-
tooltip_text
=
protected_branch
.
push_access_levels
.
map
{
|
access_level
|
"<li>
#{
access_level
.
humanize
}
</li>"
}.
join
%span
.has-tooltip
{
title:
tooltip_text
,
data:
{
container:
"body"
,
html:
1
}
}=
[
pluralize
(
access_by_type
[
:user
],
'user'
),
pluralize
(
access_by_type
[
:role
],
'role'
)].
to_sentence
=
render
partial:
'access_level_dropdown'
,
locals:
{
protected_branch:
protected_branch
,
access_levels:
protected_branch
.
push_access_levels
,
input_basic_name:
'push_access_levels_attributes'
,
toggle_class:
'js-allowed-to-push'
}
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