chatroom 0.0.8 → 0.0.9
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.
- checksums.yaml +8 -8
- data/README.md +11 -2
- data/app/assets/javascripts/chatroom/marks.js +4 -4
- data/chatroom.gemspec +1 -1
- data/lib/chatroom.rb +0 -8
- data/lib/chatroom/version.rb +1 -1
- data/lib/generators/chatroom/chatroom_generator.rb +0 -3
- data/lib/generators/chatroom/orm_helpers.rb +8 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDlhYWNiOTIxODA5MGU5Mjc1ZmE5ZWI5ZmVlNmQzOWFmOWMwM2M1NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGRjOWIzMDMwYjI3NGI5NzIwZWNhNDljYjJkMmFlYWM1NmRhMGU0Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODQ0YTU0ZGM5OWM5OGFkNjM0Y2U4YWQzY2RmZjBiZGY5OTAxZDkxN2EyMzdi
|
10
|
+
NTQxMTNkNzY3MDdlNTk4YzVkM2FiNDBlNjJiM2Q0OGU0MzZhNjhhOWUyMmU5
|
11
|
+
YjdjZjhiMTkzNzFhMjg0MThlNTAwYWViYjVkZmEwNzEwMTMyYmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjEwMTZlNzAxODgyY2U2ZWE1MGM3ZWM4MjA4Mzk3NjQzZTJhYzE5ODNmZmIz
|
14
|
+
NzY0YWJiN2E1NWZlODc4ZTBjNDY2N2VmNzhjNDUxOWYyOTM1NDgzZDNmYjAx
|
15
|
+
Mzk2ZTdjYmU5ODc1NzZhODQxMTQzZmQ1YjhmYTA2Zjc1OWE1YzM=
|
data/README.md
CHANGED
@@ -40,11 +40,20 @@ Start faye server in your terminal:
|
|
40
40
|
|
41
41
|
rackup private_pub.ru -s thin -E production
|
42
42
|
|
43
|
-
Add User to the Message:
|
44
|
-
|
43
|
+
#####Add User to the Message:
|
44
|
+
|
45
|
+
Add a migration and add your code to show user's name in message\_helper.rb:
|
45
46
|
|
46
47
|
rails g migration add_user_id_to_messages
|
47
48
|
|
49
|
+
Add hidden field about user\_id in chatroom/message\_helper.rb so as create the message with its ower:
|
50
|
+
|
51
|
+
<%= f.hidden_field :user_id, :value => current_user.id %>
|
52
|
+
|
53
|
+
Allow params get the user\_id in chatroom/messages\_controller.rb:
|
54
|
+
|
55
|
+
params.require(:message).permit(:content, :user_id)
|
56
|
+
|
48
57
|
## Contributing
|
49
58
|
|
50
59
|
1. Fork it
|
@@ -9,11 +9,11 @@
|
|
9
9
|
|
10
10
|
function convertTagToMark(str) {
|
11
11
|
var emotions = [
|
12
|
-
"smile", "despressed", "like", "dull", "proud", "cry", "shy", "
|
13
|
-
"nap", "
|
14
|
-
"cool", "awkward", "scream", "vomit", "giggle", "lovely", "
|
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
15
|
"hungry", "sleepy", "scared", "sweat", "simper", "solider", "strive", "shout",
|
16
|
-
"questionaire", "hiss", "dizzy", "impantient", "
|
16
|
+
"questionaire", "hiss", "dizzy", "impantient", "be_bombed", "skull", "hit_head", "bye"
|
17
17
|
];
|
18
18
|
var s = "";
|
19
19
|
|
data/chatroom.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["969024089@qq.com"]
|
11
11
|
spec.description = %q{This gem can help you create a chatroom.}
|
12
12
|
spec.summary = %q{Chatroom provides functions, like adding emotions or changing text pattern.}
|
13
|
-
spec.homepage = "http://github.com/TsaiKoga/"
|
13
|
+
spec.homepage = "http://github.com/TsaiKoga/chatroom"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
data/lib/chatroom.rb
CHANGED
@@ -1,12 +1,4 @@
|
|
1
1
|
module Chatroom
|
2
|
-
|
3
2
|
require 'chatroom/engine' if defined?(Rails)
|
4
3
|
require 'generators/chatroom/install_generator'
|
5
|
-
|
6
|
-
# Default way to setup Chatroom. Run rails generate chatroom_install to create
|
7
|
-
# a fresh initializer with all configuration values.
|
8
|
-
# def self.setup
|
9
|
-
# yield self
|
10
|
-
# end
|
11
|
-
|
12
4
|
end
|
data/lib/chatroom/version.rb
CHANGED
@@ -13,10 +13,7 @@ module Chatroom
|
|
13
13
|
class_option :routes, :desc => "Generate routes", :type => :boolean, :default => true
|
14
14
|
|
15
15
|
hook_for :orm
|
16
|
-
# hook_for :views
|
17
|
-
# hook_for :controllers
|
18
16
|
hook_for :assets
|
19
|
-
# hook_for :helpers
|
20
17
|
|
21
18
|
def add_chatroom_routes
|
22
19
|
chatroom_route = <<-ROUTE
|
@@ -7,11 +7,11 @@ module Chatroom
|
|
7
7
|
validates :content, :presence => true, :length => { :maximum => 250 }
|
8
8
|
|
9
9
|
EMOTIONS = [
|
10
|
-
"smile", "despressed", "like", "dull", "proud", "cry", "shy", "
|
11
|
-
"nap", "
|
12
|
-
"cool", "awkward", "scream", "vomit", "giggle", "lovely", "
|
10
|
+
"smile", "despressed", "like", "dull", "proud", "cry", "shy", "shut_up",
|
11
|
+
"nap", "big_cry", "awkward_red", "angry", "naughty", "snag", "surprise", "bad",
|
12
|
+
"cool", "awkward", "scream", "vomit", "giggle", "lovely", "who_cares", "zhuai",
|
13
13
|
"hungry", "sleepy", "scared", "sweat", "simper", "solider", "strive", "shout",
|
14
|
-
"questionaire", "hiss", "dizzy", "impantient", "
|
14
|
+
"questionaire", "hiss", "dizzy", "impantient", "be_bombed", "skull", "hit_head", "bye"
|
15
15
|
]
|
16
16
|
|
17
17
|
# The created time of the message
|
@@ -22,13 +22,15 @@ module Chatroom
|
|
22
22
|
# convert the marks to html tags
|
23
23
|
def html_content
|
24
24
|
return "" if content.blank?
|
25
|
-
str = content.gsub(/\\
|
25
|
+
str = content.gsub(/\\r\\n/, "<br/>")
|
26
|
+
str = str.gsub(/(\\s)/, " ")
|
27
|
+
str = str.gsub(/\\[bold\\]/, "<b>")
|
26
28
|
str = str.gsub(/\\[-bold\\]/, "</b>")
|
27
29
|
str = str.gsub(/\\[italic\\]/, "<i>")
|
28
30
|
str = str.gsub(/\\[-italic\\]/, "</i>")
|
29
31
|
str = str.gsub(/\\[color:(#.{6})\\]/){ |s| "<span style=\\"color:\#{$1}\\">" }
|
30
32
|
str = str.gsub(/\\[-color\\]/, "</span>")
|
31
|
-
str = str.gsub(/\\[(
|
33
|
+
str = str.gsub(/\\[(\\w+)\\]/) do |s|
|
32
34
|
emotion = EMOTIONS.index($1)
|
33
35
|
emotion.nil? ? "[\#{$1}]": "<img src=\\"/assets/emotions/\#{emotion}.gif\\" />"
|
34
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chatroom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TsaiKoga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -251,7 +251,7 @@ files:
|
|
251
251
|
- lib/generators/chatroom/orm_helpers.rb
|
252
252
|
- lib/generators/chatroom/views_generator.rb
|
253
253
|
- lib/generators/templates/chatroom.rb
|
254
|
-
homepage: http://github.com/TsaiKoga/
|
254
|
+
homepage: http://github.com/TsaiKoga/chatroom
|
255
255
|
licenses:
|
256
256
|
- MIT
|
257
257
|
metadata: {}
|