BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7664c76a
Unverified
Commit
7664c76a
authored
Oct 21, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed append logic
Updated test
parent
083f9f8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
14 deletions
+7
-14
template_selector.js.es6
app/assets/javascripts/blob/template_selector.js.es6
+1
-6
issuable_template_selector.js.es6
...s/javascripts/templates/issuable_template_selector.js.es6
+5
-7
issuable_templates_spec.rb
spec/features/projects/issuable_templates_spec.rb
+1
-1
No files found.
app/assets/javascripts/blob/template_selector.js.es6
View file @
7664c76a
...
...
@@ -68,14 +68,10 @@
// To be implemented on the extending class
// e.g.
// Api.gitignoreText item.name, @requestFileSuccess.bind(@)
requestFileSuccess(file, { skipFocus
, append
} = {}) {
requestFileSuccess(file, { skipFocus } = {}) {
const oldValue = this.editor.getValue();
let newValue = file.content;
if (append && oldValue.length && oldValue !== newValue) {
newValue = oldValue + '\n\n' + newValue;
}
this.editor.setValue(newValue, 1);
if (!skipFocus) this.editor.focus();
...
...
@@ -99,4 +95,3 @@
global.TemplateSelector = TemplateSelector;
})(window.gl || ( window.gl = {}));
app/assets/javascripts/templates/issuable_template_selector.js.es6
View file @
7664c76a
...
...
@@ -32,24 +32,22 @@
this.currentTemplate = currentTemplate;
if (err) return; // Error handled by global AJAX error handler
this.stopLoadingSpinner();
this.setInputValueToTemplateContent(
true
);
this.setInputValueToTemplateContent();
});
return;
}
setInputValueToTemplateContent(
append
) {
setInputValueToTemplateContent() {
// `this.requestFileSuccess` sets the value of the description input field
// to the content of the template selected. If `append` is true, the
// template content will be appended to the previous value of the field,
// separated by a blank line if the previous value is non-empty.
// to the content of the template selected.
if (this.titleInput.val() === '') {
// If the title has not yet been set, focus the title input and
// skip focusing the description input by setting `true` as the
// `skipFocus` option to `requestFileSuccess`.
this.requestFileSuccess(this.currentTemplate, {skipFocus: true
, append
});
this.requestFileSuccess(this.currentTemplate, {skipFocus: true});
this.titleInput.focus();
} else {
this.requestFileSuccess(this.currentTemplate, {skipFocus: false
, append
});
this.requestFileSuccess(this.currentTemplate, {skipFocus: false});
}
return;
}
...
...
spec/features/projects/issuable_templates_spec.rb
View file @
7664c76a
...
...
@@ -77,7 +77,7 @@ feature 'issuable templates', feature: true, js: true do
scenario
'user selects "bug" template'
do
select_template
'bug'
wait_for_ajax
preview_template
(
"
#{
prior_description
}
\n\n
#{
template_content
}
"
)
preview_template
(
"
#{
template_content
}
"
)
save_changes
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment