diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-09-06 21:59:20 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-09-06 21:59:20 +0300 |
commit | c67d2f46dd24d6f2bfc0d64ed62a4a6b47f1fcc0 (patch) | |
tree | 561c683e8058870e447357f618eaf292cde3da95 | |
parent | e485e601c244d45b1d23c5fa3da9332fa4cec50f (diff) |
fieldName can’t be a function
Restore changes introduced in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/581
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index e3f672d6794..8714ddb3136 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -488,7 +488,7 @@ } else { if (!selected) { value = this.options.id ? this.options.id(data) : data.id; - fieldName = typeof this.options.fieldName === 'function' ? this.options.fieldName() : this.options.fieldName; + fieldName = this.options.fieldName; field = this.dropdown.parent().find("input[name='" + fieldName + "'][value='" + value + "']"); if (field.length) { @@ -546,6 +546,7 @@ GitLabDropdown.prototype.rowClicked = function(el) { var field, fieldName, groupName, isInput, selectedIndex, selectedObject, value; + fieldName = this.options.fieldName; isInput = $(this.el).is('input'); if (this.renderedData) { groupName = el.data('group'); @@ -557,7 +558,6 @@ selectedObject = this.renderedData[selectedIndex]; } } - fieldName = typeof this.options.fieldName === 'function' ? this.options.fieldName(selectedObject) : this.options.fieldName; value = this.options.id ? this.options.id(selectedObject, el) : selectedObject.id; if (isInput) { field = $(this.el); @@ -609,9 +609,6 @@ if (this.options.inputId != null) { $input.attr('id', this.options.inputId); } - if (selectedObject && selectedObject.type) { - $input.attr('data-type', selectedObject.type); - } return this.dropdown.before($input); }; |