Bounce the popup tips again when you click submit button again

This commit is contained in:
Neil Lalonde 2013-05-27 11:51:27 -04:00
parent 1879176e80
commit 8b0b77c161
3 changed files with 19 additions and 17 deletions

View File

@ -41,9 +41,9 @@ Discourse.ComposerController = Discourse.Controller.extend({
composer = this.get('content');
if( composer.get('cantSubmitPost') ) {
this.set('view.showTitleTip', true);
this.set('view.showCategoryTip', true);
this.set('view.showReplyTip', true);
this.set('view.showTitleTip', Date.now());
this.set('view.showCategoryTip', Date.now());
this.set('view.showReplyTip', Date.now());
return;
}

View File

@ -35,13 +35,13 @@
<div class="title-input">
{{textField value=content.title tabindex="2" id="reply-title" maxlength="255" class="span8" placeholderKey="composer.title_placeholder"}}
{{popupInputTip validation=view.titleValidation show=view.showTitleTip}}
{{popupInputTip validation=view.titleValidation shownAt=view.showTitleTip}}
</div>
{{#unless content.creatingPrivateMessage}}
<div class="category-input">
{{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" valueBinding="content.categoryName" showUncategorized="true"}}
{{popupInputTip validation=view.categoryValidation show=view.showCategoryTip}}
{{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
</div>
{{#if content.archetype.hasOptions}}
<button class='btn' {{action showOptions}}>{{i18n topic.options}}</button>
@ -61,7 +61,7 @@
<div class='textarea-wrapper'>
<div class='wmd-button-bar' id='wmd-button-bar'></div>
{{view Discourse.NotifyingTextArea parentBinding="view" tabindex="3" valueBinding="content.reply" id="wmd-input" placeholderKey="composer.reply_placeholder"}}
{{popupInputTip validation=view.replyValidation show=view.showReplyTip}}
{{popupInputTip validation=view.replyValidation shownAt=view.showReplyTip}}
</div>
<div class='preview-wrapper'>
<div id='wmd-preview' {{bindAttr class="hidePreview:hidden"}}></div>

View File

@ -12,7 +12,7 @@
**/
Discourse.PopupInputTipView = Discourse.View.extend({
templateName: 'popup_input_tip',
classNameBindings: [':popup-tip', 'good', 'bad', 'show::hide'],
classNameBindings: [':popup-tip', 'good', 'bad', 'shownAt::hide'],
animateAttribute: null,
bouncePixels: 6,
bounceDelay: 100,
@ -26,20 +26,22 @@ Discourse.PopupInputTipView = Discourse.View.extend({
}.property('validation'),
hide: function() {
this.set('show', false);
this.set('shownAt', false);
},
bounce: function() {
var $elem = this.$()
if( !this.animateAttribute ) {
this.animateAttribute = $elem.css('left') === 'auto' ? 'right' : 'left';
if( this.get('shownAt') ) {
var $elem = this.$()
if( !this.animateAttribute ) {
this.animateAttribute = $elem.css('left') === 'auto' ? 'right' : 'left';
}
if( this.animateAttribute === 'left' ) {
this.bounceLeft($elem);
} else {
this.bounceRight($elem);
}
}
if( this.animateAttribute === 'left' ) {
this.bounceLeft($elem);
} else {
this.bounceRight($elem);
}
}.observes('show'),
}.observes('shownAt'),
bounceLeft: function($elem) {
for( var i = 0; i < 5; i++ ) {