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
e1a19678
Commit
e1a19678
authored
Jul 20, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow group headings to be toggleable. updates #83
parent
5b5c7ad7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
37 deletions
+56
-37
converse.js
converse.js
+33
-12
css/converse.css
css/converse.css
+3
-4
less/converse.less
less/converse.less
+2
-3
src/templates.js
src/templates.js
+15
-15
src/templates/contacts.html
src/templates/contacts.html
+0
-1
src/templates/group_header.html
src/templates/group_header.html
+1
-0
src/templates/pending_contacts.html
src/templates/pending_contacts.html
+1
-1
src/templates/requesting_contacts.html
src/templates/requesting_contacts.html
+1
-1
No files found.
converse.js
View file @
e1a19678
...
@@ -3215,6 +3215,9 @@
...
@@ -3215,6 +3215,9 @@
this
.
RosterView
=
Backbone
.
Overview
.
extend
({
this
.
RosterView
=
Backbone
.
Overview
.
extend
({
tagName
:
'
dl
'
,
tagName
:
'
dl
'
,
id
:
'
converse-roster
'
,
id
:
'
converse-roster
'
,
events
:
{
"
click a.group-toggle
"
:
"
toggleGroup
"
},
initialize
:
function
()
{
initialize
:
function
()
{
this
.
model
.
on
(
"
add
"
,
function
(
item
)
{
this
.
model
.
on
(
"
add
"
,
function
(
item
)
{
...
@@ -3244,18 +3247,25 @@
...
@@ -3244,18 +3247,25 @@
this
.
model
.
fetch
({
add
:
true
});
// Get the cached roster items from localstorage
this
.
model
.
fetch
({
add
:
true
});
// Get the cached roster items from localstorage
},
},
initRender
:
function
()
{
initRender
:
function
()
{
var
roster_markup
=
converse
.
templates
.
contacts
({
var
desc_group_toggle
=
__
(
'
Click to hide these contacts
'
),
'
label_contacts
'
:
this
.
roster_groups
?
__
(
'
Ungrouped
'
)
:
__
(
'
My contacts
'
)
toggle_state
=
'
opened
'
,
});
roster_markup
=
converse
.
templates
.
group_header
({
label_group
:
this
.
roster_groups
?
__
(
'
Ungrouped
'
)
:
__
(
'
My contacts
'
),
desc_group_toggle
:
desc_group_toggle
,
toggle_state
:
toggle_state
});
if
(
converse
.
allow_contact_requests
)
{
if
(
converse
.
allow_contact_requests
)
{
roster_markup
+=
converse
.
templates
.
requesting_contacts
({
roster_markup
+=
converse
.
templates
.
requesting_contacts
({
'
label_contact_requests
'
:
__
(
'
Contact requests
'
)
label_contact_requests
:
__
(
'
Contact requests
'
),
})
+
desc_group_toggle
:
desc_group_toggle
,
converse
.
templates
.
pending_contacts
({
toggle_state
:
toggle_state
'
label_pending_contacts
'
:
__
(
'
Pending contacts
'
)
})
+
});
converse
.
templates
.
pending_contacts
({
label_pending_contacts
:
__
(
'
Pending contacts
'
),
desc_group_toggle
:
desc_group_toggle
,
toggle_state
:
toggle_state
});
}
}
this
.
$el
.
hide
().
html
(
roster_markup
);
this
.
$el
.
hide
().
html
(
roster_markup
);
},
},
...
@@ -3338,7 +3348,7 @@
...
@@ -3338,7 +3348,7 @@
this
.
renderRosterItem
(
item
,
view
);
this
.
renderRosterItem
(
item
,
view
);
}
}
}
}
this
.
updateCount
().
toggleHead
ing
s
(
$contact_requests
,
$pending_contacts
);
this
.
updateCount
().
toggleHead
er
s
(
$contact_requests
,
$pending_contacts
);
converse
.
emit
(
'
rosterViewUpdated
'
);
converse
.
emit
(
'
rosterViewUpdated
'
);
return
this
;
return
this
;
},
},
...
@@ -3352,9 +3362,9 @@
...
@@ -3352,9 +3362,9 @@
return
this
;
return
this
;
},
},
toggleHead
ing
s
:
function
(
$contact_requests
,
$pending_contacts
)
{
toggleHead
er
s
:
function
(
$contact_requests
,
$pending_contacts
)
{
var
$groups
=
this
.
$el
.
find
(
'
.roster-group
'
);
var
$groups
=
this
.
$el
.
find
(
'
.roster-group
'
);
// Hide the head
ing
s if there are no contacts under them
// Hide the head
er
s if there are no contacts under them
_
.
each
([
$groups
,
$contact_requests
,
$pending_contacts
],
function
(
h
)
{
_
.
each
([
$groups
,
$contact_requests
,
$pending_contacts
],
function
(
h
)
{
var
show_or_hide
=
function
(
h
)
{
var
show_or_hide
=
function
(
h
)
{
if
(
h
.
nextUntil
(
'
dt
'
).
length
)
{
if
(
h
.
nextUntil
(
'
dt
'
).
length
)
{
...
@@ -3375,6 +3385,17 @@
...
@@ -3375,6 +3385,17 @@
return
this
;
return
this
;
},
},
toggleGroup
:
function
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
var
$el
=
$
(
ev
.
target
);
$el
.
parent
().
nextUntil
(
'
dt
'
).
slideToggle
();
if
(
$el
.
hasClass
(
"
icon-opened
"
))
{
$el
.
removeClass
(
"
icon-opened
"
).
addClass
(
"
icon-closed
"
);
}
else
{
$el
.
removeClass
(
"
icon-closed
"
).
addClass
(
"
icon-opened
"
);
}
},
sortRoster
:
function
(
chat_status
)
{
sortRoster
:
function
(
chat_status
)
{
var
sortFunction
=
function
(
a
,
b
)
{
var
sortFunction
=
function
(
a
,
b
)
{
var
a_status
=
a
.
s
[
0
],
var
a_status
=
a
.
s
[
0
],
...
...
css/converse.css
View file @
e1a19678
...
@@ -818,8 +818,7 @@ dl.add-converse-contact {
...
@@ -818,8 +818,7 @@ dl.add-converse-contact {
top
:
1px
;
top
:
1px
;
}
}
#conversejs
.controlbox-pane
dt
{
#conversejs
.controlbox-pane
dt
{
margin
:
0
;
padding
:
3px
;
padding-top
:
0.5em
;
}
}
#conversejs
.chatroom-form-container
{
#conversejs
.chatroom-form-container
{
height
:
100%
;
height
:
100%
;
...
@@ -886,7 +885,7 @@ dl.add-converse-contact {
...
@@ -886,7 +885,7 @@ dl.add-converse-contact {
height
:
254px
;
height
:
254px
;
height
:
calc
(
100%
-
70px
);
height
:
calc
(
100%
-
70px
);
}
}
#converse-roster
.
roster-group
{
#converse-roster
.
group-toggle
{
color
:
#666
;
color
:
#666
;
}
}
#conversejs
dd
.available-chatroom
{
#conversejs
dd
.available-chatroom
{
...
@@ -959,7 +958,7 @@ dl.add-converse-contact {
...
@@ -959,7 +958,7 @@ dl.add-converse-contact {
#conversejs
#converse-roster
dd
{
#conversejs
#converse-roster
dd
{
line-height
:
16px
;
line-height
:
16px
;
}
}
#conversejs
.
roster-group
{
#conversejs
.
group-toggle
{
display
:
block
;
display
:
block
;
width
:
100%
;
width
:
100%
;
}
}
...
...
less/converse.less
View file @
e1a19678
...
@@ -903,8 +903,7 @@ dl.add-converse-contact {
...
@@ -903,8 +903,7 @@ dl.add-converse-contact {
}
}
#conversejs .controlbox-pane dt {
#conversejs .controlbox-pane dt {
margin: 0;
padding: 3px;
padding-top: 0.5em;
}
}
#conversejs .chatroom-form-container {
#conversejs .chatroom-form-container {
...
@@ -1075,7 +1074,7 @@ dl.add-converse-contact {
...
@@ -1075,7 +1074,7 @@ dl.add-converse-contact {
width: 100%;
width: 100%;
}
}
#conversejs .
group-toggle
:hover,
#conversejs .
roster-group
:hover,
#conversejs dd.available-chatroom:hover,
#conversejs dd.available-chatroom:hover,
#conversejs #converse-roster dd:hover {
#conversejs #converse-roster dd:hover {
background-color: #eee;
background-color: #eee;
...
...
src/templates.js
View file @
e1a19678
...
@@ -10,7 +10,6 @@ define("converse-templates", [
...
@@ -10,7 +10,6 @@ define("converse-templates", [
"
tpl!src/templates/chatrooms_tab
"
,
"
tpl!src/templates/chatrooms_tab
"
,
"
tpl!src/templates/chats_panel
"
,
"
tpl!src/templates/chats_panel
"
,
"
tpl!src/templates/choose_status
"
,
"
tpl!src/templates/choose_status
"
,
"
tpl!src/templates/contacts
"
,
"
tpl!src/templates/contacts_panel
"
,
"
tpl!src/templates/contacts_panel
"
,
"
tpl!src/templates/contacts_tab
"
,
"
tpl!src/templates/contacts_tab
"
,
"
tpl!src/templates/controlbox
"
,
"
tpl!src/templates/controlbox
"
,
...
@@ -19,6 +18,7 @@ define("converse-templates", [
...
@@ -19,6 +18,7 @@ define("converse-templates", [
"
tpl!src/templates/form_checkbox
"
,
"
tpl!src/templates/form_checkbox
"
,
"
tpl!src/templates/form_input
"
,
"
tpl!src/templates/form_input
"
,
"
tpl!src/templates/form_select
"
,
"
tpl!src/templates/form_select
"
,
"
tpl!src/templates/group_header
"
,
"
tpl!src/templates/info
"
,
"
tpl!src/templates/info
"
,
"
tpl!src/templates/login_panel
"
,
"
tpl!src/templates/login_panel
"
,
"
tpl!src/templates/login_tab
"
,
"
tpl!src/templates/login_tab
"
,
...
@@ -35,9 +35,9 @@ define("converse-templates", [
...
@@ -35,9 +35,9 @@ define("converse-templates", [
"
tpl!src/templates/roster_item
"
,
"
tpl!src/templates/roster_item
"
,
"
tpl!src/templates/select_option
"
,
"
tpl!src/templates/select_option
"
,
"
tpl!src/templates/status_option
"
,
"
tpl!src/templates/status_option
"
,
"
tpl!src/templates/toggle_chats
"
,
"
tpl!src/templates/toolbar
"
,
"
tpl!src/templates/toolbar
"
,
"
tpl!src/templates/trimmed_chat
"
,
"
tpl!src/templates/trimmed_chat
"
"
tpl!src/templates/toggle_chats
"
],
function
()
{
],
function
()
{
return
{
return
{
action
:
arguments
[
0
],
action
:
arguments
[
0
],
...
@@ -51,15 +51,15 @@ define("converse-templates", [
...
@@ -51,15 +51,15 @@ define("converse-templates", [
chatrooms_tab
:
arguments
[
8
],
chatrooms_tab
:
arguments
[
8
],
chats_panel
:
arguments
[
9
],
chats_panel
:
arguments
[
9
],
choose_status
:
arguments
[
10
],
choose_status
:
arguments
[
10
],
contacts
:
arguments
[
11
],
contacts
_panel
:
arguments
[
11
],
contacts_
panel
:
arguments
[
12
],
contacts_
tab
:
arguments
[
12
],
cont
acts_tab
:
arguments
[
13
],
cont
rolbox
:
arguments
[
13
],
controlbox
:
arguments
[
14
],
controlbox
_toggle
:
arguments
[
14
],
controlbox_toggle
:
arguments
[
15
],
field
:
arguments
[
15
],
f
ield
:
arguments
[
16
],
f
orm_checkbox
:
arguments
[
16
],
form_
checkbox
:
arguments
[
17
],
form_
input
:
arguments
[
17
],
form_
input
:
arguments
[
18
],
form_
select
:
arguments
[
18
],
form_select
:
arguments
[
19
],
group_header
:
arguments
[
19
],
info
:
arguments
[
20
],
info
:
arguments
[
20
],
login_panel
:
arguments
[
21
],
login_panel
:
arguments
[
21
],
login_tab
:
arguments
[
22
],
login_tab
:
arguments
[
22
],
...
@@ -76,8 +76,8 @@ define("converse-templates", [
...
@@ -76,8 +76,8 @@ define("converse-templates", [
roster_item
:
arguments
[
33
],
roster_item
:
arguments
[
33
],
select_option
:
arguments
[
34
],
select_option
:
arguments
[
34
],
status_option
:
arguments
[
35
],
status_option
:
arguments
[
35
],
to
olbar
:
arguments
[
36
],
to
ggle_chats
:
arguments
[
36
],
t
rimmed_chat
:
arguments
[
37
],
t
oolbar
:
arguments
[
37
],
t
oggle_chats
:
arguments
[
38
]
t
rimmed_chat
:
arguments
[
38
]
};
};
});
});
src/templates/contacts.html
deleted
100644 → 0
View file @
5b5c7ad7
<dt
class=
"roster-group"
>
{{label_contacts}}
</dt>
src/templates/group_header.html
0 → 100644
View file @
e1a19678
<dt
class=
"roster-group"
><a
href=
"#"
class=
"group-toggle icon-{{toggle_state}}"
title=
"{{desc_group_toggle}}"
>
{{label_group}}
</a></dt>
src/templates/pending_contacts.html
View file @
e1a19678
<dt
id=
"pending-xmpp-contacts"
>
{{label_pending_contacts}}
</dt>
<dt
id=
"pending-xmpp-contacts"
>
<a
href=
"#"
class=
"group-toggle icon-{{toggle_state}}"
title=
"{{desc_group_toggle}}"
>
{{label_pending_contacts}}
</a>
</dt>
src/templates/requesting_contacts.html
View file @
e1a19678
<dt
id=
"xmpp-contact-requests"
>
{{label_contact_requests}}
</dt>
<dt
id=
"xmpp-contact-requests"
>
<a
href=
"#"
class=
"group-toggle icon-{{toggle_state}}"
title=
"{{desc_group_toggle}}"
>
{{label_contact_requests}}
</a>
</dt>
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