Commit a510791b authored by Clement Ho's avatar Clement Ho

Add label and milestone dropdowns

parent 78b9e7c6
/* eslint-disable no-param-reassign */
/*= require filtered_search/filtered_search_dropdown */
((global) => {
class DropdownLabel extends gl.FilteredSearchDropdown {
constructor(dropdown, input) {
super(dropdown, input);
this.listId = 'js-dropdown-label';
}
itemClicked(e) {
console.log('label clicked');
}
renderContent() {
super.renderContent();
droplab.setData(this.hookId, 'labels.json');
}
}
global.DropdownLabel = DropdownLabel;
})(window.gl || (window.gl = {}));
/* eslint-disable no-param-reassign */
/*= require filtered_search/filtered_search_dropdown */
((global) => {
class DropdownMilestone extends gl.FilteredSearchDropdown {
constructor(dropdown, input) {
super(dropdown, input);
this.listId = 'js-dropdown-milestone';
}
itemClicked(e) {
console.log('milestone clicked');
}
renderContent() {
super.renderContent();
droplab.setData(this.hookId, 'milestones.json');
}
}
global.DropdownMilestone = DropdownMilestone;
})(window.gl || (window.gl = {}));
...@@ -80,6 +80,8 @@ ...@@ -80,6 +80,8 @@
let dropdownHint; let dropdownHint;
let dropdownAuthor; let dropdownAuthor;
let dropdownAssignee; let dropdownAssignee;
let dropdownMilestone;
let dropdownLabel;
class FilteredSearchManager { class FilteredSearchManager {
constructor() { constructor() {
...@@ -116,6 +118,18 @@ ...@@ -116,6 +118,18 @@
} }
dropdownAssignee.render(); dropdownAssignee.render();
} else if (match.key === 'milestone') {
if (!dropdownMilestone) {
dropdownMilestone = new gl.DropdownMilestone(document.querySelector('#js-dropdown-milestone'), document.querySelector('.filtered-search'));
}
dropdownMilestone.render();
} else if (match.key === 'label') {
if (!dropdownLabel) {
dropdownLabel = new gl.DropdownLabel(document.querySelector('#js-dropdown-label'), document.querySelector('.filtered-search'));
}
dropdownLabel.render();
} }
} else if (!match && this.currentDropdown !== 'hint') { } else if (!match && this.currentDropdown !== 'hint') {
......
...@@ -42,6 +42,17 @@ ...@@ -42,6 +42,17 @@
{{name}} {{name}}
%span %span
{{username}} {{username}}
#js-dropdown-milestone.dropdown-menu{ 'data-dropdown' => true }
%ul{ 'data-dynamic' => true }
%li
%button.btn.btn-link
{{title}}
#js-dropdown-label.dropdown-menu{ 'data-dropdown' => true }
%ul{ 'data-dynamic' => true }
%li
%button.btn.btn-link
%span.dropdown-label-box{ 'style': 'background: {{color}}'}
{{title}}
.pull-right .pull-right
- if boards_page - if boards_page
#js-boards-seach.issue-boards-search #js-boards-seach.issue-boards-search
......
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