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
1062ae46
Commit
1062ae46
authored
Dec 24, 2017
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
45c22b20
a6d4419c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
136 additions
and
127 deletions
+136
-127
spec/bookmarks.js
spec/bookmarks.js
+3
-1
spec/chatroom.js
spec/chatroom.js
+11
-0
src/converse-bookmarks.js
src/converse-bookmarks.js
+33
-40
src/converse-muc.js
src/converse-muc.js
+85
-82
src/templates/bookmarks_list.html
src/templates/bookmarks_list.html
+1
-1
src/utils.js
src/utils.js
+3
-3
No files found.
spec/bookmarks.js
View file @
1062ae46
...
...
@@ -482,12 +482,14 @@
test_utils
.
waitUntil
(
function
()
{
return
$
(
'
#chatrooms dl.bookmarks dd:visible
'
).
length
;
},
300
).
then
(
function
()
{
expect
(
$
(
'
#chatrooms dl.bookmarks
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms dl.bookmarks dd:visible
'
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
$
(
'
#chatrooms .bookmarks-toggle
'
).
click
();
expect
(
$
(
'
#chatrooms dl.bookmarks
dd:visible
'
).
length
).
toBe
(
0
);
expect
(
$
(
'
#chatrooms dl.bookmarks
'
).
hasClass
(
'
collapsed
'
)).
toBeTruthy
(
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
CLOSED
);
$
(
'
#chatrooms .bookmarks-toggle
'
).
click
();
expect
(
$
(
'
#chatrooms dl.bookmarks
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms dl.bookmarks dd:visible
'
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
done
();
...
...
spec/chatroom.js
View file @
1062ae46
...
...
@@ -2417,6 +2417,13 @@
expect
(
view
.
renderPasswordForm
).
toHaveBeenCalled
();
expect
(
$chat_body
.
find
(
'
form.chatroom-form
'
).
length
).
toBe
(
1
);
expect
(
$chat_body
.
find
(
'
legend
'
).
text
()).
toBe
(
'
This chatroom requires a password
'
);
// Let's submit the form
spyOn
(
view
,
'
join
'
);
var
input_el
=
view
.
el
.
querySelector
(
'
[name="password"]
'
);
input_el
.
value
=
'
secret
'
;
view
.
el
.
querySelector
(
'
input[type=submit]
'
).
click
();
expect
(
view
.
join
).
toHaveBeenCalledWith
(
undefined
,
"
secret
"
);
done
();
}));
...
...
@@ -2480,6 +2487,10 @@
spyOn
(
view
,
'
showErrorMessage
'
).
and
.
callThrough
();
view
.
onChatRoomPresence
(
presence
);
expect
(
view
.
$el
.
find
(
'
.chatroom-body form.chatroom-form label:first
'
).
text
()).
toBe
(
'
Please choose your nickname
'
);
var
$input
=
view
.
$el
.
find
(
'
.chatroom-body form.chatroom-form input:first
'
);
$input
.
val
(
'
nicky
'
);
view
.
el
.
querySelector
(
'
input[type=submit]
'
).
click
();
done
();
}));
...
...
src/converse-bookmarks.js
View file @
1062ae46
...
...
@@ -10,8 +10,7 @@
* in XEP-0048.
*/
(
function
(
root
,
factory
)
{
define
([
"
jquery.noconflict
"
,
"
utils
"
,
define
([
"
utils
"
,
"
converse-core
"
,
"
converse-muc
"
,
"
tpl!chatroom_bookmark_form
"
,
...
...
@@ -21,8 +20,7 @@
],
factory
);
}(
this
,
function
(
$
,
utils
,
u
,
converse
,
muc
,
tpl_chatroom_bookmark_form
,
...
...
@@ -135,7 +133,7 @@
child
.
classList
.
add
(
'
hidden
'
);
});
// Remove any existing forms
_
.
each
(
body
.
querySelectorAll
(
'
.chatroom-form-container
'
),
u
tils
.
removeElement
);
_
.
each
(
body
.
querySelectorAll
(
'
.chatroom-form-container
'
),
u
.
removeElement
);
body
.
insertAdjacentHTML
(
'
beforeend
'
,
...
...
@@ -163,18 +161,14 @@
onBookmarkFormSubmitted
(
ev
)
{
ev
.
preventDefault
();
const
{
_converse
}
=
this
.
__super__
;
const
$form
=
$
(
ev
.
target
),
that
=
this
;
_converse
.
bookmarks
.
createBookmark
({
'
jid
'
:
this
.
model
.
get
(
'
jid
'
),
'
autojoin
'
:
$form
.
find
(
'
input[name="autojoin"]
'
).
prop
(
'
checked
'
)
,
'
name
'
:
$form
.
find
(
'
input[name=name]
'
).
val
(
),
'
nick
'
:
$form
.
find
(
'
input[name=nick]
'
).
val
(
)
'
autojoin
'
:
_
.
get
(
ev
.
target
.
querySelector
(
'
input[name="autojoin"]
'
),
'
checked
'
)
||
false
,
'
name
'
:
_
.
get
(
ev
.
target
.
querySelector
(
'
input[name=name]
'
),
'
value
'
),
'
nick
'
:
_
.
get
(
ev
.
target
.
querySelector
(
'
input[name=nick]
'
),
'
value
'
)
});
this
.
$el
.
find
(
'
div.chatroom-form-container
'
).
hide
(
function
()
{
$
(
this
).
remove
();
that
.
renderAfterTransition
();
});
u
.
removeElement
(
this
.
el
.
querySelector
(
'
div.chatroom-form-container
'
));
this
.
renderAfterTransition
();
},
toggleBookmark
(
ev
)
{
...
...
@@ -249,6 +243,7 @@
_converse
.
Bookmarks
=
Backbone
.
Collection
.
extend
({
model
:
_converse
.
Bookmark
,
comparator
:
'
name
'
,
initialize
()
{
this
.
on
(
'
add
'
,
_
.
flow
(
this
.
openBookmarkedRoom
,
this
.
markRoomAsBookmarked
));
...
...
@@ -270,7 +265,7 @@
},
fetchBookmarks
()
{
const
deferred
=
u
tils
.
getResolveablePromise
();
const
deferred
=
u
.
getResolveablePromise
();
if
(
this
.
browserStorage
.
records
.
length
>
0
)
{
this
.
fetch
({
'
success
'
:
_
.
bind
(
this
.
onCachedBookmarksFetched
,
this
,
deferred
),
...
...
@@ -363,12 +358,12 @@
},
onBookmarksReceived
(
deferred
,
iq
)
{
const
bookmarks
=
$
(
iq
).
find
(
'
items[node="storage:bookmarks"] item[id="current"] storage conference
'
);
const
that
=
this
;
_
.
forEach
(
bookmarks
,
function
(
bookmark
)
{
th
at
.
create
({
const
bookmarks
=
sizzle
(
'
items[node="storage:bookmarks"] item[id="current"] storage conference
'
,
iq
)
_
.
forEach
(
bookmarks
,
(
bookmark
)
=>
{
th
is
.
create
({
'
jid
'
:
bookmark
.
getAttribute
(
'
jid
'
),
'
name
'
:
bookmark
.
getAttribute
(
'
name
'
),
'
autojoin
'
:
bookmark
.
getAttribute
(
'
autojoin
'
)
===
'
true
'
,
...
...
@@ -392,7 +387,7 @@
_converse
.
BookmarksView
=
Backbone
.
View
.
extend
({
tagName
:
'
div
'
,
className
:
'
bookmarks-list
, rooms-list-container
'
,
className
:
'
bookmarks-list
rooms-list-container hidden
'
,
events
:
{
'
click .add-bookmark
'
:
'
addBookmark
'
,
'
click .bookmarks-toggle
'
:
'
toggleBookmarksList
'
,
...
...
@@ -416,20 +411,19 @@
},
render
()
{
this
.
$el
.
html
(
tpl_bookmarks_list
({
this
.
el
.
innerHTML
=
tpl_bookmarks_list
({
'
toggle_state
'
:
this
.
list_model
.
get
(
'
toggle-state
'
),
'
desc_bookmarks
'
:
__
(
'
Click to toggle the bookmarks list
'
),
'
label_bookmarks
'
:
__
(
'
Bookmarks
'
)
})).
hide
();
if
(
this
.
list_model
.
get
(
'
toggle-state
'
)
!==
_converse
.
OPENED
)
{
this
.
$
(
'
.bookmarks
'
).
hide
();
}
'
label_bookmarks
'
:
__
(
'
Bookmarks
'
),
'
_converse
'
:
_converse
});
this
.
model
.
each
(
this
.
renderBookmarkListElement
.
bind
(
this
));
const
controlboxview
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
);
if
(
!
_
.
isUndefined
(
controlboxview
))
{
this
.
$el
.
prependTo
(
controlboxview
.
$
(
'
#chatrooms
'
));
const
chatrooms_el
=
controlboxview
.
el
.
querySelector
(
'
#chatrooms
'
);
chatrooms_el
.
insertAdjacentElement
(
'
afterbegin
'
,
this
.
el
);
}
return
this
.
$el
;
return
this
;
},
removeBookmark
:
_converse
.
removeBookmarkViaEvent
,
...
...
@@ -477,13 +471,11 @@
},
show
()
{
if
(
!
this
.
$el
.
is
(
'
:visible
'
))
{
this
.
$el
.
show
();
}
u
.
showElement
(
this
.
el
);
},
hide
()
{
this
.
$el
.
hide
(
);
u
.
hideElement
(
this
.
el
);
},
removeBookmarkListElement
(
item
)
{
...
...
@@ -499,14 +491,15 @@
toggleBookmarksList
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
const
$el
=
$
(
ev
.
target
);
if
(
$el
.
hasClass
(
"
icon-opened
"
))
{
this
.
$
(
'
.bookmarks
'
).
slideUp
(
'
fast
'
);
if
(
u
.
hasClass
(
ev
.
target
,
'
icon-opened
'
))
{
u
.
slideIn
(
this
.
el
.
querySelector
(
'
.bookmarks
'
));
this
.
list_model
.
save
({
'
toggle-state
'
:
_converse
.
CLOSED
});
$el
.
removeClass
(
"
icon-opened
"
).
addClass
(
"
icon-closed
"
);
ev
.
target
.
classList
.
remove
(
"
icon-opened
"
);
ev
.
target
.
classList
.
add
(
"
icon-closed
"
);
}
else
{
$el
.
removeClass
(
"
icon-closed
"
).
addClass
(
"
icon-opened
"
);
this
.
$
(
'
.bookmarks
'
).
slideDown
(
'
fast
'
);
ev
.
target
.
classList
.
remove
(
"
icon-closed
"
);
ev
.
target
.
classList
.
add
(
"
icon-opened
"
);
u
.
slideOut
(
this
.
el
.
querySelector
(
'
.bookmarks
'
));
this
.
list_model
.
save
({
'
toggle-state
'
:
_converse
.
OPENED
});
}
}
...
...
src/converse-muc.js
View file @
1062ae46
This diff is collapsed.
Click to expand it.
src/templates/bookmarks_list.html
View file @
1062ae46
<a
href=
"#"
class=
"rooms-toggle bookmarks-toggle icon-{{{o.toggle_state}}}"
title=
"{{{o.desc_bookmarks}}}"
>
{{{o.label_bookmarks}}}
</a>
<dl
class=
"bookmarks rooms-list"
></dl>
<dl
class=
"bookmarks rooms-list
{[ if (o.toggle_state !== o._converse.OPENED) { ]} hidden {[ } ]}
"
></dl>
src/utils.js
View file @
1062ae46
...
...
@@ -241,11 +241,11 @@
logger
.
warn
(
err
);
return
reject
(
new
Error
(
err
));
}
else
if
(
_
.
includes
(
el
.
classList
,
'
collapsed
'
))
{
return
resolve
();
return
resolve
(
el
);
}
else
if
(
window
.
converse_disable_effects
)
{
// Effects are disabled (for tests)
el
.
classList
.
add
(
'
collapsed
'
);
el
.
style
.
height
=
""
;
return
resolve
();
return
resolve
(
el
);
}
const
marker
=
el
.
getAttribute
(
'
data-slider-marker
'
);
if
(
marker
)
{
...
...
@@ -270,7 +270,7 @@
el
.
removeAttribute
(
'
data-slider-marker
'
);
el
.
classList
.
add
(
'
collapsed
'
);
el
.
style
.
height
=
""
;
resolve
();
resolve
(
el
);
}
}
el
.
setAttribute
(
...
...
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