Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed small bug related to issue #2662. #3033

Merged
merged 1 commit into from
Feb 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/vs/workbench/parts/feedback/browser/feedback.ts
Expand Up @@ -99,7 +99,7 @@ export class FeedbackDropdown extends Dropdown {

this.feedbackForm = <HTMLFormElement>$form.getHTMLElement();

$('h2.title').text(nls.localize("label.sendASmile", "Tweet us your feedback")).appendTo($form);
$('h2.title').text(nls.localize("label.sendASmile", "Tweet us your feedback.")).appendTo($form);

this.invoke($('div.cancel').attr('tabindex', '0'), () => {
this.hide();
Expand Down Expand Up @@ -147,7 +147,7 @@ export class FeedbackDropdown extends Dropdown {
$('div').append($('a').attr('target', '_blank').attr('href', this.requestFeatureLink).text(nls.localize("request a missing feature", "Request a missing feature")).attr('tabindex', '0'))
.appendTo($contactUsContainer);

let $charCounter = $('span.char-counter').text('(' + FeedbackDropdown.MAX_FEEDBACK_CHARS + ' ' + nls.localize("characters left", "characters left") + ')');
let $charCounter = $('span.char-counter').text(this.getCharCountText(0));

$('h3').text(nls.localize("tell us why?", "Tell us why?"))
.append($charCounter)
Expand All @@ -160,7 +160,7 @@ export class FeedbackDropdown extends Dropdown {
})
.text(this.feedback).attr('required', 'required')
.on('keyup', () => {
$charCounter.text('(' + (FeedbackDropdown.MAX_FEEDBACK_CHARS - this.feedbackDescriptionInput.value.length) + ' ' + nls.localize("characters left", "characters left") + ')');
$charCounter.text(this.getCharCountText(this.feedbackDescriptionInput.value.length));
this.feedbackDescriptionInput.value ? this.sendButton.removeAttribute('disabled') : this.sendButton.attr('disabled', '');
})
.appendTo($form).domFocus().getHTMLElement();
Expand All @@ -184,6 +184,15 @@ export class FeedbackDropdown extends Dropdown {
};
}

private getCharCountText(charCount: number): string {
let remaining = FeedbackDropdown.MAX_FEEDBACK_CHARS - charCount;
let text = (remaining == 1)
? nls.localize("character left", "character left")
: nls.localize("characters left", "characters left");

return '(' + remaining + ' ' + text + ')';
}

protected setSentiment(smile: boolean): void {
if (smile) {
this.smileyInput.addClass('checked');
Expand Down Expand Up @@ -255,11 +264,11 @@ export class FeedbackDropdown extends Dropdown {
case FormEvent.SENDING:
this.isSendingFeedback = true;
this.sendButton.setClass('send in-progress');
this.sendButton.value(nls.localize('feedbackSending', "Sending..."));
this.sendButton.value(nls.localize('feedbackSending', "Sending"));
break;
case FormEvent.SENT:
this.isSendingFeedback = false;
this.sendButton.setClass('send success').value(nls.localize('feedbackSent', "Thanks :)"));
this.sendButton.setClass('send success').value(nls.localize('feedbackSent', "Thanks"));
this.resetForm();
this.autoHideTimeout = setTimeout(() => {
this.hide();
Expand Down