diff options
| author | Joseph Frazier <1212jtraceur@gmail.com> | 2016-09-01 12:44:10 -0400 |
|---|---|---|
| committer | Joseph Frazier <1212jtraceur@gmail.com> | 2016-10-03 12:16:02 -0400 |
| commit | e12f7a3b71a7203397aceb78ba3b27f359a4e072 (patch) | |
| tree | 19790f3e2f1d548888d8359f6741b7271f0aed54 /app/assets/javascripts/blob/template_selector.js | |
| parent | ad2b6cae0b299868eba9f8acf76bafe919408ccd (diff) | |
| download | gitlab-ce-e12f7a3b71a7203397aceb78ba3b27f359a4e072.tar.gz | |
Combine requestFileSuccess arguments into `opts`
See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6149#note_14830172
Diffstat (limited to 'app/assets/javascripts/blob/template_selector.js')
| -rw-r--r-- | app/assets/javascripts/blob/template_selector.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/assets/javascripts/blob/template_selector.js b/app/assets/javascripts/blob/template_selector.js index 26852aadea5..6d41442cdfc 100644 --- a/app/assets/javascripts/blob/template_selector.js +++ b/app/assets/javascripts/blob/template_selector.js @@ -72,14 +72,17 @@ // To be implemented on the extending class // e.g. // Api.gitignoreText item.name, @requestFileSuccess.bind(@) - TemplateSelector.prototype.requestFileSuccess = function(file, skipFocus, append) { + TemplateSelector.prototype.requestFileSuccess = function(file, opts) { var oldValue = this.editor.getValue(); var newValue = file.content; - if (append && oldValue.length && oldValue !== newValue) { + if (opts == null) { + opts = {}; + } + if (opts.append && oldValue.length && oldValue !== newValue) { newValue = oldValue + '\n\n' + newValue; } this.editor.setValue(newValue, 1); - if (!skipFocus) this.editor.focus(); + if (!opts.skipFocus) this.editor.focus(); if (this.editor instanceof jQuery) { this.editor.get(0).dispatchEvent(this.autosizeUpdateEvent); |
