diff --git a/app/assets/javascripts/components/actions/statuses.jsx b/app/assets/javascripts/components/actions/statuses.jsx
index 21821b8ba1..fece257d58 100644
--- a/app/assets/javascripts/components/actions/statuses.jsx
+++ b/app/assets/javascripts/components/actions/statuses.jsx
@@ -1,5 +1,8 @@
+import fetch from 'isomorphic-fetch'
+
export const SET_TIMELINE = 'SET_TIMELINE';
export const ADD_STATUS = 'ADD_STATUS';
+export const PUBLISH = 'PUBLISH';
export function setTimeline(timeline, statuses) {
return {
@@ -16,3 +19,15 @@ export function addStatus(timeline, status) {
status: status
};
}
+
+export function publish(text, in_reply_to_id) {
+ return function (dispatch) {
+ return fetch('/api/statuses', {
+ method: 'POST'
+ }).then(function (response) {
+ return response.json();
+ }).then(function (json) {
+ console.log(json);
+ });
+ };
+}
diff --git a/app/assets/javascripts/components/components/button.jsx b/app/assets/javascripts/components/components/button.jsx
new file mode 100644
index 0000000000..b2d7ba9a9e
--- /dev/null
+++ b/app/assets/javascripts/components/components/button.jsx
@@ -0,0 +1,22 @@
+const Button = React.createClass({
+ propTypes: {
+ text: React.PropTypes.string.isRequired,
+ onClick: React.PropTypes.func
+ },
+
+ handleClick (e) {
+ e.preventDefault();
+ this.props.onClick();
+ },
+
+ render () {
+ return (
+
+ {this.props.text}
+
+ );
+ }
+
+});
+
+export default Button;
diff --git a/app/assets/javascripts/components/components/character_counter.jsx b/app/assets/javascripts/components/components/character_counter.jsx
new file mode 100644
index 0000000000..b58d9fe321
--- /dev/null
+++ b/app/assets/javascripts/components/components/character_counter.jsx
@@ -0,0 +1,16 @@
+const CharacterCounter = React.createClass({
+ propTypes: {
+ text: React.PropTypes.string.isRequired
+ },
+
+ render () {
+ return (
+
+ {this.props.text.length}
+
+ );
+ }
+
+});
+
+export default CharacterCounter;
diff --git a/app/assets/javascripts/components/components/column.jsx b/app/assets/javascripts/components/components/column.jsx
index c585b6b0b8..c1f5b84a26 100644
--- a/app/assets/javascripts/components/components/column.jsx
+++ b/app/assets/javascripts/components/components/column.jsx
@@ -8,7 +8,7 @@ const Column = React.createClass({
render: function() {
return (
-
+
diff --git a/app/assets/javascripts/components/components/composer_drawer.jsx b/app/assets/javascripts/components/components/composer_drawer.jsx
new file mode 100644
index 0000000000..d33e28219b
--- /dev/null
+++ b/app/assets/javascripts/components/components/composer_drawer.jsx
@@ -0,0 +1,46 @@
+import CharacterCounter from './character_counter';
+import Button from './button';
+import { publish } from '../actions/statuses';
+
+const ComposerDrawer = React.createClass({
+
+ propTypes: {
+ onSubmit: React.PropTypes.func.isRequired
+ },
+
+ getInitialState() {
+ return {
+ text: ''
+ };
+ },
+
+ handleChange (e) {
+ this.setState({ text: e.target.value });
+ },
+
+ handleKeyUp (e) {
+ if (e.keyCode === 13 && e.ctrlKey) {
+ this.handleSubmit();
+ }
+ },
+
+ handleSubmit () {
+ this.props.onSubmit(this.state.text, null);
+ },
+
+ render () {
+ return (
+
+ );
+ }
+
+});
+
+export default ComposerDrawer;
diff --git a/app/assets/javascripts/components/components/display_name.jsx b/app/assets/javascripts/components/components/display_name.jsx
index 97db317078..9faefba678 100644
--- a/app/assets/javascripts/components/components/display_name.jsx
+++ b/app/assets/javascripts/components/components/display_name.jsx
@@ -11,7 +11,7 @@ const DisplayName = React.createClass({
var url = this.props.account.get('url');
return (
-
+
{displayName} {acct}
);
diff --git a/app/assets/javascripts/components/components/frontend.jsx b/app/assets/javascripts/components/components/frontend.jsx
index 6f9c46fa90..01ad3490a7 100644
--- a/app/assets/javascripts/components/components/frontend.jsx
+++ b/app/assets/javascripts/components/components/frontend.jsx
@@ -1,5 +1,6 @@
-import NavBar from './nav_bar';
-import ColumnsArea from './columns_area';
+import NavBar from './nav_bar';
+import ColumnsArea from './columns_area';
+import ComposerDrawerContainer from '../containers/composer_drawer_container';
const Frontend = React.createClass({
@@ -7,6 +8,7 @@ const Frontend = React.createClass({
return (
+
);
diff --git a/app/assets/javascripts/components/components/nav_bar.jsx b/app/assets/javascripts/components/components/nav_bar.jsx
index 1ece3cc34a..f3f6768e6b 100644
--- a/app/assets/javascripts/components/components/nav_bar.jsx
+++ b/app/assets/javascripts/components/components/nav_bar.jsx
@@ -1,7 +1,11 @@
const NavBar = React.createClass({
render: function() {
- return
;
+ return (
+
+
+
+ );
}
});
diff --git a/app/assets/javascripts/components/components/relative_timestamp.jsx b/app/assets/javascripts/components/components/relative_timestamp.jsx
index 3216d0a0d3..49158ee130 100644
--- a/app/assets/javascripts/components/components/relative_timestamp.jsx
+++ b/app/assets/javascripts/components/components/relative_timestamp.jsx
@@ -12,7 +12,7 @@ moment.updateLocale('en', {
d: "a day",
dd: "%dd",
M: "a month",
- MM: "%dm",
+ MM: "%dmo",
y: "a year",
yy: "%dy"
}
diff --git a/app/assets/javascripts/components/components/status.jsx b/app/assets/javascripts/components/components/status.jsx
index e54bc8c042..bb518a9e1f 100644
--- a/app/assets/javascripts/components/components/status.jsx
+++ b/app/assets/javascripts/components/components/status.jsx
@@ -13,7 +13,7 @@ const Status = React.createClass({
var status = this.props.status;
return (
-
+
diff --git a/app/assets/javascripts/components/containers/composer_drawer_container.jsx b/app/assets/javascripts/components/containers/composer_drawer_container.jsx
new file mode 100644
index 0000000000..4ec0f1c506
--- /dev/null
+++ b/app/assets/javascripts/components/containers/composer_drawer_container.jsx
@@ -0,0 +1,17 @@
+import { connect } from 'react-redux';
+import ComposerDrawer from '../components/composer_drawer';
+import { publish } from '../actions/statuses';
+
+const mapStateToProps = function (state, props) {
+ return {};
+};
+
+const mapDispatchToProps = function (dispatch) {
+ return {
+ onSubmit: function (text, in_reply_to_id) {
+ dispatch(publish(text, in_reply_to_id));
+ }
+ }
+};
+
+export default connect(mapStateToProps, mapDispatchToProps)(ComposerDrawer);
diff --git a/app/assets/javascripts/components/store/configureStore.jsx b/app/assets/javascripts/components/store/configureStore.jsx
index bb5d664d02..9ff28bb42b 100644
--- a/app/assets/javascripts/components/store/configureStore.jsx
+++ b/app/assets/javascripts/components/store/configureStore.jsx
@@ -1,6 +1,7 @@
-import { createStore } from 'redux';
+import { createStore, applyMiddleware } from 'redux';
+import thunk from 'redux-thunk';
import appReducer from '../reducers';
-export default function configureStore(initialState) {
- return createStore(appReducer, initialState);
+export default function configureStore() {
+ return createStore(appReducer, applyMiddleware(thunk));
}
diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb
index f36445942e..cf320c557d 100644
--- a/config/initializers/doorkeeper.rb
+++ b/config/initializers/doorkeeper.rb
@@ -4,7 +4,7 @@ Doorkeeper.configure do
# This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do
- current_user || redirect_to(new_user_session_url)
+ current_user || warden.authenticate!(scope: :user)
end
resource_owner_from_credentials do |routes|
diff --git a/package.json b/package.json
index ae590c3a73..19f0ac0165 100644
--- a/package.json
+++ b/package.json
@@ -11,11 +11,14 @@
"redux-devtools": "^3.3.1"
},
"dependencies": {
+ "es6-promise": "^3.2.1",
"immutable": "^3.8.1",
+ "isomorphic-fetch": "^2.2.1",
"moment": "^2.14.1",
"react-immutable-proptypes": "^2.1.0",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
- "redux-immutable": "^3.0.8"
+ "redux-immutable": "^3.0.8",
+ "redux-thunk": "^2.1.0"
}
}