chatroom 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/app/assets/images/chatroom-icons/default.png +0 -0
- data/app/assets/images/emotions/0.gif +0 -0
- data/app/assets/images/emotions/1.gif +0 -0
- data/app/assets/images/emotions/10.gif +0 -0
- data/app/assets/images/emotions/100.gif +0 -0
- data/app/assets/images/emotions/101.gif +0 -0
- data/app/assets/images/emotions/102.gif +0 -0
- data/app/assets/images/emotions/103.gif +0 -0
- data/app/assets/images/emotions/104.gif +0 -0
- data/app/assets/images/emotions/105.gif +0 -0
- data/app/assets/images/emotions/106.gif +0 -0
- data/app/assets/images/emotions/107.gif +0 -0
- data/app/assets/images/emotions/108.gif +0 -0
- data/app/assets/images/emotions/109.gif +0 -0
- data/app/assets/images/emotions/11.gif +0 -0
- data/app/assets/images/emotions/110.gif +0 -0
- data/app/assets/images/emotions/111.gif +0 -0
- data/app/assets/images/emotions/112.gif +0 -0
- data/app/assets/images/emotions/113.gif +0 -0
- data/app/assets/images/emotions/114.gif +0 -0
- data/app/assets/images/emotions/115.gif +0 -0
- data/app/assets/images/emotions/116.gif +0 -0
- data/app/assets/images/emotions/117.gif +0 -0
- data/app/assets/images/emotions/118.gif +0 -0
- data/app/assets/images/emotions/119.gif +0 -0
- data/app/assets/images/emotions/12.gif +0 -0
- data/app/assets/images/emotions/120.gif +0 -0
- data/app/assets/images/emotions/121.gif +0 -0
- data/app/assets/images/emotions/122.gif +0 -0
- data/app/assets/images/emotions/123.gif +0 -0
- data/app/assets/images/emotions/124.gif +0 -0
- data/app/assets/images/emotions/125.gif +0 -0
- data/app/assets/images/emotions/126.gif +0 -0
- data/app/assets/images/emotions/127.gif +0 -0
- data/app/assets/images/emotions/128.gif +0 -0
- data/app/assets/images/emotions/129.gif +0 -0
- data/app/assets/images/emotions/13.gif +0 -0
- data/app/assets/images/emotions/130.gif +0 -0
- data/app/assets/images/emotions/131.gif +0 -0
- data/app/assets/images/emotions/132.gif +0 -0
- data/app/assets/images/emotions/133.gif +0 -0
- data/app/assets/images/emotions/134.gif +0 -0
- data/app/assets/images/emotions/14.gif +0 -0
- data/app/assets/images/emotions/15.gif +0 -0
- data/app/assets/images/emotions/16.gif +0 -0
- data/app/assets/images/emotions/17.gif +0 -0
- data/app/assets/images/emotions/18.gif +0 -0
- data/app/assets/images/emotions/19.gif +0 -0
- data/app/assets/images/emotions/2.gif +0 -0
- data/app/assets/images/emotions/20.gif +0 -0
- data/app/assets/images/emotions/21.gif +0 -0
- data/app/assets/images/emotions/22.gif +0 -0
- data/app/assets/images/emotions/23.gif +0 -0
- data/app/assets/images/emotions/24.gif +0 -0
- data/app/assets/images/emotions/25.gif +0 -0
- data/app/assets/images/emotions/26.gif +0 -0
- data/app/assets/images/emotions/27.gif +0 -0
- data/app/assets/images/emotions/28.gif +0 -0
- data/app/assets/images/emotions/29.gif +0 -0
- data/app/assets/images/emotions/3.gif +0 -0
- data/app/assets/images/emotions/30.gif +0 -0
- data/app/assets/images/emotions/31.gif +0 -0
- data/app/assets/images/emotions/32.gif +0 -0
- data/app/assets/images/emotions/33.gif +0 -0
- data/app/assets/images/emotions/34.gif +0 -0
- data/app/assets/images/emotions/35.gif +0 -0
- data/app/assets/images/emotions/36.gif +0 -0
- data/app/assets/images/emotions/37.gif +0 -0
- data/app/assets/images/emotions/38.gif +0 -0
- data/app/assets/images/emotions/39.gif +0 -0
- data/app/assets/images/emotions/4.gif +0 -0
- data/app/assets/images/emotions/40.gif +0 -0
- data/app/assets/images/emotions/41.gif +0 -0
- data/app/assets/images/emotions/42.gif +0 -0
- data/app/assets/images/emotions/43.gif +0 -0
- data/app/assets/images/emotions/44.gif +0 -0
- data/app/assets/images/emotions/45.gif +0 -0
- data/app/assets/images/emotions/46.gif +0 -0
- data/app/assets/images/emotions/47.gif +0 -0
- data/app/assets/images/emotions/48.gif +0 -0
- data/app/assets/images/emotions/49.gif +0 -0
- data/app/assets/images/emotions/5.gif +0 -0
- data/app/assets/images/emotions/50.gif +0 -0
- data/app/assets/images/emotions/51.gif +0 -0
- data/app/assets/images/emotions/52.gif +0 -0
- data/app/assets/images/emotions/53.gif +0 -0
- data/app/assets/images/emotions/54.gif +0 -0
- data/app/assets/images/emotions/55.gif +0 -0
- data/app/assets/images/emotions/56.gif +0 -0
- data/app/assets/images/emotions/57.gif +0 -0
- data/app/assets/images/emotions/58.gif +0 -0
- data/app/assets/images/emotions/59.gif +0 -0
- data/app/assets/images/emotions/6.gif +0 -0
- data/app/assets/images/emotions/60.gif +0 -0
- data/app/assets/images/emotions/61.gif +0 -0
- data/app/assets/images/emotions/62.gif +0 -0
- data/app/assets/images/emotions/63.gif +0 -0
- data/app/assets/images/emotions/64.gif +0 -0
- data/app/assets/images/emotions/65.gif +0 -0
- data/app/assets/images/emotions/66.gif +0 -0
- data/app/assets/images/emotions/67.gif +0 -0
- data/app/assets/images/emotions/68.gif +0 -0
- data/app/assets/images/emotions/69.gif +0 -0
- data/app/assets/images/emotions/7.gif +0 -0
- data/app/assets/images/emotions/70.gif +0 -0
- data/app/assets/images/emotions/71.gif +0 -0
- data/app/assets/images/emotions/72.gif +0 -0
- data/app/assets/images/emotions/73.gif +0 -0
- data/app/assets/images/emotions/74.gif +0 -0
- data/app/assets/images/emotions/75.gif +0 -0
- data/app/assets/images/emotions/76.gif +0 -0
- data/app/assets/images/emotions/77.gif +0 -0
- data/app/assets/images/emotions/78.gif +0 -0
- data/app/assets/images/emotions/79.gif +0 -0
- data/app/assets/images/emotions/8.gif +0 -0
- data/app/assets/images/emotions/80.gif +0 -0
- data/app/assets/images/emotions/81.gif +0 -0
- data/app/assets/images/emotions/82.gif +0 -0
- data/app/assets/images/emotions/83.gif +0 -0
- data/app/assets/images/emotions/84.gif +0 -0
- data/app/assets/images/emotions/85.gif +0 -0
- data/app/assets/images/emotions/86.gif +0 -0
- data/app/assets/images/emotions/87.gif +0 -0
- data/app/assets/images/emotions/88.gif +0 -0
- data/app/assets/images/emotions/89.gif +0 -0
- data/app/assets/images/emotions/9.gif +0 -0
- data/app/assets/images/emotions/90.gif +0 -0
- data/app/assets/images/emotions/91.gif +0 -0
- data/app/assets/images/emotions/92.gif +0 -0
- data/app/assets/images/emotions/93.gif +0 -0
- data/app/assets/images/emotions/94.gif +0 -0
- data/app/assets/images/emotions/95.gif +0 -0
- data/app/assets/images/emotions/96.gif +0 -0
- data/app/assets/images/emotions/97.gif +0 -0
- data/app/assets/images/emotions/98.gif +0 -0
- data/app/assets/images/emotions/99.gif +0 -0
- data/app/assets/images/emotions/static.gif +0 -0
- data/app/assets/javascripts/chatroom/marks.js +34 -0
- data/app/assets/javascripts/chatroom/messages.js.coffee +145 -0
- data/app/assets/stylesheets/chatroom/messages.css.scss +300 -0
- data/app/controllers/chatroom/messages_controller.rb +20 -0
- data/app/helpers/chatroom/message_helper.rb +26 -0
- data/app/views/chatroom/messages/_chatroom.html.erb +15 -0
- data/app/views/chatroom/messages/_form.html.erb +35 -0
- data/app/views/chatroom/messages/create.js.erb +6 -0
- data/chatroom.gemspec +26 -0
- data/lib/chatroom.rb +12 -0
- data/lib/chatroom/engine.rb +14 -0
- data/lib/chatroom/version.rb +3 -0
- data/lib/generators/active_record/chatroom_generator.rb +43 -0
- data/lib/generators/active_record/templates/migration.rb +14 -0
- data/lib/generators/chatroom/assets_generator.rb +40 -0
- data/lib/generators/chatroom/chatroom_generator.rb +40 -0
- data/lib/generators/chatroom/controllers_generator.rb +24 -0
- data/lib/generators/chatroom/helpers_generator.rb +24 -0
- data/lib/generators/chatroom/install_generator.rb +19 -0
- data/lib/generators/chatroom/orm_helpers.rb +59 -0
- data/lib/generators/chatroom/views_generator.rb +38 -0
- data/lib/generators/templates/chatroom.rb +3 -0
- metadata +278 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTU5ZTcxNjFhMTZlM2U0ZTQxZWM5MmJkMzE4MDk4YTUzNWE5NDEzOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTA0N2YzNzA4MTQyOGQ2ZGJhYmRiZDk1ODBlNDc2YTY5NDY1Mzc5YQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Nzg5ZTdlNmFlMGE0ZjNmYzYyMTg0MjYwZTY5NDFjNzRkMzlkNWVhYTI5NjRh
|
10
|
+
M2NkYmRkMjhiZGIzM2I5MDk4YWY3ODA4Njc4OWMxMzM4NjY0Y2VlYjY3MTk5
|
11
|
+
MGNjZjBjZTI1YmM4MjA3MGUxZDFmZWZlM2YwMzYwY2Q3ZTY5YTg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YzkwYWMzYmZmYzllNTIxNjYzZTdiYzY5NTkwZGU0Zjk1NTA0MjY0ZDhmYjk1
|
14
|
+
NzFhOTE2Mjg3ZmY0ZGI1MmE5Yjg3YTgzOTJmOWFiNWQwNTU3MGQ1YTQ3NWJi
|
15
|
+
MDIxMjExNDNiZDk0YTZiYWYyZTQyOWMwNmEyZTUyZTA0ZDk4MDM=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TsaiKoga
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Chatroom
|
2
|
+
|
3
|
+
The chat room provides you to send messages that including emotions and different kinds
|
4
|
+
font.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'chatroom'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install chatroom
|
19
|
+
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
After you install Chatroom and add it to your Gemfile, you need to run the generator:
|
24
|
+
|
25
|
+
rails g chatroom:install
|
26
|
+
|
27
|
+
Add the code below in your controller where will put the chatroom. Example:
|
28
|
+
|
29
|
+
@messages = Message.all
|
30
|
+
|
31
|
+
Add the chatroom to your view. Example:
|
32
|
+
|
33
|
+
<%= render "chatroom/messages/chatroom" %>
|
34
|
+
|
35
|
+
Migration Task:
|
36
|
+
|
37
|
+
rake db:migrate
|
38
|
+
|
39
|
+
Start faye server in your terminal:
|
40
|
+
|
41
|
+
rackup private_pub.ru -s thin -E production
|
42
|
+
|
43
|
+
Add User to the Message:
|
44
|
+
Just add a migration and add your code to show user's name in message\_helper.rb
|
45
|
+
|
46
|
+
rails g migration add_user_id_to_messages
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
1. Fork it
|
51
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
52
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
54
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/**
|
2
|
+
* Author: TsaiKoga
|
3
|
+
* Comment: These code are used to convert the image tags and other tags into marks.
|
4
|
+
* Tags: Bold ([bold][-bold] => <b></b>)
|
5
|
+
* Itablic ([italic][-italic] => <i></i>)
|
6
|
+
* Emotions ([smile] => <img src="/assets/emotions/0.gif"/>)
|
7
|
+
* FontColor ([color:#FFFFFF][-color] => <span style="background-color: #ffffff"></span>)
|
8
|
+
*/
|
9
|
+
|
10
|
+
function convertTagToMark(str) {
|
11
|
+
var emotions = [
|
12
|
+
"smile", "despressed", "like", "dull", "proud", "cry", "shy", "shut up",
|
13
|
+
"nap", "big cry", "awkward red", "angry", "naughty", "snag", "surprise", "bad",
|
14
|
+
"cool", "awkward", "scream", "vomit", "giggle", "lovely", "who cares", "zhuai",
|
15
|
+
"hungry", "sleepy", "scared", "sweat", "simper", "solider", "strive", "shout",
|
16
|
+
"questionaire", "hiss", "dizzy", "impantient", "be bombed", "skull", "hit head", "bye"
|
17
|
+
];
|
18
|
+
var s = "";
|
19
|
+
|
20
|
+
if (str.length == 0) return "";
|
21
|
+
s = str.replace(/<b>/g, "[bold]");
|
22
|
+
s = s.replace(/<\/b>/g, "[-bold]");
|
23
|
+
s = s.replace(/<i>/g, "[italic]");
|
24
|
+
s = s.replace(/<\/i>/g, "[-italic]");
|
25
|
+
s = s.replace(/(<span style="color: )(#.{6})(">)/g, function(m, p1, p2, p3) {
|
26
|
+
return "[color:"+ p2 +"]";
|
27
|
+
});
|
28
|
+
s = s.replace(/<\/span>/g, "[-color]");
|
29
|
+
s = s.replace(/(<img src="\/assets\/emotions\/)(\d+)(\.gif" \/>)/g, function(m, p1, p2, p3) {
|
30
|
+
return "[" + emotions[p2] + "]";
|
31
|
+
});
|
32
|
+
return s;
|
33
|
+
}
|
34
|
+
|