Commit 7001c914 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Pass access level data to dropdowns

parent 3a343be8
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
gl.ProtectedBranchAccessDropdown = class { gl.ProtectedBranchAccessDropdown = class {
constructor(options) { constructor(options) {
const { $dropdown, onSelect, onHide, accessLevel } = options; const { $dropdown, onSelect, onHide, accessLevel, accessLevelsData } = options;
const self = this; const self = this;
this.accessLevel = accessLevel; this.accessLevel = accessLevel;
this.accessLevelsData = accessLevelsData;
this.$dropdown = $dropdown; this.$dropdown = $dropdown;
this.$wrap = this.$dropdown.parents().eq(1); // TODO: Find a better way to get the wrap element this.$wrap = this.$dropdown.parents().eq(1); // TODO: Find a better way to get the wrap element
this.usersPath = '/autocomplete/users.json'; this.usersPath = '/autocomplete/users.json';
...@@ -85,7 +86,7 @@ ...@@ -85,7 +86,7 @@
return user; return user;
}); });
let mergeAccessLevels = gon.merge_access_levels.map((level) => { let mergeAccessLevels = this.accessLevelsData.map((level) => {
level.type = 'role'; level.type = 'role';
return level; return level;
}); });
......
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
// Allowed to Merge dropdown // Allowed to Merge dropdown
new gl.allowedToMergeDropdown({ new gl.allowedToMergeDropdown({
$dropdown: $allowedToMergeDropdown, $dropdown: $allowedToMergeDropdown,
data: gon.merge_access_levels, accessLevelsData: gon.merge_access_levels,
onSelect: this.onSelectCallback onSelect: this.onSelectCallback
}); });
// Allowed to Push dropdown // Allowed to Push dropdown
new gl.allowedToPushDropdown({ new gl.allowedToPushDropdown({
$dropdown: $allowedToPushDropdown, $dropdown: $allowedToPushDropdown,
data: gon.push_access_levels, accessLevelsData: gon.push_access_levels,
onSelect: this.onSelectCallback onSelect: this.onSelectCallback
}); });
......
...@@ -35,14 +35,16 @@ ...@@ -35,14 +35,16 @@
// Allowed to merge dropdown // Allowed to merge dropdown
new gl.allowedToMergeDropdown({ new gl.allowedToMergeDropdown({
accessLevel: ACCESS_LEVELS.MERGE, accessLevel: ACCESS_LEVELS.MERGE,
accessLevelsData: gon.merge_access_levels,
$dropdown: this.$allowedToMergeDropdown, $dropdown: this.$allowedToMergeDropdown,
onSelect: this.onSelectOption.bind(this), onSelect: this.onSelectOption.bind(this),
onHide: this.onDropdownHide.bind(this), onHide: this.onDropdownHide.bind(this)
}); });
// Allowed to push dropdown // Allowed to push dropdown
new gl.allowedToPushDropdown({ new gl.allowedToPushDropdown({
accessLevel: ACCESS_LEVELS.PUSH, accessLevel: ACCESS_LEVELS.PUSH,
accessLevelsData: gon.push_access_levels,
$dropdown: this.$allowedToPushDropdown, $dropdown: this.$allowedToPushDropdown,
onSelect: this.onSelectOption.bind(this), onSelect: this.onSelectOption.bind(this),
onHide: this.onDropdownHide.bind(this) onHide: this.onDropdownHide.bind(this)
......
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