Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clear tweet text on submit.

  • Loading branch information...
commit d45269258412fc093e12cf47d8e763d8b9175e16 1 parent 9e9ba3f
@paulmillr paulmillr authored
Showing with 10 additions and 5 deletions.
  1. +5 −2 app/views/sidebar_view.coffee
  2. +5 −3 public/javascripts/app.js
View
7 app/views/sidebar_view.coffee
@@ -27,6 +27,7 @@ module.exports = class SidebarView extends View
@model = null
@render()
+ # TODO: move this to separate view.
updateCharacterCount: (event) =>
max = 140
$charCount = @$('.composable-tweet-character-count')
@@ -43,7 +44,9 @@ module.exports = class SidebarView extends View
$send.removeAttr 'disabled'
createTweet: (event) =>
+ $textEl = @$('.composable-tweet-text')
api = mediator.user.get('provider').api
- text = @$('.composable-tweet-text').val()
+ text = $textEl.val()
api.updateStatus text, (tweet) =>
- console.log 'New tweet:', tweet
+ console.debug 'New tweet:', tweet
+ $textEl.val('')
View
8 public/javascripts/app.js
@@ -2303,12 +2303,14 @@
};
SidebarView.prototype.createTweet = function(event) {
- var api, text,
+ var $textEl, api, text,
_this = this;
+ $textEl = this.$('.composable-tweet-text');
api = mediator.user.get('provider').api;
- text = this.$('.composable-tweet-text').val();
+ text = $textEl.val();
return api.updateStatus(text, function(tweet) {
- return console.log('New tweet:', tweet);
+ console.debug('New tweet:', tweet);
+ return $textEl.val('');
});
};
Please sign in to comment.
Something went wrong with that request. Please try again.