Add linter config reset tooltip

This commit is contained in:
Rob Garrison 2017-08-26 11:03:51 -05:00
parent 1a384142ba
commit cb177eba4b
2 changed files with 13 additions and 3 deletions

View File

@ -539,6 +539,10 @@
"message": "Not saved due to these invalid rules:", "message": "Not saved due to these invalid rules:",
"description": "Invalid linter rules will show a message followed by a list of invalid rules" "description": "Invalid linter rules will show a message followed by a list of invalid rules"
}, },
"setLinterResetMessage": {
"message": "To undo accidental reset, press Ctrl-Z (or Cmd-Z) in the text box",
"description": "Reset button tooltip to inform user on how to undo an accidental reset"
},
"showCSSLintSettings": { "showCSSLintSettings": {
"message": "(Set rules: 0 = disabled; 1 = warning; 2 = error)", "message": "(Set rules: 0 = disabled; 1 = warning; 2 = error)",
"description": "CSSLint rule settings values" "description": "CSSLint rule settings values"

View File

@ -350,8 +350,14 @@ function openStylelintSettings() {
function setupLinterPopup(rules) { function setupLinterPopup(rules) {
const linter = prefs.get('editor.linter'); const linter = prefs.get('editor.linter');
const linterTitle = linter === 'stylelint' ? 'Stylelint' : 'CSSLint'; const linterTitle = linter === 'stylelint' ? 'Stylelint' : 'CSSLint';
function makeButton(className, text) { function makeButton(className, text, options = {}) {
return $element({tag: 'button', className, type: 'button', textContent: t(text), dataset: {linter}}); return $element(Object.assign(options, {
tag: 'button',
className,
type: 'button',
textContent: t(text),
dataset: {linter}
}));
} }
function makeLink(url, textContent) { function makeLink(url, textContent) {
return $element({tag: 'a', target: '_blank', href: url, textContent}); return $element({tag: 'a', target: '_blank', href: url, textContent});
@ -377,7 +383,7 @@ function setupLinterPopup(rules) {
}), }),
makeButton('save', 'styleSaveLabel'), makeButton('save', 'styleSaveLabel'),
makeButton('cancel', 'confirmCancel'), makeButton('cancel', 'confirmCancel'),
makeButton('reset', 'genericResetLabel'), makeButton('reset', 'genericResetLabel', {title: t('setLinterResetMessage')}),
$element({ $element({
tag: 'span', tag: 'span',
className: 'saved-message', className: 'saved-message',