chatroom 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +10 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +54 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/images/chatroom-icons/default.png +0 -0
  8. data/app/assets/images/emotions/0.gif +0 -0
  9. data/app/assets/images/emotions/1.gif +0 -0
  10. data/app/assets/images/emotions/10.gif +0 -0
  11. data/app/assets/images/emotions/100.gif +0 -0
  12. data/app/assets/images/emotions/101.gif +0 -0
  13. data/app/assets/images/emotions/102.gif +0 -0
  14. data/app/assets/images/emotions/103.gif +0 -0
  15. data/app/assets/images/emotions/104.gif +0 -0
  16. data/app/assets/images/emotions/105.gif +0 -0
  17. data/app/assets/images/emotions/106.gif +0 -0
  18. data/app/assets/images/emotions/107.gif +0 -0
  19. data/app/assets/images/emotions/108.gif +0 -0
  20. data/app/assets/images/emotions/109.gif +0 -0
  21. data/app/assets/images/emotions/11.gif +0 -0
  22. data/app/assets/images/emotions/110.gif +0 -0
  23. data/app/assets/images/emotions/111.gif +0 -0
  24. data/app/assets/images/emotions/112.gif +0 -0
  25. data/app/assets/images/emotions/113.gif +0 -0
  26. data/app/assets/images/emotions/114.gif +0 -0
  27. data/app/assets/images/emotions/115.gif +0 -0
  28. data/app/assets/images/emotions/116.gif +0 -0
  29. data/app/assets/images/emotions/117.gif +0 -0
  30. data/app/assets/images/emotions/118.gif +0 -0
  31. data/app/assets/images/emotions/119.gif +0 -0
  32. data/app/assets/images/emotions/12.gif +0 -0
  33. data/app/assets/images/emotions/120.gif +0 -0
  34. data/app/assets/images/emotions/121.gif +0 -0
  35. data/app/assets/images/emotions/122.gif +0 -0
  36. data/app/assets/images/emotions/123.gif +0 -0
  37. data/app/assets/images/emotions/124.gif +0 -0
  38. data/app/assets/images/emotions/125.gif +0 -0
  39. data/app/assets/images/emotions/126.gif +0 -0
  40. data/app/assets/images/emotions/127.gif +0 -0
  41. data/app/assets/images/emotions/128.gif +0 -0
  42. data/app/assets/images/emotions/129.gif +0 -0
  43. data/app/assets/images/emotions/13.gif +0 -0
  44. data/app/assets/images/emotions/130.gif +0 -0
  45. data/app/assets/images/emotions/131.gif +0 -0
  46. data/app/assets/images/emotions/132.gif +0 -0
  47. data/app/assets/images/emotions/133.gif +0 -0
  48. data/app/assets/images/emotions/134.gif +0 -0
  49. data/app/assets/images/emotions/14.gif +0 -0
  50. data/app/assets/images/emotions/15.gif +0 -0
  51. data/app/assets/images/emotions/16.gif +0 -0
  52. data/app/assets/images/emotions/17.gif +0 -0
  53. data/app/assets/images/emotions/18.gif +0 -0
  54. data/app/assets/images/emotions/19.gif +0 -0
  55. data/app/assets/images/emotions/2.gif +0 -0
  56. data/app/assets/images/emotions/20.gif +0 -0
  57. data/app/assets/images/emotions/21.gif +0 -0
  58. data/app/assets/images/emotions/22.gif +0 -0
  59. data/app/assets/images/emotions/23.gif +0 -0
  60. data/app/assets/images/emotions/24.gif +0 -0
  61. data/app/assets/images/emotions/25.gif +0 -0
  62. data/app/assets/images/emotions/26.gif +0 -0
  63. data/app/assets/images/emotions/27.gif +0 -0
  64. data/app/assets/images/emotions/28.gif +0 -0
  65. data/app/assets/images/emotions/29.gif +0 -0
  66. data/app/assets/images/emotions/3.gif +0 -0
  67. data/app/assets/images/emotions/30.gif +0 -0
  68. data/app/assets/images/emotions/31.gif +0 -0
  69. data/app/assets/images/emotions/32.gif +0 -0
  70. data/app/assets/images/emotions/33.gif +0 -0
  71. data/app/assets/images/emotions/34.gif +0 -0
  72. data/app/assets/images/emotions/35.gif +0 -0
  73. data/app/assets/images/emotions/36.gif +0 -0
  74. data/app/assets/images/emotions/37.gif +0 -0
  75. data/app/assets/images/emotions/38.gif +0 -0
  76. data/app/assets/images/emotions/39.gif +0 -0
  77. data/app/assets/images/emotions/4.gif +0 -0
  78. data/app/assets/images/emotions/40.gif +0 -0
  79. data/app/assets/images/emotions/41.gif +0 -0
  80. data/app/assets/images/emotions/42.gif +0 -0
  81. data/app/assets/images/emotions/43.gif +0 -0
  82. data/app/assets/images/emotions/44.gif +0 -0
  83. data/app/assets/images/emotions/45.gif +0 -0
  84. data/app/assets/images/emotions/46.gif +0 -0
  85. data/app/assets/images/emotions/47.gif +0 -0
  86. data/app/assets/images/emotions/48.gif +0 -0
  87. data/app/assets/images/emotions/49.gif +0 -0
  88. data/app/assets/images/emotions/5.gif +0 -0
  89. data/app/assets/images/emotions/50.gif +0 -0
  90. data/app/assets/images/emotions/51.gif +0 -0
  91. data/app/assets/images/emotions/52.gif +0 -0
  92. data/app/assets/images/emotions/53.gif +0 -0
  93. data/app/assets/images/emotions/54.gif +0 -0
  94. data/app/assets/images/emotions/55.gif +0 -0
  95. data/app/assets/images/emotions/56.gif +0 -0
  96. data/app/assets/images/emotions/57.gif +0 -0
  97. data/app/assets/images/emotions/58.gif +0 -0
  98. data/app/assets/images/emotions/59.gif +0 -0
  99. data/app/assets/images/emotions/6.gif +0 -0
  100. data/app/assets/images/emotions/60.gif +0 -0
  101. data/app/assets/images/emotions/61.gif +0 -0
  102. data/app/assets/images/emotions/62.gif +0 -0
  103. data/app/assets/images/emotions/63.gif +0 -0
  104. data/app/assets/images/emotions/64.gif +0 -0
  105. data/app/assets/images/emotions/65.gif +0 -0
  106. data/app/assets/images/emotions/66.gif +0 -0
  107. data/app/assets/images/emotions/67.gif +0 -0
  108. data/app/assets/images/emotions/68.gif +0 -0
  109. data/app/assets/images/emotions/69.gif +0 -0
  110. data/app/assets/images/emotions/7.gif +0 -0
  111. data/app/assets/images/emotions/70.gif +0 -0
  112. data/app/assets/images/emotions/71.gif +0 -0
  113. data/app/assets/images/emotions/72.gif +0 -0
  114. data/app/assets/images/emotions/73.gif +0 -0
  115. data/app/assets/images/emotions/74.gif +0 -0
  116. data/app/assets/images/emotions/75.gif +0 -0
  117. data/app/assets/images/emotions/76.gif +0 -0
  118. data/app/assets/images/emotions/77.gif +0 -0
  119. data/app/assets/images/emotions/78.gif +0 -0
  120. data/app/assets/images/emotions/79.gif +0 -0
  121. data/app/assets/images/emotions/8.gif +0 -0
  122. data/app/assets/images/emotions/80.gif +0 -0
  123. data/app/assets/images/emotions/81.gif +0 -0
  124. data/app/assets/images/emotions/82.gif +0 -0
  125. data/app/assets/images/emotions/83.gif +0 -0
  126. data/app/assets/images/emotions/84.gif +0 -0
  127. data/app/assets/images/emotions/85.gif +0 -0
  128. data/app/assets/images/emotions/86.gif +0 -0
  129. data/app/assets/images/emotions/87.gif +0 -0
  130. data/app/assets/images/emotions/88.gif +0 -0
  131. data/app/assets/images/emotions/89.gif +0 -0
  132. data/app/assets/images/emotions/9.gif +0 -0
  133. data/app/assets/images/emotions/90.gif +0 -0
  134. data/app/assets/images/emotions/91.gif +0 -0
  135. data/app/assets/images/emotions/92.gif +0 -0
  136. data/app/assets/images/emotions/93.gif +0 -0
  137. data/app/assets/images/emotions/94.gif +0 -0
  138. data/app/assets/images/emotions/95.gif +0 -0
  139. data/app/assets/images/emotions/96.gif +0 -0
  140. data/app/assets/images/emotions/97.gif +0 -0
  141. data/app/assets/images/emotions/98.gif +0 -0
  142. data/app/assets/images/emotions/99.gif +0 -0
  143. data/app/assets/images/emotions/static.gif +0 -0
  144. data/app/assets/javascripts/chatroom/marks.js +34 -0
  145. data/app/assets/javascripts/chatroom/messages.js.coffee +145 -0
  146. data/app/assets/stylesheets/chatroom/messages.css.scss +300 -0
  147. data/app/controllers/chatroom/messages_controller.rb +20 -0
  148. data/app/helpers/chatroom/message_helper.rb +26 -0
  149. data/app/views/chatroom/messages/_chatroom.html.erb +15 -0
  150. data/app/views/chatroom/messages/_form.html.erb +35 -0
  151. data/app/views/chatroom/messages/create.js.erb +6 -0
  152. data/chatroom.gemspec +26 -0
  153. data/lib/chatroom.rb +12 -0
  154. data/lib/chatroom/engine.rb +14 -0
  155. data/lib/chatroom/version.rb +3 -0
  156. data/lib/generators/active_record/chatroom_generator.rb +43 -0
  157. data/lib/generators/active_record/templates/migration.rb +14 -0
  158. data/lib/generators/chatroom/assets_generator.rb +40 -0
  159. data/lib/generators/chatroom/chatroom_generator.rb +40 -0
  160. data/lib/generators/chatroom/controllers_generator.rb +24 -0
  161. data/lib/generators/chatroom/helpers_generator.rb +24 -0
  162. data/lib/generators/chatroom/install_generator.rb +19 -0
  163. data/lib/generators/chatroom/orm_helpers.rb +59 -0
  164. data/lib/generators/chatroom/views_generator.rb +38 -0
  165. data/lib/generators/templates/chatroom.rb +3 -0
  166. metadata +278 -0
@@ -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=
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # source 'https://rubygems.org'
2
+ source 'http://ruby.taobao.org'
3
+
4
+ # Specify your gem's dependencies in chatroom.gemspec
5
+ gemspec
6
+
7
+ gem 'rails', '~> 4.0.0'
8
+ gem 'faye', '~> 1.0.0'
9
+ gem 'private_pub', '~> 1.0.3'
10
+ gem 'thin', '~> 1.5.1'
@@ -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.
@@ -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
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -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
+