Scrollo is a full-stack web application inspired by Tumblr, a microblogging website that allow users to express themselves by creating content in the form of multimedia posts. This application is built with React, Redux, Ruby on Rails, and PostgreSQL.
Users can create posts of different types (text, photo, quote, link, audio, and video) from their dashboard. The user can select a post type from the post navigation bar and a post form that is tailored to that post type becomes available.
```js
```js
```js postImage(url) { this.setState({ ["source"]: url }); } uploadImage(e) { e.preventDefault(); window.postImage = this.postImage.bind(this); window.cloudinary.openUploadWidget( window.cloudinary_options, function(errors, result){ window.postImage(result[0].url); } ); } ```
```js deleteButtonVisible() { if (this.props.currentUser.id === this.props.post.author_id) { return ( ); } else { return ( ); } } editButtonVisible(postType) { if (this.props.currentUser.id === this.props.post.author_id) { return ( ); } else { return (
```js class FollowUsersIndex extends React.Component { constructor(props) { super(props); } componentDidMount() { this.props.fetchFollowUsers(); } render() { return (
```js likePost() { if (!this.props.liked) { this.props.createLike(this.props.post.id); } else { this.props.deleteLike(this.props.post.id); } } ```
```js const mapStateToProps = (state, ownProps) => { if (ownProps.match.path === "/dashboard/edit/text/:postId") { return ({ post: state.entities.posts[ownProps.match.params.postId], actionButton: "Edit" }); } else { return ({ post: {}, actionButton: "Post" }); } }; ```
```js const mapDispatchToProps = (dispatch, ownProps) => { let actionPost = ownProps.match.path === "/dashboard/edit/text/:postId" ? updatePost : createPost; return { actionPost: (post) => dispatch(actionPost(post)) }; }; ```