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
d16bb315
Commit
d16bb315
authored
May 10, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the ability to remove a contact via the details modal
parent
65ac3896
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
7 deletions
+55
-7
css/converse.css
css/converse.css
+4
-1
css/inverse.css
css/inverse.css
+4
-1
sass/_core.scss
sass/_core.scss
+5
-1
src/converse-chatboxes.js
src/converse-chatboxes.js
+3
-0
src/converse-chatview.js
src/converse-chatview.js
+35
-2
src/templates/profile_modal.html
src/templates/profile_modal.html
+1
-1
src/templates/user_details_modal.html
src/templates/user_details_modal.html
+3
-1
No files found.
css/converse.css
View file @
d16bb315
...
@@ -6990,8 +6990,11 @@ body.reset {
...
@@ -6990,8 +6990,11 @@ body.reset {
#conversejs
.list-container
{
#conversejs
.list-container
{
text-align
:
left
;
text-align
:
left
;
margin
:
0.3em
0
;
}
margin
:
0.3em
0
;
}
#conversejs
.btn
.btn-primary
{
#conversejs
.btn
{
color
:
#fff
;
}
color
:
#fff
;
}
#conversejs
.btn
.fa
{
color
:
#fff
;
padding-right
:
0.5em
;
}
#conversejs
.no-text-select
{
#conversejs
.no-text-select
{
-webkit-touch-callout
:
none
;
-webkit-touch-callout
:
none
;
-webkit-user-select
:
none
;
-webkit-user-select
:
none
;
...
...
css/inverse.css
View file @
d16bb315
...
@@ -6990,8 +6990,11 @@ body.reset {
...
@@ -6990,8 +6990,11 @@ body.reset {
#conversejs
.list-container
{
#conversejs
.list-container
{
text-align
:
left
;
text-align
:
left
;
margin
:
0.3em
0
;
}
margin
:
0.3em
0
;
}
#conversejs
.btn
.btn-primary
{
#conversejs
.btn
{
color
:
#fff
;
}
color
:
#fff
;
}
#conversejs
.btn
.fa
{
color
:
#fff
;
padding-right
:
0.5em
;
}
#conversejs
.no-text-select
{
#conversejs
.no-text-select
{
-webkit-touch-callout
:
none
;
-webkit-touch-callout
:
none
;
-webkit-user-select
:
none
;
-webkit-user-select
:
none
;
...
...
sass/_core.scss
View file @
d16bb315
...
@@ -234,8 +234,12 @@ body.reset {
...
@@ -234,8 +234,12 @@ body.reset {
margin
:
0
.3em
0
;
margin
:
0
.3em
0
;
}
}
.btn
.btn-primary
{
.btn
{
color
:
#fff
;
color
:
#fff
;
.fa
{
color
:
#fff
;
padding-right
:
0
.5em
;
}
}
}
.no-text-select
{
.no-text-select
{
...
...
src/converse-chatboxes.js
View file @
d16bb315
...
@@ -238,6 +238,9 @@
...
@@ -238,6 +238,9 @@
if
(
_
.
isNil
(
this
.
vcard
))
{
if
(
_
.
isNil
(
this
.
vcard
))
{
this
.
vcard
=
_converse
.
vcards
.
create
({
'
jid
'
:
this
.
get
(
'
jid
'
)});
this
.
vcard
=
_converse
.
vcards
.
create
({
'
jid
'
:
this
.
get
(
'
jid
'
)});
}
}
_converse
.
api
.
waitUntil
(
'
rosterContactsFetched
'
).
then
(()
=>
{
this
.
contact
=
_converse
.
roster
.
findWhere
({
'
jid
'
:
this
.
get
(
'
jid
'
)});
});
this
.
messages
=
new
_converse
.
Messages
();
this
.
messages
=
new
_converse
.
Messages
();
this
.
messages
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
message_storage
](
this
.
messages
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
message_storage
](
...
...
src/converse-chatview.js
View file @
d16bb315
...
@@ -235,6 +235,11 @@
...
@@ -235,6 +235,11 @@
_converse
.
UserDetailsModal
=
_converse
.
BootstrapModal
.
extend
({
_converse
.
UserDetailsModal
=
_converse
.
BootstrapModal
.
extend
({
events
:
{
'
click button.remove-contact
'
:
'
removeContact
'
},
toHTML
()
{
toHTML
()
{
return
tpl_user_details_modal
(
_
.
extend
(
return
tpl_user_details_modal
(
_
.
extend
(
this
.
model
.
toJSON
(),
this
.
model
.
toJSON
(),
...
@@ -246,10 +251,34 @@
...
@@ -246,10 +251,34 @@
'
label_fullname
'
:
__
(
'
Full Name
'
),
'
label_fullname
'
:
__
(
'
Full Name
'
),
'
label_nickname
'
:
__
(
'
Nickname
'
),
'
label_nickname
'
:
__
(
'
Nickname
'
),
'
label_role
'
:
__
(
'
Role
'
),
'
label_role
'
:
__
(
'
Role
'
),
'
label_
save
'
:
__
(
'
Save
'
),
'
label_
remove
'
:
__
(
'
Remove as contact
'
),
'
label_url
'
:
__
(
'
URL
'
),
'
label_url
'
:
__
(
'
URL
'
),
'
allow_contact_removal
'
:
_converse
.
allow_contact_removal
,
'
is_roster_contact
'
:
!
_
.
isUndefined
(
this
.
model
.
contact
)
}));
}));
}
},
removeContact
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
if
(
!
_converse
.
allow_contact_removal
)
{
return
;
}
const
result
=
confirm
(
__
(
"
Are you sure you want to remove this contact?
"
));
if
(
result
===
true
)
{
this
.
contact
.
removeFromRoster
(
(
iq
)
=>
{
this
.
contact
.
destroy
();
delete
this
.
contact
;
},
(
err
)
=>
{
_converse
.
log
(
err
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
api
.
alert
.
show
(
Strophe
.
LogLevel
.
ERROR
,
__
(
'
Error
'
),
[
__
(
'
Sorry, there was an error while trying to remove %1$s as a contact.
'
,
name
)]
)
}
);
}
},
});
});
...
@@ -288,6 +317,7 @@
...
@@ -288,6 +317,7 @@
this
.
model
.
on
(
'
change:chat_status
'
,
this
.
onChatStatusChanged
,
this
);
this
.
model
.
on
(
'
change:chat_status
'
,
this
.
onChatStatusChanged
,
this
);
this
.
model
.
on
(
'
showHelpMessages
'
,
this
.
showHelpMessages
,
this
);
this
.
model
.
on
(
'
showHelpMessages
'
,
this
.
showHelpMessages
,
this
);
this
.
render
();
this
.
render
();
this
.
fetchMessages
();
this
.
fetchMessages
();
_converse
.
emit
(
'
chatBoxOpened
'
,
this
);
_converse
.
emit
(
'
chatBoxOpened
'
,
this
);
_converse
.
emit
(
'
chatBoxInitialized
'
,
this
);
_converse
.
emit
(
'
chatBoxInitialized
'
,
this
);
...
@@ -408,6 +438,9 @@
...
@@ -408,6 +438,9 @@
this
.
heading
.
render
();
this
.
heading
.
render
();
this
.
heading
.
chatview
=
this
;
this
.
heading
.
chatview
=
this
;
if
(
!
_
.
isUndefined
(
this
.
model
.
contact
))
{
this
.
model
.
contact
.
on
(
'
destroy
'
,
this
.
heading
.
render
,
this
);
}
const
flyout
=
this
.
el
.
querySelector
(
'
.flyout
'
);
const
flyout
=
this
.
el
.
querySelector
(
'
.flyout
'
);
flyout
.
insertBefore
(
this
.
heading
.
el
,
flyout
.
querySelector
(
'
.chat-body
'
));
flyout
.
insertBefore
(
this
.
heading
.
el
,
flyout
.
querySelector
(
'
.chat-body
'
));
return
this
;
return
this
;
...
...
src/templates/profile_modal.html
View file @
d16bb315
...
@@ -49,8 +49,8 @@
...
@@ -49,8 +49,8 @@
</div>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
<div
class=
"modal-footer"
>
<button
type=
"submit"
class=
"save-form btn btn-primary"
>
{{{o.label_save}}}
</button>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
{{{o.label_close}}}
</button>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
{{{o.label_close}}}
</button>
<button
type=
"submit"
class=
"save-form btn btn-primary"
>
{{{o.label_save}}}
</button>
</div>
</div>
</form>
</form>
</div>
</div>
...
...
src/templates/user_details_modal.html
View file @
d16bb315
...
@@ -28,7 +28,9 @@
...
@@ -28,7 +28,9 @@
{[ } ]}
{[ } ]}
</div>
</div>
<div
class=
"modal-footer"
>
<div
class=
"modal-footer"
>
<button
type=
"submit"
class=
"save-form btn btn-primary"
>
{{{o.label_save}}}
</button>
{[ if (o.allow_contact_removal
&&
o.is_roster_contact) { ]}
<button
type=
"button"
class=
"btn btn-danger remove-contact"
data-dismiss=
"modal"
><i
class=
"fa fa-trash"
>
</i>
{{{o.label_remove}}}
</button>
{[ } ]}
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
{{{o.label_close}}}
</button>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
{{{o.label_close}}}
</button>
</div>
</div>
</div>
</div>
...
...
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