Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Broworkers
RailsPG
Commits
120a3e11
Commit
120a3e11
authored
Oct 14, 2012
by
Rafael Masoni
Browse files
Many chat improvements and bug fixes
parent
6b33afd7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
25 deletions
+23
-25
app/assets/javascripts/chats.js.coffee
app/assets/javascripts/chats.js.coffee
+2
-2
app/assets/stylesheets/base.css.sass
app/assets/stylesheets/base.css.sass
+4
-4
app/assets/stylesheets/chats.css.sass
app/assets/stylesheets/chats.css.sass
+4
-4
app/assets/stylesheets/sessions.css.sass
app/assets/stylesheets/sessions.css.sass
+2
-2
app/models/message.rb
app/models/message.rb
+5
-8
app/views/chats/show.html.haml
app/views/chats/show.html.haml
+2
-1
app/views/sessions/new.html.haml
app/views/sessions/new.html.haml
+2
-2
app/views/users/index.html.haml
app/views/users/index.html.haml
+2
-2
No files found.
app/assets/javascripts/chats.js.coffee
View file @
120a3e11
...
...
@@ -40,7 +40,7 @@ $ ->
return
value
[
1
]
else
return
''
$
.
fn
.
commandTrigger
=
->
messageStack
.
push
$
(
this
).
val
()
messageCursor
=
messageStack
.
length
...
...
@@ -50,7 +50,7 @@ $ ->
if
$
.
inArray
(
command
,
commandList
)
isnt
-
1
if
command
is
'/npc'
npc
=
$
(
this
).
getNpc
()
$
(
this
).
val
(
command
+
' '
+
npc
+
' '
)
$
(
this
).
val
(
command
+
' '
+
npc
+
' '
)
else
$
(
this
).
val
(
command
+
' '
)
if
commandHistory
[
0
]
isnt
command
...
...
app/assets/stylesheets/base.css.sass
View file @
120a3e11
...
...
@@ -27,7 +27,7 @@ em
font-style
:
italic
code
font-family
:
monospace
font-family
:
Menlo
,
Lucida
Console
,
monospace
// Navigation
...
...
@@ -170,14 +170,14 @@ aside
img
@include
box-shadow
(
0
0
0
2px
#fff
)
.
name
,
.
char
.
login
,
.
nick
overflow
:
hidden
text-overflow
:
ellipsis
white-space
:
nowrap
width
:
240px
.
char
.
nick
font-size
:
.9em
@include
opacity
(
.6
)
...
...
app/assets/stylesheets/chats.css.sass
View file @
120a3e11
...
...
@@ -38,7 +38,7 @@
.scope
:before
content
:
"["
.n
ame
.n
ick
&
:after
content
:
":"
...
...
@@ -74,7 +74,7 @@
&
.me
color
:
rgba
(
#000
,
.3
)
.n
ame
:after
.n
ick
:after
content
:
""
&
.tell
...
...
@@ -92,13 +92,13 @@
padding
:
.05em
.5em
@include
border-radius
(
.5em
)
.n
ame
:after
.n
ick
:after
content
:
""
&
.system
color
:
#36a
.n
ame
:after
.n
ick
:after
content
:
""
form
...
...
app/assets/stylesheets/sessions.css.sass
View file @
120a3e11
.
log
in
.
sign
in
background
:
#{
inline_image
(
"lightpaperfibers.png"
)
}
height
:
300px
left
:
50%
...
...
@@ -14,7 +14,7 @@
img
margin-bottom
:
5em
.
signin
.
twitter-auth
display
:
inline-block
background-color
:
#6de
border
:
none
...
...
app/models/message.rb
View file @
120a3e11
...
...
@@ -30,20 +30,18 @@ class Message
self
[
'login'
]
=
user
.
login
self
[
'nick'
]
=
user
.
nick
self
[
'classes'
]
=
[
'system'
]
self
[
'body'
]
=
"
#{
user
.
nick
}
(
#{
user
.
login
}
) now is
#{
$2
}
"
self
[
'body'
]
=
"(
#{
user
.
login
}
) now is
#{
$2
}
"
user
.
update_attributes
nick:
$2
when
%r[/(say|me) (.*)]i
self
[
'login'
]
=
user
.
login
self
[
'nick'
]
=
user
.
nick
self
[
'classes'
]
=
[
$1
]
self
[
'body'
]
=
$2
when
%r[/(ooc) (.*)]i
self
[
'login'
]
=
user
.
login
self
[
'nick'
]
=
user
.
nick
self
[
'classes'
]
=
[
$1
]
self
[
'scope'
]
=
'
ooc
'
self
[
'body'
]
=
$2
self
[
'scope'
]
=
'
OOC
'
self
[
'body'
]
=
"
#{
user
.
login
}
:
#{
$2
}
"
when
%r[/(npc) ([^:]*): *(.*)$]i
self
[
'classes'
]
=
[
$1
]
self
[
'scope'
]
=
'NPC'
...
...
@@ -56,13 +54,12 @@ class Message
dices
=
Dice
.
roll
(
$1
,
$2
)
self
[
'classes'
]
=
'dice'
self
[
'scope'
]
=
'Dice'
self
[
'body'
]
=
"
#{
user
.
nick
}
(
#{
user
.
login
}
)
rolls
#{
$1
}
d
#{
$2
}
:
#{
dices
.
join
(
' + '
)
}
= **
#{
dices
.
inject
{
|
s
,
d
|
s
+
d
}
}**"
self
[
'body'
]
=
"
#{
user
.
login
}
rolls
#{
$1
}
d
#{
$2
}
:
#{
dices
.
join
(
' + '
)
}
= **
#{
dices
.
inject
{
|
s
,
d
|
s
+
d
}
}**"
else
self
[
'login'
]
=
user
.
login
self
[
'nick'
]
=
user
.
nick
self
[
'classes'
]
=
[
'ooc'
]
self
[
'scope'
]
=
'OOC'
self
[
'body'
]
=
plain
self
[
'body'
]
=
"
#{
user
.
login
}
:
#{
plain
}
"
end
end
...
...
app/views/chats/show.html.haml
View file @
120a3e11
...
...
@@ -3,7 +3,8 @@
.content
.line.system.first
Welcome to RailsPG!
:markdown
Welcome to RailsPG! Set up a nickname with
`/nick Nickname`
.
=
form_for
Message
.
new
do
|
form
|
%fieldset
...
...
app/views/sessions/new.html.haml
View file @
120a3e11
.
log
in
.
sign
in
=
image_tag
'logo.png'
,
alt:
'RailsPG'
,
width:
'350px'
%br
...
...
@@ -6,4 +6,4 @@
-
if
flash
.
alert
.warning
=
flash
.
alert
=
link_to
'Sign in with Twitter'
,
'/auth/twitter'
,
class:
"
signin
"
=
link_to
'Sign in with Twitter'
,
'/auth/twitter'
,
class:
"
twitter-auth
"
app/views/users/index.html.haml
View file @
120a3e11
-
@users
.
each
do
|
user
|
%li
{
class:
classes_for
(
user
)
}
=
image_tag
"user.png"
,
alt:
""
.
name
=
user
.
login
.
char
=
user
.
nick
.
login
=
user
.
login
.
nick
=
user
.
nick
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment