about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/ui
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/features/ui')
-rw-r--r--app/assets/javascripts/components/features/ui/components/character_counter.jsx7
-rw-r--r--app/assets/javascripts/components/features/ui/components/compose_form.jsx2
-rw-r--r--app/assets/javascripts/components/features/ui/components/follow_form.jsx8
-rw-r--r--app/assets/javascripts/components/features/ui/containers/follow_form_container.jsx4
4 files changed, 14 insertions, 7 deletions
diff --git a/app/assets/javascripts/components/features/ui/components/character_counter.jsx b/app/assets/javascripts/components/features/ui/components/character_counter.jsx
index dd9218844..f0c1b7c8d 100644
--- a/app/assets/javascripts/components/features/ui/components/character_counter.jsx
+++ b/app/assets/javascripts/components/features/ui/components/character_counter.jsx
@@ -3,15 +3,18 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
 const CharacterCounter = React.createClass({
 
   propTypes: {
-    text: React.PropTypes.string.isRequired
+    text: React.PropTypes.string.isRequired,
+    max: React.PropTypes.number.isRequired
   },
 
   mixins: [PureRenderMixin],
 
   render () {
+    const diff = this.props.max - this.props.text.length;
+
     return (
       <span style={{ fontSize: '16px', cursor: 'default' }}>
-        {this.props.text.length}
+        {diff}
       </span>
     );
   }
diff --git a/app/assets/javascripts/components/features/ui/components/compose_form.jsx b/app/assets/javascripts/components/features/ui/components/compose_form.jsx
index 9453f22ff..5542b4fb4 100644
--- a/app/assets/javascripts/components/features/ui/components/compose_form.jsx
+++ b/app/assets/javascripts/components/features/ui/components/compose_form.jsx
@@ -53,7 +53,7 @@ const ComposeForm = React.createClass({
 
         <div style={{ marginTop: '10px', overflow: 'hidden' }}>
           <div style={{ float: 'right' }}><Button text='Publish' onClick={this.handleSubmit} disabled={this.props.is_submitting} /></div>
-          <div style={{ float: 'right', marginRight: '16px', lineHeight: '36px' }}><CharacterCounter text={this.props.text} /></div>
+          <div style={{ float: 'right', marginRight: '16px', lineHeight: '36px' }}><CharacterCounter max={500} text={this.props.text} /></div>
         </div>
       </div>
     );
diff --git a/app/assets/javascripts/components/features/ui/components/follow_form.jsx b/app/assets/javascripts/components/features/ui/components/follow_form.jsx
index a9d73a9a1..ec108fdb2 100644
--- a/app/assets/javascripts/components/features/ui/components/follow_form.jsx
+++ b/app/assets/javascripts/components/features/ui/components/follow_form.jsx
@@ -3,6 +3,10 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
 
 const FollowForm = React.createClass({
 
+  contextTypes: {
+    router: React.PropTypes.object
+  },
+
   propTypes: {
     text: React.PropTypes.string.isRequired,
     is_submitting: React.PropTypes.bool,
@@ -18,12 +22,12 @@ const FollowForm = React.createClass({
 
   handleKeyUp (e) {
     if (e.keyCode === 13) {
-      this.props.onSubmit();
+      this.handleSubmit();
     }
   },
 
   handleSubmit () {
-    this.props.onSubmit();
+    this.props.onSubmit(this.context.router);
   },
 
   render () {
diff --git a/app/assets/javascripts/components/features/ui/containers/follow_form_container.jsx b/app/assets/javascripts/components/features/ui/containers/follow_form_container.jsx
index a21c1291b..05cfb7c1d 100644
--- a/app/assets/javascripts/components/features/ui/containers/follow_form_container.jsx
+++ b/app/assets/javascripts/components/features/ui/containers/follow_form_container.jsx
@@ -15,8 +15,8 @@ const mapDispatchToProps = function (dispatch) {
       dispatch(changeFollow(text));
     },
 
-    onSubmit: function () {
-      dispatch(submitFollow());
+    onSubmit: function (router) {
+      dispatch(submitFollow(router));
     }
   }
 };