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
@@ -0,0 +1,145 @@
|
|
1
|
+
# Place all the behaviors and hooks related to the matching controller here.
|
2
|
+
# All this logic will automatically be available in application.js.
|
3
|
+
# You can use CoffeeScript in this file: http://coffeescript.org/
|
4
|
+
|
5
|
+
window.Messages =
|
6
|
+
# maximun or minimun your chatroom
|
7
|
+
minChatroom: () ->
|
8
|
+
$("#chatroom").slideToggle()
|
9
|
+
$("#chatBeam").show()
|
10
|
+
false
|
11
|
+
|
12
|
+
maxChatroom: () ->
|
13
|
+
$("#chatBeam").hide()
|
14
|
+
$("#chatroom").slideToggle()
|
15
|
+
false
|
16
|
+
|
17
|
+
# Editor: change the text in textarea
|
18
|
+
changeSelectionChar: (elemTag) ->
|
19
|
+
editor = $("#new_message_editor")
|
20
|
+
selectionStart = editor[0].selectionStart
|
21
|
+
selectionEnd = editor[0].selectionEnd
|
22
|
+
|
23
|
+
if selectionStart != selectionEnd
|
24
|
+
editorCharArray = editor.val().split("")
|
25
|
+
editorCharArray.splice(selectionEnd, 0, elemTag[1])
|
26
|
+
editorCharArray.splice(selectionStart, 0, elemTag[0])
|
27
|
+
editorText = convertTagToMark(editorCharArray.join(''))
|
28
|
+
editor.val(editorText)
|
29
|
+
false
|
30
|
+
|
31
|
+
changeFontBlod: () ->
|
32
|
+
Messages.changeSelectionChar(["<b>", "</b>"])
|
33
|
+
false
|
34
|
+
|
35
|
+
changeFontItalic: () ->
|
36
|
+
Messages.changeSelectionChar(["<i>", "</i>"])
|
37
|
+
false
|
38
|
+
|
39
|
+
changeFontColor: () ->
|
40
|
+
Messages.changeSelectionChar(["<span style=\"color: red\">", "</span>"])
|
41
|
+
false
|
42
|
+
|
43
|
+
# Editor: show all the emotions for selecting
|
44
|
+
constructEmotions: () ->
|
45
|
+
table = $("table.chatroom-emotions-images tbody")
|
46
|
+
if !table.has("span").length
|
47
|
+
for i in [0...5]
|
48
|
+
row = $("<tr></tr>")
|
49
|
+
for j in [0...8]
|
50
|
+
n = i * 8 + j
|
51
|
+
img = $("<span></span>").addClass("emotion-img")
|
52
|
+
img.attr("emotion", "#{n}")
|
53
|
+
img.css({"background": "url(\"/assets/emotions/#{n}.gif\")"})
|
54
|
+
img.click(Messages.selectEmotion)
|
55
|
+
cell = $("<td></td>").addClass("chat-cell").append(img)
|
56
|
+
row.append(cell)
|
57
|
+
table.append(row)
|
58
|
+
false
|
59
|
+
|
60
|
+
displayAllEmotions: () ->
|
61
|
+
Messages.constructEmotions()
|
62
|
+
$("table.chatroom-emotions-images").toggle()
|
63
|
+
false
|
64
|
+
|
65
|
+
# Editor: select one emotion to textarea
|
66
|
+
selectEmotion: () ->
|
67
|
+
img = $(this).attr("emotion")
|
68
|
+
imageTag = "<img src=\"/assets/emotions/#{img}.gif\" />"
|
69
|
+
editor = $("#new_message_editor")
|
70
|
+
selectionStart = editor[0].selectionStart
|
71
|
+
editorCharArray = editor.val().split("")
|
72
|
+
editorCharArray.splice(selectionStart, 0, imageTag)
|
73
|
+
editorText = convertTagToMark(editorCharArray.join(''))
|
74
|
+
editor.val(editorText)
|
75
|
+
$("table.chatroom-emotions-images").toggle()
|
76
|
+
false
|
77
|
+
|
78
|
+
# Editor: show Every color in table
|
79
|
+
constructColors: () ->
|
80
|
+
colors = [
|
81
|
+
"#FFFFFF", "#000000", "#EEEEC1", "#1F497D", "#4F81BD", "#C0504D", "#9BBB59", "#8064A2", "#4BACC6", "#F79646",
|
82
|
+
"#F2F2F2", "#7F7F7F", "#DDD9C3", "#C6D9F0", "#DBE5F1", "#F2DCDB", "#EBF1DD", "#E5E0DC", "#DBEEF3", "#FDEADA",
|
83
|
+
"#D8D8D8", "#595959", "#C4DB97", "#8DB3E2", "#B8CCE4", "#E5B9B7", "#D7E3BC", "#CCC1D9", "#B7DDE8", "#FBD5b5",
|
84
|
+
"#BFBFBF", "#3F3F3F", "#938953", "#548DD4", "#95B3D7", "#D99694", "#C3D69B", "#B2A27C", "#92CDDC", "#FAC08F",
|
85
|
+
"#A5A5A5", "#262626", "#494429", "#17365D", "#366092", "#953734", "#76923C", "#5F497A", "#31859B", "#E36709",
|
86
|
+
"#7F7F7F", "#0C0C0C", "#1D1D10", "#0F243E", "#244061", "#632423", "#4F6128", "#3F3151", "#205867", "#974806",
|
87
|
+
"#C00000", "#FF0000", "#FFC000", "#FFFF00", "#92D050", "#00B050", "#00B0F0", "#0070C0", "#002060", "#7030A0"
|
88
|
+
]
|
89
|
+
|
90
|
+
constructColorsTab: () ->
|
91
|
+
colors = Messages.constructColors()
|
92
|
+
table = $("table.chatroom-font-colors tbody")
|
93
|
+
if !table.has("span").length
|
94
|
+
for i in [0...7]
|
95
|
+
row = $("<tr></tr>")
|
96
|
+
for j in [0...10]
|
97
|
+
n = i * 10 + j
|
98
|
+
color = $('<span></span>').addClass("font-color")
|
99
|
+
num = color.attr("color-num", "#{colors[n]}")
|
100
|
+
color.css({"background-color": "#{num.attr('color-num')}"})
|
101
|
+
color.click(Messages.selectColor)
|
102
|
+
cell = $("<td></td>").addClass("chat-cell").append(color)
|
103
|
+
row.append(cell)
|
104
|
+
table.append(row)
|
105
|
+
false
|
106
|
+
|
107
|
+
displayAllColors: () ->
|
108
|
+
Messages.constructColorsTab()
|
109
|
+
$("table.chatroom-font-colors").toggle()
|
110
|
+
false
|
111
|
+
|
112
|
+
# Editor: select one color for text
|
113
|
+
selectColor: () ->
|
114
|
+
color = $(this).attr("color-num")
|
115
|
+
fontTag = ["<span style=\"color: #{color}\">", "</span>"]
|
116
|
+
editor = $("#new_message_editor")
|
117
|
+
Messages.changeSelectionChar(fontTag)
|
118
|
+
$("table.chatroom-font-colors").toggle()
|
119
|
+
false
|
120
|
+
|
121
|
+
|
122
|
+
$(document).ready ->
|
123
|
+
$(".min-chatroom").click ->
|
124
|
+
Messages.minChatroom()
|
125
|
+
false
|
126
|
+
|
127
|
+
$(".max-chatroom").click ->
|
128
|
+
Messages.maxChatroom()
|
129
|
+
false
|
130
|
+
|
131
|
+
$(".emotions").click ->
|
132
|
+
Messages.displayAllEmotions()
|
133
|
+
false
|
134
|
+
|
135
|
+
$(".font-bloder").click ->
|
136
|
+
Messages.changeFontBlod()
|
137
|
+
false
|
138
|
+
|
139
|
+
$(".font-italic").click ->
|
140
|
+
Messages.changeFontItalic()
|
141
|
+
false
|
142
|
+
|
143
|
+
$(".font-colorer").click ->
|
144
|
+
Messages.displayAllColors()
|
145
|
+
false
|
@@ -0,0 +1,300 @@
|
|
1
|
+
// Place all the styles related to the Messages controller here.
|
2
|
+
// They will automatically be included in application.css.
|
3
|
+
// You can use Sass (SCSS) here: http://sass-lang.com/
|
4
|
+
|
5
|
+
$blueSea: #8bf;
|
6
|
+
$gray: #999999;
|
7
|
+
$white: #fff;
|
8
|
+
|
9
|
+
#chatroom {
|
10
|
+
-webkit-border-radius: 8px;
|
11
|
+
-moz-border-radius: 8px;
|
12
|
+
border-radius: 8px;
|
13
|
+
background-color: $white;
|
14
|
+
background-image: -webkit-linear-gradient(top, #8bf, #eee);
|
15
|
+
background-image: -moz-linear-gradient(top, #8bf, #eee);
|
16
|
+
background-image: -o-linear-gradient(top, #8bf, #eee);
|
17
|
+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB)";
|
18
|
+
position: fixed;
|
19
|
+
right: 0;
|
20
|
+
bottom: 0;
|
21
|
+
width: 400px;
|
22
|
+
height: 550px;
|
23
|
+
div.min-chatroom {
|
24
|
+
height: 35px;
|
25
|
+
text-align: center;
|
26
|
+
cursor: pointer;
|
27
|
+
}
|
28
|
+
.chat-show {
|
29
|
+
#chat {
|
30
|
+
// a complete message including information(time) and content
|
31
|
+
.message-line {
|
32
|
+
position: relative;
|
33
|
+
padding: 0px;
|
34
|
+
margin-top: 0px;
|
35
|
+
margin-left: 0px;
|
36
|
+
margin-bottom: 20px;
|
37
|
+
top: 0px;
|
38
|
+
display: block;
|
39
|
+
// the message information
|
40
|
+
.info-message {
|
41
|
+
position: relative;
|
42
|
+
display: block;
|
43
|
+
margin: 0px;
|
44
|
+
.sender {
|
45
|
+
padding-left: 3px;
|
46
|
+
display: inline;
|
47
|
+
position: relative;
|
48
|
+
font-weight: bold;
|
49
|
+
font-color: $gray;
|
50
|
+
}
|
51
|
+
.send-time {
|
52
|
+
position: relative;
|
53
|
+
float: right;
|
54
|
+
margin-right: 10px;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
// the message that you send
|
58
|
+
.say {
|
59
|
+
display: block;
|
60
|
+
position: relative;
|
61
|
+
margin-top: 10px;
|
62
|
+
padding-left: 10px; // the message that you sent must indent 10px
|
63
|
+
// change the message formation
|
64
|
+
span {
|
65
|
+
top: 0;
|
66
|
+
left: 0;
|
67
|
+
position: relative;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
position: relative;
|
72
|
+
height: 300px;
|
73
|
+
margin: 5px;
|
74
|
+
border: 1px solid $gray;
|
75
|
+
background-color: $white;
|
76
|
+
overflow-y: scroll;
|
77
|
+
}
|
78
|
+
span {
|
79
|
+
position: absolute;
|
80
|
+
top: 36px;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
.chat-send {
|
84
|
+
//------- Form
|
85
|
+
.send-message {
|
86
|
+
margin: 8px;
|
87
|
+
width: 100%;
|
88
|
+
position: relative;
|
89
|
+
div.send-bar {
|
90
|
+
height: 16px;
|
91
|
+
width: 95%;
|
92
|
+
margin-bottom: 0px;
|
93
|
+
border: 1px solid $gray;
|
94
|
+
border-bottom: none;
|
95
|
+
.emotions {
|
96
|
+
text-decoration: none;
|
97
|
+
position: relative;
|
98
|
+
width: 18px;
|
99
|
+
height: 16px;
|
100
|
+
text-align: center;
|
101
|
+
cursor: pointer;
|
102
|
+
.emotions-icon {
|
103
|
+
display: inline-block;
|
104
|
+
position: relative;
|
105
|
+
background: image-url("chatroom-icons/default.png") 0px -609px no-repeat;
|
106
|
+
width: 18px;
|
107
|
+
height: 16px;
|
108
|
+
border-right: 1px solid $gray;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
.font-bloder {
|
112
|
+
position: relative;
|
113
|
+
width: 18px;
|
114
|
+
height: 16px;
|
115
|
+
text-align: center;
|
116
|
+
cursor: pointer;
|
117
|
+
.font-bloder-icon {
|
118
|
+
display: inline-block;
|
119
|
+
position: relative;
|
120
|
+
background: image-url("chatroom-icons/default.png") 0px -416px no-repeat;
|
121
|
+
width: 18px;
|
122
|
+
height: 16px;
|
123
|
+
border-right: 1px solid $gray;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
.font-italic {
|
127
|
+
position: relative;
|
128
|
+
width: 18px;
|
129
|
+
height: 16px;
|
130
|
+
text-align: center;
|
131
|
+
cursor: pointer;
|
132
|
+
.font-italic-icon {
|
133
|
+
display: inline-block;
|
134
|
+
position: relative;
|
135
|
+
background: image-url("chatroom-icons/default.png") 0px -432px no-repeat;
|
136
|
+
width: 18px;
|
137
|
+
height: 16px;
|
138
|
+
border-right: 1px solid $gray;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
.font-colorer {
|
142
|
+
position: relative;
|
143
|
+
width: 20px;
|
144
|
+
height: 16px;
|
145
|
+
text-align: center;
|
146
|
+
cursor: pointer;
|
147
|
+
.font-colorer-icon {
|
148
|
+
display: inline-block;
|
149
|
+
position: relative;
|
150
|
+
background: image-url("chatroom-icons/default.png") 0px -384px no-repeat;
|
151
|
+
width: 20px;
|
152
|
+
height: 16px;
|
153
|
+
border-right: 1px solid $gray;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
#new_message_editor {
|
158
|
+
display: inline;
|
159
|
+
position: relative;
|
160
|
+
float: left;
|
161
|
+
width: 94%;
|
162
|
+
border: 1px $gray solid;
|
163
|
+
font-size: 14px;
|
164
|
+
font-family: "Tahoma", "SimSun";
|
165
|
+
word-wrap: break-word;
|
166
|
+
line-height: 18px;
|
167
|
+
overflow-x: hidden;
|
168
|
+
outline: none;
|
169
|
+
}
|
170
|
+
div.send {
|
171
|
+
input[type="submit"].btn {
|
172
|
+
position: relative;
|
173
|
+
margin: 10px;
|
174
|
+
float: right;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
//---------- when the chatroom hided, this thing show
|
182
|
+
#chatBeam {
|
183
|
+
-webkit-border-radius: 8px;
|
184
|
+
-moz-border-radius: 8px;
|
185
|
+
border-radius: 8px;
|
186
|
+
background-color: $white;
|
187
|
+
background-image: -webkit-linear-gradient(top, #8bf, #eee);
|
188
|
+
background-image: -moz-linear-gradient(top, #8bf, #eee);
|
189
|
+
background-image: -o-linear-gradient(top, #8bf, #eee);
|
190
|
+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB)";
|
191
|
+
background-repeat: repeat-x;
|
192
|
+
display: none;
|
193
|
+
position: fixed;
|
194
|
+
right: 0;
|
195
|
+
bottom: 0;
|
196
|
+
width: 400px;
|
197
|
+
div.max-chatroom {
|
198
|
+
height: 35px;
|
199
|
+
text-align: center;
|
200
|
+
cursor: pointer;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
//---------- emotions
|
205
|
+
table.chatroom-emotions-images {
|
206
|
+
border: 0;
|
207
|
+
margin: 0;
|
208
|
+
padding: 5px;
|
209
|
+
border-collapse: separate;
|
210
|
+
background-color: $white;
|
211
|
+
position: absolute;
|
212
|
+
left: 10px;
|
213
|
+
top: 2px;
|
214
|
+
z-index: 1;
|
215
|
+
display: none;
|
216
|
+
-webkit-border-radius: 6px;
|
217
|
+
-moz-border-radius: 6px;
|
218
|
+
border-radius: 6px;
|
219
|
+
tbody {
|
220
|
+
display: table-row-group;
|
221
|
+
vertical-align: middle;
|
222
|
+
border-color: inherit;
|
223
|
+
tr {
|
224
|
+
td.chat-cell {
|
225
|
+
margin: 0;
|
226
|
+
padding: 1px;
|
227
|
+
border: 1px solid #F0F0EE;
|
228
|
+
cursor: pointer;
|
229
|
+
span.emotion-img {
|
230
|
+
display: block;
|
231
|
+
overflow: hidden;
|
232
|
+
margin: 2px;
|
233
|
+
width: 24px;
|
234
|
+
height: 24px;
|
235
|
+
margin: 0;
|
236
|
+
padding: 0;
|
237
|
+
border: 0;
|
238
|
+
border: 1px $white solid;
|
239
|
+
&:hover {
|
240
|
+
border: 1px $blueSea solid;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
//---------- font-color picker
|
249
|
+
.chatroom-font-colors {
|
250
|
+
border: 0;
|
251
|
+
margin: 0;
|
252
|
+
padding: 2px;
|
253
|
+
border-collapse: separate;
|
254
|
+
background-color: $white;
|
255
|
+
position: absolute;
|
256
|
+
left: 14px;
|
257
|
+
top: 4px;
|
258
|
+
z-index: 1;
|
259
|
+
display: none;
|
260
|
+
-webkit-border-radius: 6px;
|
261
|
+
-moz-border-radius: 6px;
|
262
|
+
border-radius: 6px;
|
263
|
+
tbody {
|
264
|
+
display: table-row-group;
|
265
|
+
vertical-align: middle;
|
266
|
+
border-color: inherit;
|
267
|
+
tr {
|
268
|
+
td.chat-cell {
|
269
|
+
margin: 0;
|
270
|
+
padding: 1px;
|
271
|
+
border: 1px solid #F0F0EE;
|
272
|
+
cursor: pointer;
|
273
|
+
span.font-color {
|
274
|
+
display: block;
|
275
|
+
overflow: hidden;
|
276
|
+
margin: 1px;
|
277
|
+
width: 12px;
|
278
|
+
height: 12px;
|
279
|
+
margin: 0;
|
280
|
+
padding: 0;
|
281
|
+
border: 0;
|
282
|
+
border: 1px $white solid;
|
283
|
+
&:hover {
|
284
|
+
border: 1px $blueSea solid;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
}
|
288
|
+
}
|
289
|
+
}
|
290
|
+
}
|
291
|
+
|
292
|
+
.btn {
|
293
|
+
color: white;
|
294
|
+
background-color: $blueSea;
|
295
|
+
cursor: pointer;
|
296
|
+
padding: 2px 10px 2px 10px;
|
297
|
+
-webkit-border-radius: 6px;
|
298
|
+
-moz-border-radius: 6px;
|
299
|
+
border-radius: 6px;
|
300
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Chatroom
|
2
|
+
class MessagesController < ApplicationController
|
3
|
+
# GET /messages
|
4
|
+
def index
|
5
|
+
@messages = Message.all
|
6
|
+
end
|
7
|
+
|
8
|
+
# POST /messages
|
9
|
+
# POST /messages.json
|
10
|
+
def create
|
11
|
+
@message = Message.create!(message_params)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
16
|
+
def message_params
|
17
|
+
params.require(:message).permit(:content)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|