Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
a1e24c95
Commit
a1e24c95
authored
Jul 26, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nickname to chat message when clicking on room occupant.
Allows you to easily mention someone in your message.
parent
e0215c99
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
16 deletions
+37
-16
README.md
README.md
+2
-2
css/converse.css
css/converse.css
+2
-0
docs/CHANGES.md
docs/CHANGES.md
+2
-0
sass/_chatrooms.scss
sass/_chatrooms.scss
+3
-0
spec/chatroom.js
spec/chatroom.js
+1
-1
src/converse-chatview.js
src/converse-chatview.js
+10
-6
src/converse-muc.js
src/converse-muc.js
+13
-3
src/templates/occupant.html
src/templates/occupant.html
+4
-4
No files found.
README.md
View file @
a1e24c95
...
@@ -10,8 +10,8 @@ to, either your own, or a public one.
...
@@ -10,8 +10,8 @@ to, either your own, or a public one.
## Demo
## Demo
A live demo is available at
[
https://conversejs.org
](
https://conversejs.org
)
-
A live demo is available at
[
https://conversejs.org
](
https://conversejs.org
)
A demo showing anonymous login is available at
[
https://conversejs.org/demo/anonymous.html
](
https://conversejs.org/demo/anonymous.html
)
-
A demo showing anonymous login is available at
[
https://conversejs.org/demo/anonymous.html
](
https://conversejs.org/demo/anonymous.html
)
## Documentation
## Documentation
...
...
css/converse.css
View file @
a1e24c95
...
@@ -2044,6 +2044,8 @@
...
@@ -2044,6 +2044,8 @@
text-overflow
:
ellipsis
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
white-space
:
nowrap
;
width
:
100px
;
}
width
:
100px
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.occupants
.occupant-list
li
.occupant
{
cursor
:
pointer
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.occupants
.occupant-list
li
.moderator
{
#conversejs
.chatroom
.box-flyout
.chatroom-body
.occupants
.occupant-list
li
.moderator
{
color
:
#D24E2B
;
}
color
:
#D24E2B
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.chatroom-form-container
{
#conversejs
.chatroom
.box-flyout
.chatroom-body
.chatroom-form-container
{
...
...
docs/CHANGES.md
View file @
a1e24c95
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
[jcbrand]
[jcbrand]
-
Check whether the user has a reserved nickname before entering a room, and if so,
-
Check whether the user has a reserved nickname before entering a room, and if so,
use it. [jcbrand]
use it. [jcbrand]
-
Mention someone in your chat room message by clicking on their name in the occupants
list. [jcbrand]
## 1.0.4 (2016-07-26)
## 1.0.4 (2016-07-26)
...
...
sass/_chatrooms.scss
View file @
a1e24c95
...
@@ -109,6 +109,9 @@
...
@@ -109,6 +109,9 @@
text-overflow
:
ellipsis
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
white-space
:
nowrap
;
width
:
100px
;
width
:
100px
;
&
.occupant
{
cursor
:
pointer
;
}
&
.moderator
{
&
.moderator
{
color
:
$moderator-color
;
color
:
$moderator-color
;
}
}
...
...
spec/chatroom.js
View file @
a1e24c95
...
@@ -242,7 +242,7 @@
...
@@ -242,7 +242,7 @@
expect
(
$
(
occupant
).
first
().
text
()).
toBe
(
"
dummy
"
);
expect
(
$
(
occupant
).
first
().
text
()).
toBe
(
"
dummy
"
);
expect
(
$
(
occupant
).
last
().
text
()).
toBe
(
"
moderatorman
"
);
expect
(
$
(
occupant
).
last
().
text
()).
toBe
(
"
moderatorman
"
);
expect
(
$
(
occupant
).
last
().
attr
(
'
class
'
).
indexOf
(
'
moderator
'
)).
not
.
toBe
(
-
1
);
expect
(
$
(
occupant
).
last
().
attr
(
'
class
'
).
indexOf
(
'
moderator
'
)).
not
.
toBe
(
-
1
);
expect
(
$
(
occupant
).
last
().
attr
(
'
title
'
)).
toBe
(
'
This user is a moderator
'
);
expect
(
$
(
occupant
).
last
().
attr
(
'
title
'
)).
toBe
(
'
This user is a moderator
. Click to mention this user in your message.
'
);
});
});
it
(
"
will use the user's reserved nickname, if it exists
"
,
function
()
{
it
(
"
will use the user's reserved nickname, if it exists
"
,
function
()
{
...
...
src/converse-chatview.js
View file @
a1e24c95
...
@@ -551,17 +551,21 @@
...
@@ -551,17 +551,21 @@
return
this
;
return
this
;
},
},
insertIntoTextArea
:
function
(
value
)
{
var
$textbox
=
this
.
$el
.
find
(
'
textarea.chat-textarea
'
);
var
existing
=
$textbox
.
val
();
if
(
existing
&&
(
existing
[
existing
.
length
-
1
]
!==
'
'
))
{
existing
=
existing
+
'
'
;
}
$textbox
.
focus
().
val
(
existing
+
value
+
'
'
);
},
insertEmoticon
:
function
(
ev
)
{
insertEmoticon
:
function
(
ev
)
{
ev
.
stopPropagation
();
ev
.
stopPropagation
();
this
.
$el
.
find
(
'
.toggle-smiley ul
'
).
slideToggle
(
200
);
this
.
$el
.
find
(
'
.toggle-smiley ul
'
).
slideToggle
(
200
);
var
$textbox
=
this
.
$el
.
find
(
'
textarea.chat-textarea
'
);
var
value
=
$textbox
.
val
();
var
$target
=
$
(
ev
.
target
);
var
$target
=
$
(
ev
.
target
);
$target
=
$target
.
is
(
'
a
'
)
?
$target
:
$target
.
children
(
'
a
'
);
$target
=
$target
.
is
(
'
a
'
)
?
$target
:
$target
.
children
(
'
a
'
);
if
(
value
&&
(
value
[
value
.
length
-
1
]
!==
'
'
))
{
this
.
insertIntoTextArea
(
$target
.
data
(
'
emoticon
'
));
value
=
value
+
'
'
;
}
$textbox
.
focus
().
val
(
value
+
$target
.
data
(
'
emoticon
'
)
+
'
'
);
},
},
toggleEmoticonMenu
:
function
(
ev
)
{
toggleEmoticonMenu
:
function
(
ev
)
{
...
...
src/converse-muc.js
View file @
a1e24c95
...
@@ -186,6 +186,7 @@
...
@@ -186,6 +186,7 @@
'
click .toggle-call
'
:
'
toggleCall
'
,
'
click .toggle-call
'
:
'
toggleCall
'
,
'
click .toggle-occupants a
'
:
'
toggleOccupants
'
,
'
click .toggle-occupants a
'
:
'
toggleOccupants
'
,
'
click .new-msgs-indicator
'
:
'
viewUnreadMessages
'
,
'
click .new-msgs-indicator
'
:
'
viewUnreadMessages
'
,
'
click .occupant
'
:
'
onOccupantClicked
'
,
'
keypress textarea.chat-textarea
'
:
'
keyPressed
'
'
keypress textarea.chat-textarea
'
:
'
keyPressed
'
},
},
...
@@ -284,6 +285,13 @@
...
@@ -284,6 +285,13 @@
}
}
},
},
onOccupantClicked
:
function
(
ev
)
{
/* When an occupant is clicked, insert their nickname into
* the chat textarea input.
*/
this
.
insertIntoTextArea
(
ev
.
target
.
textContent
);
},
directInvite
:
function
(
recipient
,
reason
)
{
directInvite
:
function
(
recipient
,
reason
)
{
var
attrs
=
{
var
attrs
=
{
xmlns
:
'
jabber:x:conference
'
,
xmlns
:
'
jabber:x:conference
'
,
...
@@ -1032,13 +1040,15 @@
...
@@ -1032,13 +1040,15 @@
this
.
model
.
on
(
'
change
'
,
this
.
render
,
this
);
this
.
model
.
on
(
'
change
'
,
this
.
render
,
this
);
this
.
model
.
on
(
'
destroy
'
,
this
.
destroy
,
this
);
this
.
model
.
on
(
'
destroy
'
,
this
.
destroy
,
this
);
},
},
render
:
function
()
{
render
:
function
()
{
var
new_el
=
converse
.
templates
.
occupant
(
var
new_el
=
converse
.
templates
.
occupant
(
_
.
extend
(
_
.
extend
(
this
.
model
.
toJSON
(),
{
this
.
model
.
toJSON
(),
{
'
desc_moderator
'
:
__
(
'
This user is a moderator
'
),
'
hint_occupant
'
:
__
(
'
Click to mention this user in your message.
'
),
'
desc_occupant
'
:
__
(
'
This user can send messages in this room
'
),
'
desc_moderator
'
:
__
(
'
This user is a moderator.
'
),
'
desc_visitor
'
:
__
(
'
This user can NOT send messages in this room
'
)
'
desc_occupant
'
:
__
(
'
This user can send messages in this room.
'
),
'
desc_visitor
'
:
__
(
'
This user can NOT send messages in this room.
'
)
})
})
);
);
var
$parents
=
this
.
$el
.
parents
();
var
$parents
=
this
.
$el
.
parents
();
...
...
src/templates/occupant.html
View file @
a1e24c95
<li
class=
"{{role}}"
id=
"{{id}}"
<li
class=
"{{role}}
occupant
"
id=
"{{id}}"
{[
if
(role =
==
"
moderator
")
{
]}
{[
if
(role =
==
"
moderator
")
{
]}
title=
"{{desc_moderator}}"
title=
"{{desc_moderator}}
{{hint_occupant}}
"
{[
}
]}
{[
}
]}
{[
if
(role =
==
"
occupant
")
{
]}
{[
if
(role =
==
"
occupant
")
{
]}
title=
"{{desc_occupant}}"
title=
"{{desc_occupant}}
{{hint_occupant}}
"
{[
}
]}
{[
}
]}
{[
if
(role =
==
"
visitor
")
{
]}
{[
if
(role =
==
"
visitor
")
{
]}
title=
"{{desc_visitor}}"
title=
"{{desc_visitor}}
{{hint_occupant}}
"
{[
}
]}
>
{{nick}}
</li>
{[
}
]}
>
{{nick}}
</li>
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