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
9a23da2d
Commit
9a23da2d
authored
Aug 17, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set default label when unselecting all options
[ci skip]
parent
02da2b40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
app/assets/javascripts/protected_branch_access_dropdown.js.es6
...ssets/javascripts/protected_branch_access_dropdown.js.es6
+8
-4
app/views/projects/protected_branches/_create_protected_branch.html.haml
...cts/protected_branches/_create_protected_branch.html.haml
+2
-2
No files found.
app/assets/javascripts/protected_branch_access_dropdown.js.es6
View file @
9a23da2d
...
...
@@ -9,6 +9,7 @@
this.$dropdown = $dropdown;
this.usersPath = '/autocomplete/users.json';
this.inputCount = 0;
this.defaultLabel = this.$dropdown.data('defaultLabel');
$dropdown.glDropdown({
selectable: true,
...
...
@@ -28,7 +29,6 @@
e.preventDefault();
self.inputCount++;
onSelect();
return;
}
});
}
...
...
@@ -46,9 +46,13 @@
let types = _.groupBy(currentItems, (item) => { return item.dataset.type; });
let label = [];
_.allKeys(types).map((type) => {
label.push(`${types[type].length} ${type}`);
});
if (_.isEmpty(types)) {
label.push(this.defaultLabel);
} else {
_.allKeys(types).map((type) => {
label.push(`${types[type].length} ${type}`);
});
}
return label.join(' and ');
}
...
...
app/views/projects/protected_branches/_create_protected_branch.html.haml
View file @
9a23da2d
...
...
@@ -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'
}})
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'
}})
data:
{
input_id:
'push_access_levels_attributes'
,
default_label:
'Select'
}})
.panel-footer
=
f
.
submit
'Protect'
,
class:
'btn-create btn'
,
disabled:
true
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