Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
oiahoon committed Dec 18, 2017
2 parents f4e000c + b214d02 commit 3a30390
Show file tree
Hide file tree
Showing 31 changed files with 9,510 additions and 37 deletions.
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2017 Joey Huang

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
75 changes: 69 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,75 @@
# rails-poker
scrum poker in rails5, docker-compose
## rails-poker
[![Code Climate](https://codeclimate.com/github/cdphp/rails-poker/badges/gpa.svg)](https://codeclimate.com/github/cdphp/rails-poker)
[![Build Status](https://travis-ci.org/cdphp/rails-poker.svg?branch=master)](https://travis-ci.org/cdphp/rails-poker)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fcdphp%2Frails-poker.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fcdphp%2Frails-poker?ref=badge_shield)
---
## info
rails poker is a rails 5 based project.</br>
and include a chatroom in it ;)</br>
I start the project with a purpose to buid a demo for **rails5 + actioncable + reactjs**</br>
i can't stop my keybord while i found much fun with it!</br>
then i extend the actioncable demo to a nice chating app</br>
and build a internal use online srum-poker app</br>

I think this will help someone who is interested in actioncable and reactjs,</br>
maybe this can be the starting example.
## demo
[Chat room](http://poker.miaowu.org/)</br>
[scum poker](http://poker.miaowu.org/usersessions/new)</br>

## FEATURES
- **Chat Room**
> 1. random displayname by session, everyday changes, very interesting
> 2. user join/quit staus(some problem with the quit)
> 3. some mark-down support
> 4. send image by url
> 5. kamoji support
- **Scrum Poker**
> 1. create room and send the url to participants
> 2. subject can change every turn
> 3. organizer can switch the room status, **ready** -> **start poking** -> **draw result**
> 4. the participants status will be showed on the right
 > 5. the result will showing as a pie chart

## Support

For support please create an issue here at GitHub

## Pull Requests

Feel free to submit any PRs here, too. :)

Please indent using two spaces only, have a newline at the EOF and use UNIX line ending, thanks!

# development

```bashshell
# install docker and docker-compose beforehand
# clone the repo
git clone https://github.com/cdphp/rails-poker.git
# create the database
docker-compose run app /bin/bash
root@3b552a0a5c99:/usr/src/app# mysql -hdb -p
Enter password: root
mysql> CREATE DATABASE IF NOT EXISTS poker default charset utf8 COLLATE utf8_general_ci;
mysql> exit
Bye
root@3b552a0a5c99:/usr/src/app# rake db:migrate
root@3b552a0a5c99:/usr/src/app# exit
exit
docker-compose up
# http://localhost:3000
```

# contribute
如果你有什么想法或者建议,请不要客气尽可以提出来。<br>
show me your ideas, thanks!

## test chats
url: http://poker.miaowu.org/chats/new
----
Built by (c) Joey Huang and contributors. Released under the MIT license.

## test poker
url: http://poker.miaowu.org/
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fcdphp%2Frails-poker.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fcdphp%2Frails-poker?ref=badge_large)
Binary file added poker/app/assets/fonts/FontAwesome.otf
Binary file not shown.
Binary file added poker/app/assets/fonts/fontawesome-webfont.eot
Binary file not shown.
2,671 changes: 2,671 additions & 0 deletions poker/app/assets/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added poker/app/assets/fonts/fontawesome-webfont.ttf
Binary file not shown.
Binary file added poker/app/assets/fonts/fontawesome-webfont.woff
Binary file not shown.
Binary file added poker/app/assets/fonts/fontawesome-webfont.woff2
Binary file not shown.
27 changes: 25 additions & 2 deletions poker/app/assets/javascripts/components/chat/add_chat.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ class AddChat extends React.Component {
constructor(props) {
super(props);
this.state = { message: "" };
this.focus = this.focus.bind(this);
}

componentDidMount() {
this.focus();
}

handleChatChange(event) {
Expand All @@ -16,17 +21,35 @@ class AddChat extends React.Component {
this.setState({ message: "" });
}

handleClickEmoji(emoji) {
this.setState({ message: this.state.message + emoji });
this.focus();
}

render() {
return (
<div>
<form className="new_chat" role="form" onSubmit={this.handleSubmit.bind(this)}>
<div className="add-chat input-group form-group-no-border input-lg">
<input type="text" autoComplete="off" className="form-control" name="message" placeholder="Typing here ..."
value={this.state.message} onChange={this.handleChatChange.bind(this)} maxLength="255"/>
<span className="input-group-addon dropup emoji-container">
<a href="#" role="button" id="emojiBtn" className="emoji-btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i className="fa fa-smile-o"></i>
</a>
<EmojiBox onClickEmoji={this.handleClickEmoji.bind(this)} />
</span>
<input type="text" autoComplete="off" className="form-control"
name="message" placeholder="Typing here ..."
value={this.state.message} onChange={this.handleChatChange.bind(this)}
maxLength="255" ref={(input) => { this.textInput = input; }}/>
</div>
</form>
</div>
);
}

focus() {
this.textInput.focus();
}

}

50 changes: 50 additions & 0 deletions poker/app/assets/javascripts/components/chat/emoji-box.js.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
class EmojiBox extends React.Component {
constructor(props) {
super(props);
this.state = { kamojis: this.getKamojis() };
}

componentDidMount() {
}

handleKamoji(e){
this.props.onClickEmoji(e.target.innerHTML + ' ')
}

render() {
let ks = this.state.kamojis.map((kamoji, index) => {
return this.renderKamoji(index, kamoji);
});
return (
<div className="dropdown-menu emoji-box" aria-labelledby="dropdownMenuButton">
<ul>
{ks}
</ul>
</div>
);
}

renderKamoji(index,k){
return(
<li key={index}>
<a className="emoji-item" title={k} onClick={(e) => this.handleKamoji(e)}>{k}</a>
</li>
);
}

getKamojis () {
return this.getRandomArrayElements(kamojiList, 40);
}

getRandomArrayElements(arr, count) {
var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
while (i-- > min) {
index = Math.floor((i + 1) * Math.random());
temp = shuffled[index];
shuffled[index] = shuffled[i];
shuffled[i] = temp;
}
return shuffled.slice(min);
}

}
27 changes: 0 additions & 27 deletions poker/app/assets/javascripts/components/image.js.jsx

This file was deleted.

Loading

0 comments on commit 3a30390

Please sign in to comment.