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
828eac1e
Commit
828eac1e
authored
Dec 28, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rosterview: Move more lodash templates to lit-html
parent
bb3ac360
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
63 additions
and
54 deletions
+63
-54
src/plugins/rosterview/contactview.js
src/plugins/rosterview/contactview.js
+10
-17
src/plugins/rosterview/groupview.js
src/plugins/rosterview/groupview.js
+5
-5
src/plugins/rosterview/templates/group_header.html
src/plugins/rosterview/templates/group_header.html
+0
-4
src/plugins/rosterview/templates/group_header.js
src/plugins/rosterview/templates/group_header.js
+9
-0
src/plugins/rosterview/templates/pending_contact.html
src/plugins/rosterview/templates/pending_contact.html
+0
-6
src/plugins/rosterview/templates/pending_contact.js
src/plugins/rosterview/templates/pending_contact.js
+12
-0
src/plugins/rosterview/templates/requesting_contact.html
src/plugins/rosterview/templates/requesting_contact.html
+0
-11
src/plugins/rosterview/templates/requesting_contact.js
src/plugins/rosterview/templates/requesting_contact.js
+11
-0
src/plugins/rosterview/templates/roster_item.html
src/plugins/rosterview/templates/roster_item.html
+0
-11
src/plugins/rosterview/templates/roster_item.js
src/plugins/rosterview/templates/roster_item.js
+16
-0
No files found.
src/plugins/rosterview/contactview.js
View file @
828eac1e
import
ViewWithAvatar
from
'
shared/avatar.js
'
;
import
log
from
"
@converse/headless/log
"
;
import
tpl_pending_contact
from
"
./templates/pending_contact.
html
"
;
import
tpl_requesting_contact
from
"
./templates/requesting_contact.
html
"
;
import
tpl_roster_item
from
"
./templates/roster_item.
html
"
;
import
tpl_pending_contact
from
"
./templates/pending_contact.
js
"
;
import
tpl_requesting_contact
from
"
./templates/requesting_contact.
js
"
;
import
tpl_roster_item
from
"
./templates/roster_item.
js
"
;
import
{
__
}
from
'
i18n
'
;
import
{
_converse
,
api
,
converse
}
from
"
@converse/headless/core
"
;
import
{
debounce
,
without
}
from
"
lodash-es
"
;
import
{
render
}
from
'
lit-html
'
;
const
u
=
converse
.
env
.
utils
;
...
...
@@ -89,24 +90,19 @@ const RosterContactView = ViewWithAvatar.extend({
*/
const
display_name
=
this
.
model
.
getDisplayName
();
this
.
el
.
classList
.
add
(
'
pending-xmpp-contact
'
);
this
.
el
.
innerHTML
=
tpl_pending_contact
(
Object
.
assign
(
this
.
model
.
toJSON
(),
{
display_name
,
'
desc_remove
'
:
__
(
'
Click to remove %1$s as a contact
'
,
display_name
),
'
allow_chat_pending_contacts
'
:
api
.
settings
.
get
(
'
allow_chat_pending_contacts
'
)
})
);
render
(
tpl_pending_contact
(
Object
.
assign
(
this
.
model
.
toJSON
(),
{
display_name
})),
this
.
el
);
}
else
if
(
requesting
===
true
)
{
const
display_name
=
this
.
model
.
getDisplayName
();
this
.
el
.
classList
.
add
(
'
requesting-xmpp-contact
'
);
this
.
el
.
innerHTML
=
tpl_requesting_contact
(
render
(
tpl_requesting_contact
(
Object
.
assign
(
this
.
model
.
toJSON
(),
{
display_name
,
'
desc_accept
'
:
__
(
"
Click to accept the contact request from %1$s
"
,
display_name
),
'
desc_decline
'
:
__
(
"
Click to decline the contact request from %1$s
"
,
display_name
),
'
allow_chat_pending_contacts
'
:
api
.
settings
.
get
(
'
allow_chat_pending_contacts
'
)
})
);
)
,
this
.
el
)
;
}
else
if
(
subscription
===
'
both
'
||
subscription
===
'
to
'
||
_converse
.
rosterview
.
isSelf
(
jid
))
{
this
.
el
.
classList
.
add
(
'
current-xmpp-contact
'
);
this
.
el
.
classList
.
remove
(
without
([
'
both
'
,
'
to
'
],
subscription
)[
0
]);
...
...
@@ -147,19 +143,16 @@ const RosterContactView = ViewWithAvatar.extend({
status_icon
=
'
fa fa-times-circle chat-status chat-status--offline
'
;
}
const
display_name
=
item
.
getDisplayName
();
this
.
el
.
innerHTML
=
tpl_roster_item
(
render
(
tpl_roster_item
(
Object
.
assign
(
item
.
toJSON
(),
{
show
,
display_name
,
status_icon
,
'
desc_status
'
:
STATUSES
[
show
],
'
desc_chat
'
:
__
(
'
Click to chat with %1$s (XMPP address: %2$s)
'
,
display_name
,
item
.
get
(
'
jid
'
)),
'
desc_remove
'
:
__
(
'
Click to remove %1$s as a contact
'
,
display_name
),
'
allow_contact_removal
'
:
api
.
settings
.
get
(
'
allow_contact_removal
'
),
'
num_unread
'
:
item
.
get
(
'
num_unread
'
)
||
0
,
classes
:
''
})
);
)
,
this
.
el
)
;
this
.
renderAvatar
();
return
this
;
},
...
...
src/plugins/rosterview/groupview.js
View file @
828eac1e
import
RosterContactView
from
'
./contactview.js
'
;
import
tpl_group_header
from
"
./templates/group_header.
html
"
;
import
tpl_group_header
from
"
./templates/group_header.
js
"
;
import
{
OrderedListView
}
from
"
@converse/skeletor/src/overview
"
;
import
{
_converse
,
api
,
converse
}
from
"
@converse/headless/core
"
;
import
{
render
}
from
'
lit-html
'
;
const
u
=
converse
.
env
.
utils
;
...
...
@@ -54,12 +55,11 @@ const RosterGroupView = OrderedListView.extend({
render
()
{
this
.
el
.
setAttribute
(
'
data-group
'
,
this
.
model
.
get
(
'
name
'
));
this
.
el
.
innerHTML
=
tpl_group_header
({
render
(
tpl_group_header
({
'
label_group
'
:
this
.
model
.
get
(
'
name
'
),
'
desc_group_toggle
'
:
this
.
model
.
get
(
'
description
'
),
'
toggle_state
'
:
this
.
model
.
get
(
'
state
'
),
'
_converse
'
:
_converse
});
'
toggle_state
'
:
this
.
model
.
get
(
'
state
'
)
}),
this
.
el
);
this
.
contacts_el
=
this
.
el
.
querySelector
(
'
.roster-group-contacts
'
);
return
this
;
},
...
...
src/plugins/rosterview/templates/group_header.html
deleted
100644 → 0
View file @
bb3ac360
<a
href=
"#"
class=
"list-toggle group-toggle controlbox-padded"
title=
"{{{o.desc_group_toggle}}}"
>
<span
class=
"fa {[ if (o.toggle_state === o._converse.OPENED) { ]} fa-caret-down {[ } else { ]} fa-caret-right {[ } ]}"
>
</span>
{{{o.label_group}}}
</a>
<ul
class=
"items-list roster-group-contacts {[ if (o.toggle_state === o._converse.CLOSED) { ]} collapsed {[ } ]}"
></ul>
src/plugins/rosterview/templates/group_header.js
0 → 100644
View file @
828eac1e
import
{
html
}
from
"
lit-html
"
;
import
{
_converse
}
from
"
@converse/headless/core
"
;
export
default
(
o
)
=>
html
`
<a href="#" class="list-toggle group-toggle controlbox-padded" title="
${
o
.
desc_group_toggle
}
">
<span class="fa
${
(
o
.
toggle_state
===
_converse
.
OPENED
)
?
'
fa-caret-down
'
:
'
fa-caret-right
'
}
">
</span>
${
o
.
label_group
}
</a>
<ul class="items-list roster-group-contacts
${
(
o
.
toggle_state
===
_converse
.
CLOSED
)
?
'
collapsed
'
:
''
}
"></ul>
`
;
src/plugins/rosterview/templates/pending_contact.html
deleted
100644 → 0
View file @
bb3ac360
{[ if (o.allow_chat_pending_contacts) { ]}
<a
class=
"list-item-link open-chat w-100"
href=
"#"
>
{[ } ]}
<span
class=
"pending-contact-name"
title=
"JID: {{{o.jid}}}"
>
{{{o.display_name}}}
</span>
{[ if (o.allow_chat_pending_contacts) { ]}
</a>
{[ } ]}
<a
class=
"list-item-action remove-xmpp-contact far fa-trash-alt"
title=
"{{{o.desc_remove}}}"
href=
"#"
></a>
src/plugins/rosterview/templates/pending_contact.js
0 → 100644
View file @
828eac1e
import
{
__
}
from
'
i18n
'
;
import
{
api
}
from
"
@converse/headless/core
"
;
import
{
html
}
from
"
lit-html
"
;
const
tpl_pending_contact
=
o
=>
html
`<span class="pending-contact-name" title="JID:
${
o
.
jid
}
">
${
o
.
display_name
}
</span>`
;
export
default
(
o
)
=>
{
const
i18n_remove
=
__
(
'
Click to remove %1$s as a contact
'
,
o
.
display_name
);
return
html
`
${
api
.
settings
.
get
(
'
allow_chat_pending_contacts
'
)
?
html
`<a class="list-item-link open-chat w-100" href="#">
${
tpl_pending_contact
(
o
)}
</a>`
:
tpl_pending_contact
(
o
)
}
;
<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="
${
i18n_remove
}
" href="#"></a>`
;
}
src/plugins/rosterview/templates/requesting_contact.html
deleted
100644 → 0
View file @
bb3ac360
{[ if (o.allow_chat_pending_contacts) { ]}
<a
class=
"open-chat w-100"
href=
"#"
>
{[ } ]}
<span
class=
"req-contact-name w-100"
title=
"JID: {{{o.jid}}}"
>
{{{o.display_name}}}
</span>
{[ if (o.allow_chat_pending_contacts) { ]}
</a>
{[ } ]}
<a
class=
"accept-xmpp-request list-item-action list-item-action--visible fa fa-check"
aria-label=
"{{{o.desc_accept}}}"
title=
"{{{o.desc_accept}}}"
href=
"#"
></a>
<a
class=
"decline-xmpp-request list-item-action list-item-action--visible fa fa-times"
aria-label=
"{{{o.desc_decline}}}"
title=
"{{{o.desc_decline}}}"
href=
"#"
></a>
src/plugins/rosterview/templates/requesting_contact.js
0 → 100644
View file @
828eac1e
import
{
api
}
from
"
@converse/headless/core
"
;
import
{
html
}
from
"
lit-html
"
;
const
tpl_requesting_contact
=
o
=>
html
`<span class="req-contact-name w-100" title="JID:
${
o
.
jid
}
">
${
o
.
display_name
}
</span>`
;
export
default
(
o
)
=>
html
`
${
api
.
settings
.
get
(
'
allow_chat_pending_contacts
'
)
?
html
`<a class="open-chat w-100" href="#">
${
tpl_requesting_contact
(
o
)
}
</a>`
:
tpl_requesting_contact
(
o
)
}
<a class="accept-xmpp-request list-item-action list-item-action--visible fa fa-check"
aria-label="
${
o
.
desc_accept
}
" title="
${
o
.
desc_accept
}
" href="#"></a>
<a class="decline-xmpp-request list-item-action list-item-action--visible fa fa-times"
aria-label="
${
o
.
desc_decline
}
" title="
${
o
.
desc_decline
}
" href="#"></a>`
;
src/plugins/rosterview/templates/roster_item.html
deleted
100644 → 0
View file @
bb3ac360
<a
class=
"list-item-link cbox-list-item open-chat w-100 {[ if (o.num_unread) { ]} unread-msgs {[ } ]}"
title=
"{{{o.desc_chat}}}"
href=
"#"
>
<canvas
class=
"avatar"
height=
"30"
width=
"30"
></canvas>
<span
class=
"{{{o.status_icon}}}"
title=
"{{{o.desc_status}}}"
></span>
{[ if (o.num_unread) { ]}
<span
class=
"msgs-indicator"
>
{{{ o.num_unread }}}
</span>
{[ } ]}
<span
class=
"contact-name contact-name--{{{o.show}}} {[ if (o.num_unread) { ]} unread-msgs {[ } ]}"
>
{{{o.display_name}}}
</span>
</a>
{[ if (o.allow_contact_removal) { ]}
<a
class=
"list-item-action remove-xmpp-contact far fa-trash-alt"
title=
"{{{o.desc_remove}}}"
href=
"#"
></a>
{[ } ]}
src/plugins/rosterview/templates/roster_item.js
0 → 100644
View file @
828eac1e
import
{
__
}
from
'
i18n
'
;
import
{
api
}
from
"
@converse/headless/core
"
;
import
{
html
}
from
"
lit-html
"
;
export
default
(
o
)
=>
{
const
i18n_chat
=
__
(
'
Click to chat with %1$s (XMPP address: %2$s)
'
,
o
.
display_name
,
o
.
jid
);
const
i18n_remove
=
__
(
'
Click to remove %1$s as a contact
'
,
o
.
display_name
);
return
html
`
<a class="list-item-link cbox-list-item open-chat w-100
${
o
.
num_unread
?
'
unread-msgs
'
:
''
}
" title="
${
i18n_chat
}
" href="#">
<canvas class="avatar" height="30" width="30"></canvas>
<span class="
${
o
.
status_icon
}
" title="
${
o
.
desc_status
}
"></span>
${
o
.
num_unread
?
html
`<span class="msgs-indicator">
${
o
.
num_unread
}
</span>`
:
''
}
<span class="contact-name contact-name--
${
o
.
show
}
${
o
.
num_unread
?
'
unread-msgs
'
:
''
}
">
${
o
.
display_name
}
</span>
</a>
${
api
.
settings
.
get
(
'
allow_contact_removal
'
)
?
html
`<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="
${
i18n_remove
}
" href="#"></a>`
:
''
}
`
;
}
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