diff options
author | Phil Hughes <me@iamphill.com> | 2016-08-01 14:18:30 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-08-17 17:12:47 +0100 |
commit | 99915931bc420c841801aef47cedd3b4029bd063 (patch) | |
tree | 66aec04fbab2a5a149a5ca309ca5b83a8274e2b4 /app/assets/javascripts/boards/components/new_list_dropdown.js.es6 | |
parent | da64959bde00363d44d1742b742485853cc2c319 (diff) | |
download | gitlab-ce-99915931bc420c841801aef47cedd3b4029bd063.tar.gz |
Moved data holding into models
Diffstat (limited to 'app/assets/javascripts/boards/components/new_list_dropdown.js.es6')
-rw-r--r-- | app/assets/javascripts/boards/components/new_list_dropdown.js.es6 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/app/assets/javascripts/boards/components/new_list_dropdown.js.es6 b/app/assets/javascripts/boards/components/new_list_dropdown.js.es6 new file mode 100644 index 00000000000..0796a95219e --- /dev/null +++ b/app/assets/javascripts/boards/components/new_list_dropdown.js.es6 @@ -0,0 +1,32 @@ +$(() => { + $('.js-new-board-list').each(function () { + const $this = $(this); + + $this.glDropdown({ + data: function(term, callback) { + $.ajax({ + url: $this.attr('data-labels') + }).then((resp) => { + callback(resp); + }); + }, + renderRow: (label) => { + const $li = $('<li />'), + $a = $('<a />', { + text: label.title, + href: '#' + }), + $labelColor = $('<span />', { + class: 'dropdown-label-box', + style: `background-color: ${label.color}` + }); + + return $li.append($a.prepend($labelColor)); + }, + selectable: true, + clicked: (label, $el, e) => { + e.preventDefault(); + } + }); + }); +}); |