summaryrefslogtreecommitdiff
path: root/app/views/shared/issuable/_label_dropdown.html.haml
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-07-16 09:32:08 +0100
committerPhil Hughes <me@iamphill.com>2016-07-20 10:48:02 +0100
commit3582861cbcb3e4c80822408c6c31d0de48720813 (patch)
treec9279f21db346ecd2dec801c85bdc79eb0f429d1 /app/views/shared/issuable/_label_dropdown.html.haml
parentbf1d0cbeaefbbf431bc6c5042e7406c9842b5226 (diff)
downloadgitlab-ce-3582861cbcb3e4c80822408c6c31d0de48720813.tar.gz
Fixed label dropdown bugs with pre-selecting the toggle label
Diffstat (limited to 'app/views/shared/issuable/_label_dropdown.html.haml')
-rw-r--r--app/views/shared/issuable/_label_dropdown.html.haml6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/views/shared/issuable/_label_dropdown.html.haml b/app/views/shared/issuable/_label_dropdown.html.haml
index 937dc210193..36a1ac7664e 100644
--- a/app/views/shared/issuable/_label_dropdown.html.haml
+++ b/app/views/shared/issuable/_label_dropdown.html.haml
@@ -14,9 +14,11 @@
- if selected.present?
- if selected.respond_to?('any?')
- - selected = project.labels.find(selected)
+ - selected = project.labels.find_by_id(selected) || selected
- selected.each do |label|
- = hidden_field_tag data_options[:field_name], label.id, id: nil, data: { title: label.title }
+ - id = label.try(:id) || label
+ - title = label.try(:title) || label
+ = hidden_field_tag data_options[:field_name], id, id: nil, data: { title: title }
.dropdown
%button.dropdown-menu-toggle.js-label-select.js-multiselect{class: classes.join(' '), type: "button", data: dropdown_data}
%span.dropdown-toggle-text{ class: ("is-default" if selected.nil?) }