summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/blob/template_selector.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/blob/template_selector.js')
-rw-r--r--app/assets/javascripts/blob/template_selector.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/assets/javascripts/blob/template_selector.js b/app/assets/javascripts/blob/template_selector.js
index 95352164d76..26852aadea5 100644
--- a/app/assets/javascripts/blob/template_selector.js
+++ b/app/assets/javascripts/blob/template_selector.js
@@ -72,8 +72,13 @@
// To be implemented on the extending class
// e.g.
// Api.gitignoreText item.name, @requestFileSuccess.bind(@)
- TemplateSelector.prototype.requestFileSuccess = function(file, skipFocus) {
- this.editor.setValue(file.content, 1);
+ TemplateSelector.prototype.requestFileSuccess = function(file, skipFocus, append) {
+ var oldValue = this.editor.getValue();
+ var newValue = file.content;
+ if (append && oldValue.length && oldValue !== newValue) {
+ newValue = oldValue + '\n\n' + newValue;
+ }
+ this.editor.setValue(newValue, 1);
if (!skipFocus) this.editor.focus();
if (this.editor instanceof jQuery) {