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
85bea600
Commit
85bea600
authored
Dec 06, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some of refactoring to avoid code duplication and jQuery
parent
292a75d3
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
78 deletions
+107
-78
spec/bookmarks.js
spec/bookmarks.js
+2
-2
src/converse-bookmarks.js
src/converse-bookmarks.js
+4
-6
src/converse-muc.js
src/converse-muc.js
+87
-68
src/templates/chatarea.html
src/templates/chatarea.html
+1
-1
src/templates/chatroom.html
src/templates/chatroom.html
+1
-1
src/utils.js
src/utils.js
+12
-0
No files found.
spec/bookmarks.js
View file @
85bea600
...
...
@@ -32,14 +32,14 @@
var
jid
=
'
theplay@conference.shakespeare.lit
'
;
var
view
=
_converse
.
chatboxviews
.
get
(
jid
);
spyOn
(
view
,
'
renderBookmarkForm
'
).
and
.
callThrough
();
spyOn
(
view
,
'
c
ancelConfiguration
'
).
and
.
callThrough
();
spyOn
(
view
,
'
c
loseForm
'
).
and
.
callThrough
();
var
$bookmark
=
view
.
$el
.
find
(
'
.icon-pushpin
'
);
$bookmark
.
click
();
expect
(
view
.
renderBookmarkForm
).
toHaveBeenCalled
();
view
.
$el
.
find
(
'
.button-cancel
'
).
click
();
expect
(
view
.
c
ancelConfiguration
).
toHaveBeenCalled
();
expect
(
view
.
c
loseForm
).
toHaveBeenCalled
();
expect
(
$bookmark
.
hasClass
(
'
on-button
'
),
false
);
$bookmark
.
click
();
...
...
src/converse-bookmarks.js
View file @
85bea600
...
...
@@ -132,10 +132,8 @@
child
.
classList
.
add
(
'
hidden
'
);
});
// Remove any existing forms
let
form
=
body
.
querySelector
(
'
form.chatroom-form
'
);
if
(
!
_
.
isNull
(
form
))
{
form
.
parentNode
.
removeChild
(
form
);
}
_
.
each
(
body
.
querySelectorAll
(
'
.chatroom-form-container
'
),
utils
.
removeElement
);
body
.
insertAdjacentHTML
(
'
beforeend
'
,
tpl_chatroom_bookmark_form
({
...
...
@@ -148,14 +146,14 @@
label_cancel
:
__
(
'
Cancel
'
)
})
);
form
=
body
.
querySelector
(
'
form.chatroom-form
'
);
const
form
=
body
.
querySelector
(
'
form.chatroom-form
'
);
form
.
addEventListener
(
'
submit
'
,
this
.
onBookmarkFormSubmitted
.
bind
(
this
)
);
form
.
querySelector
(
'
.button-cancel
'
).
addEventListener
(
'
click
'
,
this
.
c
ancelConfiguration
.
bind
(
this
)
this
.
c
loseForm
.
bind
(
this
)
);
},
...
...
src/converse-muc.js
View file @
85bea600
This diff is collapsed.
Click to expand it.
src/templates/chatarea.html
View file @
85bea600
...
...
@@ -6,7 +6,7 @@
<ul
class=
"chat-toolbar no-text-select"
></ul>
{[ } ]}
<textarea
type=
"text"
class=
"chat-textarea {[ if (o.show_send_button) { ]}chat-textarea-send-button{[ } ]}"
placeholder=
"{{{o.label_message}}}"
/
>
placeholder=
"{{{o.label_message}}}"
></textarea
>
{[ if (o.show_send_button) { ]}
<button
type=
"submit"
class=
"pure-button send-button"
>
{{{ o.label_send }}}
</button>
{[ } ]}
...
...
src/templates/chatroom.html
View file @
85bea600
<div
class=
"flyout box-flyout"
>
<div
class=
"chat-head chat-head-chatroom"
></div>
<div
class=
"chat-body chatroom-body"
><
span
class=
"spinner centered"
/><
/div>
<div
class=
"chat-body chatroom-body"
></div>
</div>
src/utils.js
View file @
85bea600
...
...
@@ -104,6 +104,18 @@
var
u
=
{};
u
.
removeElement
=
function
(
el
)
{
if
(
!
_
.
isNil
(
el
)
&&
!
_
.
isNil
(
el
.
parentNode
))
{
el
.
parentNode
.
removeChild
(
el
);
}
}
u
.
hideElement
=
function
(
el
)
{
if
(
!
_
.
isNil
(
el
))
{
el
.
classList
.
add
(
'
hidden
'
);
}
}
u
.
addHyperlinks
=
function
(
text
)
{
const
list
=
text
.
match
(
URL_REGEX
)
||
[];
var
links
=
[];
...
...
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