Add info icon in room header and show room details in modal
This commit is contained in:
parent
f7c3351e2b
commit
78d6d493d6
@ -6938,6 +6938,8 @@ body.reset {
|
||||
min-height: 0; }
|
||||
#conversejs strong {
|
||||
font-weight: 700; }
|
||||
#conversejs em {
|
||||
font-style: italic; }
|
||||
#conversejs ol, #conversejs ul {
|
||||
list-style: none; }
|
||||
#conversejs li {
|
||||
@ -8443,6 +8445,26 @@ body.reset {
|
||||
#conversejs .add-chatroom input[type="submit"],
|
||||
#conversejs .add-chatroom input[type="button"] {
|
||||
margin: 0.3em 0; }
|
||||
#conversejs.converse-embedded #room-details-modal .features-list,
|
||||
#conversejs #room-details-modal .features-list {
|
||||
margin-left: 1em; }
|
||||
#conversejs.converse-embedded .chatroom-features,
|
||||
#conversejs .chatroom-features {
|
||||
width: 100%; }
|
||||
#conversejs.converse-embedded .chatroom-features .features-list,
|
||||
#conversejs .chatroom-features .features-list {
|
||||
padding-top: 0; }
|
||||
#conversejs.converse-embedded .chatroom-features .features-list .feature,
|
||||
#conversejs .chatroom-features .features-list .feature {
|
||||
width: 100%;
|
||||
margin-right: 0.5em;
|
||||
padding-right: 0;
|
||||
font-size: 1em;
|
||||
cursor: help; }
|
||||
#conversejs.converse-embedded .chatroom-features .features-list .feature .fa,
|
||||
#conversejs .chatroom-features .features-list .feature .fa {
|
||||
margin-right: 0.5em;
|
||||
color: #666; }
|
||||
#conversejs.converse-embedded .chat-head-chatroom,
|
||||
#conversejs .chat-head-chatroom {
|
||||
background-color: #E77051; }
|
||||
@ -8567,16 +8589,6 @@ body.reset {
|
||||
#conversejs .chatroom .box-flyout .chatroom-body .occupants .occupants-header .occupants-heading {
|
||||
font-family: "Century Gothic", futura, "URW Gothic L", Verdana, sans-serif;
|
||||
padding: 0.3em 0; }
|
||||
#conversejs.converse-embedded .chatroom .box-flyout .chatroom-body .occupants .chatroom-features,
|
||||
#conversejs .chatroom .box-flyout .chatroom-body .occupants .chatroom-features {
|
||||
width: 100%; }
|
||||
#conversejs.converse-embedded .chatroom .box-flyout .chatroom-body .occupants .chatroom-features .feature,
|
||||
#conversejs .chatroom .box-flyout .chatroom-body .occupants .chatroom-features .feature {
|
||||
float: left;
|
||||
margin-right: 0.5em;
|
||||
padding-right: 0;
|
||||
font-size: 1em;
|
||||
cursor: help; }
|
||||
#conversejs.converse-embedded .chatroom .box-flyout .chatroom-body .occupants .awesomplete ul,
|
||||
#conversejs .chatroom .box-flyout .chatroom-body .occupants .awesomplete ul {
|
||||
padding: 0; }
|
||||
@ -8596,15 +8608,6 @@ body.reset {
|
||||
flex-basis: 0;
|
||||
flex-grow: 1;
|
||||
border-bottom: 1px solid lightgrey; }
|
||||
#conversejs.converse-embedded .chatroom .box-flyout .chatroom-body .occupants ul.features-list,
|
||||
#conversejs .chatroom .box-flyout .chatroom-body .occupants ul.features-list {
|
||||
padding-top: 0; }
|
||||
#conversejs.converse-embedded .chatroom .box-flyout .chatroom-body .occupants ul.features-list .feature,
|
||||
#conversejs .chatroom .box-flyout .chatroom-body .occupants ul.features-list .feature {
|
||||
width: 100%; }
|
||||
#conversejs.converse-embedded .chatroom .box-flyout .chatroom-body .occupants ul.features-list .feature .fa,
|
||||
#conversejs .chatroom .box-flyout .chatroom-body .occupants ul.features-list .feature .fa {
|
||||
color: #666; }
|
||||
#conversejs.converse-embedded .chatroom .box-flyout .chatroom-body .occupants ul li,
|
||||
#conversejs .chatroom .box-flyout .chatroom-body .occupants ul li {
|
||||
cursor: default;
|
||||
|
4
dev.html
4
dev.html
@ -32,8 +32,8 @@
|
||||
notify_all_room_messages: [
|
||||
'discuss@conference.conversejs.org'
|
||||
],
|
||||
// bosh_service_url: 'http://chat.example.org:5280/http-bind/',
|
||||
bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
|
||||
bosh_service_url: 'http://chat.example.org:5280/http-bind/',
|
||||
// bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
|
||||
message_archiving: 'always',
|
||||
debug: true
|
||||
});
|
||||
|
5593
dist/converse-no-dependencies.js
vendored
5593
dist/converse-no-dependencies.js
vendored
File diff suppressed because it is too large
Load Diff
334
dist/converse.js
vendored
334
dist/converse.js
vendored
@ -63421,6 +63421,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
},
|
||||
|
||||
showUserDetailsModal(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
if (_.isUndefined(this.user_details_modal)) {
|
||||
this.user_details_modal = new _converse.UserDetailsModal({
|
||||
model: this.model
|
||||
@ -69169,11 +69171,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
// Copyright (c) 2012-2018, the Converse.js developers
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
(function (root, factory) {
|
||||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! converse-core */ "./src/converse-core.js"), __webpack_require__(/*! muc-utils */ "./src/utils/muc.js"), __webpack_require__(/*! templates/add_chatroom_modal.html */ "./src/templates/add_chatroom_modal.html"), __webpack_require__(/*! templates/chatarea.html */ "./src/templates/chatarea.html"), __webpack_require__(/*! templates/chatroom.html */ "./src/templates/chatroom.html"), __webpack_require__(/*! templates/chatroom_disconnect.html */ "./src/templates/chatroom_disconnect.html"), __webpack_require__(/*! templates/chatroom_features.html */ "./src/templates/chatroom_features.html"), __webpack_require__(/*! templates/chatroom_form.html */ "./src/templates/chatroom_form.html"), __webpack_require__(/*! templates/chatroom_head.html */ "./src/templates/chatroom_head.html"), __webpack_require__(/*! templates/chatroom_invite.html */ "./src/templates/chatroom_invite.html"), __webpack_require__(/*! templates/chatroom_nickname_form.html */ "./src/templates/chatroom_nickname_form.html"), __webpack_require__(/*! templates/chatroom_password_form.html */ "./src/templates/chatroom_password_form.html"), __webpack_require__(/*! templates/chatroom_sidebar.html */ "./src/templates/chatroom_sidebar.html"), __webpack_require__(/*! templates/chatroom_toolbar.html */ "./src/templates/chatroom_toolbar.html"), __webpack_require__(/*! templates/info.html */ "./src/templates/info.html"), __webpack_require__(/*! templates/list_chatrooms_modal.html */ "./src/templates/list_chatrooms_modal.html"), __webpack_require__(/*! templates/occupant.html */ "./src/templates/occupant.html"), __webpack_require__(/*! templates/room_description.html */ "./src/templates/room_description.html"), __webpack_require__(/*! templates/room_item.html */ "./src/templates/room_item.html"), __webpack_require__(/*! templates/room_panel.html */ "./src/templates/room_panel.html"), __webpack_require__(/*! templates/rooms_results.html */ "./src/templates/rooms_results.html"), __webpack_require__(/*! templates/spinner.html */ "./src/templates/spinner.html"), __webpack_require__(/*! awesomplete */ "./node_modules/awesomplete-avoid-xss/awesomplete.js"), __webpack_require__(/*! converse-modal */ "./src/converse-modal.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
||||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! converse-core */ "./src/converse-core.js"), __webpack_require__(/*! muc-utils */ "./src/utils/muc.js"), __webpack_require__(/*! templates/add_chatroom_modal.html */ "./src/templates/add_chatroom_modal.html"), __webpack_require__(/*! templates/chatarea.html */ "./src/templates/chatarea.html"), __webpack_require__(/*! templates/chatroom.html */ "./src/templates/chatroom.html"), __webpack_require__(/*! templates/chatroom_details_modal.html */ "./src/templates/chatroom_details_modal.html"), __webpack_require__(/*! templates/chatroom_disconnect.html */ "./src/templates/chatroom_disconnect.html"), __webpack_require__(/*! templates/chatroom_features.html */ "./src/templates/chatroom_features.html"), __webpack_require__(/*! templates/chatroom_form.html */ "./src/templates/chatroom_form.html"), __webpack_require__(/*! templates/chatroom_head.html */ "./src/templates/chatroom_head.html"), __webpack_require__(/*! templates/chatroom_invite.html */ "./src/templates/chatroom_invite.html"), __webpack_require__(/*! templates/chatroom_nickname_form.html */ "./src/templates/chatroom_nickname_form.html"), __webpack_require__(/*! templates/chatroom_password_form.html */ "./src/templates/chatroom_password_form.html"), __webpack_require__(/*! templates/chatroom_sidebar.html */ "./src/templates/chatroom_sidebar.html"), __webpack_require__(/*! templates/chatroom_toolbar.html */ "./src/templates/chatroom_toolbar.html"), __webpack_require__(/*! templates/info.html */ "./src/templates/info.html"), __webpack_require__(/*! templates/list_chatrooms_modal.html */ "./src/templates/list_chatrooms_modal.html"), __webpack_require__(/*! templates/occupant.html */ "./src/templates/occupant.html"), __webpack_require__(/*! templates/room_description.html */ "./src/templates/room_description.html"), __webpack_require__(/*! templates/room_item.html */ "./src/templates/room_item.html"), __webpack_require__(/*! templates/room_panel.html */ "./src/templates/room_panel.html"), __webpack_require__(/*! templates/rooms_results.html */ "./src/templates/rooms_results.html"), __webpack_require__(/*! templates/spinner.html */ "./src/templates/spinner.html"), __webpack_require__(/*! awesomplete */ "./node_modules/awesomplete-avoid-xss/awesomplete.js"), __webpack_require__(/*! converse-modal */ "./src/converse-modal.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||||
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||||
})(void 0, function (converse, muc_utils, tpl_add_chatroom_modal, tpl_chatarea, tpl_chatroom, tpl_chatroom_disconnect, tpl_chatroom_features, tpl_chatroom_form, tpl_chatroom_head, tpl_chatroom_invite, tpl_chatroom_nickname_form, tpl_chatroom_password_form, tpl_chatroom_sidebar, tpl_chatroom_toolbar, tpl_info, tpl_list_chatrooms_modal, tpl_occupant, tpl_room_description, tpl_room_item, tpl_room_panel, tpl_rooms_results, tpl_spinner, Awesomplete) {
|
||||
})(void 0, function (converse, muc_utils, tpl_add_chatroom_modal, tpl_chatarea, tpl_chatroom, tpl_chatroom_details_modal, tpl_chatroom_disconnect, tpl_chatroom_features, tpl_chatroom_form, tpl_chatroom_head, tpl_chatroom_invite, tpl_chatroom_nickname_form, tpl_chatroom_password_form, tpl_chatroom_sidebar, tpl_chatroom_toolbar, tpl_info, tpl_list_chatrooms_modal, tpl_occupant, tpl_room_description, tpl_room_item, tpl_room_panel, tpl_rooms_results, tpl_spinner, Awesomplete) {
|
||||
"use strict";
|
||||
|
||||
const _converse$env = converse.env,
|
||||
@ -69607,6 +69609,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
ev.target.reset();
|
||||
}
|
||||
|
||||
});
|
||||
_converse.RoomDetailsModal = _converse.BootstrapModal.extend({
|
||||
initialize() {
|
||||
_converse.BootstrapModal.prototype.initialize.apply(this, arguments);
|
||||
|
||||
this.model.on('change', this.render, this);
|
||||
this.model.occupants.on('change', this.render, this);
|
||||
},
|
||||
|
||||
toHTML() {
|
||||
return tpl_chatroom_details_modal(_.extend(this.model.toJSON(), {
|
||||
'__': __,
|
||||
'display_name': this.model.getDisplayName(),
|
||||
'num_occupants': this.model.occupants.length
|
||||
}));
|
||||
}
|
||||
|
||||
});
|
||||
_converse.ChatRoomView = _converse.ChatBoxView.extend({
|
||||
/* Backbone.NativeView which renders a chat room, based upon the view
|
||||
@ -69621,6 +69640,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
'click .chatbox-navback': 'showControlBox',
|
||||
'click .close-chatbox-button': 'close',
|
||||
'click .configure-chatroom-button': 'getAndRenderConfigurationForm',
|
||||
'click .show-room-details-modal': 'showRoomDetailsModal',
|
||||
'click .hide-occupants': 'hideOccupants',
|
||||
'click .new-msgs-indicator': 'viewUnreadMessages',
|
||||
'click .occupant-nick': 'onOccupantClicked',
|
||||
@ -69725,6 +69745,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
return this;
|
||||
},
|
||||
|
||||
showRoomDetailsModal(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
if (_.isUndefined(this.model.room_details_modal)) {
|
||||
this.model.room_details_modal = new _converse.RoomDetailsModal({
|
||||
'model': this.model
|
||||
});
|
||||
}
|
||||
|
||||
this.model.room_details_modal.show(ev);
|
||||
},
|
||||
|
||||
showChatStateNotification(message) {
|
||||
if (message.get('sender') === 'me') {
|
||||
return;
|
||||
@ -69768,10 +69800,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
/* Returns the heading HTML to be rendered.
|
||||
*/
|
||||
return tpl_chatroom_head(_.extend(this.model.toJSON(), {
|
||||
Strophe: Strophe,
|
||||
info_close: __('Close and leave this room'),
|
||||
info_configure: __('Configure this room'),
|
||||
description: this.model.get('description') || ''
|
||||
'Strophe': Strophe,
|
||||
'info_close': __('Close and leave this room'),
|
||||
'info_configure': __('Configure this room'),
|
||||
'info_details': __('Show more details about this room'),
|
||||
'description': this.model.get('description') || ''
|
||||
}));
|
||||
},
|
||||
|
||||
@ -70729,16 +70762,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
});
|
||||
_converse.RoomsPanel = Backbone.NativeView.extend({
|
||||
/* Backbone.NativeView which renders MUC section of the control box.
|
||||
*
|
||||
* Chat rooms can be listed, joined and new rooms can be created.
|
||||
*/
|
||||
tagName: 'div',
|
||||
className: 'controlbox-section',
|
||||
id: 'chatrooms',
|
||||
events: {
|
||||
'click a.chatbox-btn.show-add-muc-modal': 'showAddRoomModal',
|
||||
'click a.chatbox-btn.show-list-muc-modal': 'showListRoomsModal',
|
||||
'click a.room-info': 'toggleRoomInfo'
|
||||
'click a.chatbox-btn.show-list-muc-modal': 'showListRoomsModal'
|
||||
},
|
||||
|
||||
render() {
|
||||
@ -70750,11 +70780,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
return this;
|
||||
},
|
||||
|
||||
toggleRoomInfo(ev) {
|
||||
ev.preventDefault();
|
||||
toggleRoomInfo(ev);
|
||||
},
|
||||
|
||||
showAddRoomModal(ev) {
|
||||
if (_.isUndefined(this.add_room_modal)) {
|
||||
this.add_room_modal = new _converse.AddChatRoomModal({
|
||||
@ -70882,34 +70907,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
el = this.el.querySelector('.chatroom-features');
|
||||
|
||||
el.innerHTML = tpl_chatroom_features(_.extend(this.chatroomview.model.toJSON(), {
|
||||
'has_features': _.reduce(_.values(picks), iteratee),
|
||||
'label_features': __('Features'),
|
||||
'label_hidden': __('Hidden'),
|
||||
'label_mam_enabled': __('Message archiving'),
|
||||
'label_membersonly': __('Members only'),
|
||||
'label_moderated': __('Moderated'),
|
||||
'label_nonanonymous': __('Non-anonymous'),
|
||||
'label_open': __('Open'),
|
||||
'label_passwordprotected': __('Password protected'),
|
||||
'label_persistent': __('Persistent'),
|
||||
'label_public': __('Public'),
|
||||
'label_semianonymous': __('Semi-anonymous'),
|
||||
'label_temporary': __('Temporary'),
|
||||
'label_unmoderated': __('Unmoderated'),
|
||||
'label_unsecured': __('No password'),
|
||||
'tt_hidden': __('This room is not publicly searchable'),
|
||||
'tt_mam_enabled': __('Messages are archived on the server'),
|
||||
'tt_membersonly': __('This room is restricted to members only'),
|
||||
'tt_moderated': __('This room is being moderated'),
|
||||
'tt_nonanonymous': __('All other room occupants can see your XMPP username'),
|
||||
'tt_open': __('Anyone can join this room'),
|
||||
'tt_passwordprotected': __('This room requires a password before entry'),
|
||||
'tt_persistent': __('This room persists even if it\'s unoccupied'),
|
||||
'tt_public': __('This room is publicly searchable'),
|
||||
'tt_semianonymous': __('Only moderators can see your XMPP username'),
|
||||
'tt_temporary': __('This room will disappear once the last person leaves'),
|
||||
'tt_unmoderated': __('This room is not being moderated'),
|
||||
'tt_unsecured': __('This room does not require a password upon entry')
|
||||
'__': __,
|
||||
'has_features': _.reduce(_.values(picks), iteratee)
|
||||
}));
|
||||
this.setOccupantsHeight();
|
||||
return this;
|
||||
@ -71359,6 +71358,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
this.handlers[type][name] = callback;
|
||||
},
|
||||
|
||||
getDisplayName() {
|
||||
return this.get('name') || this.get('jid');
|
||||
},
|
||||
|
||||
join(nick, password) {
|
||||
/* Join the chat room.
|
||||
*
|
||||
@ -71579,7 +71582,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
* <feature var='urn:xmpp:mam:0'/>
|
||||
*/
|
||||
const features = {
|
||||
'features_fetched': true,
|
||||
'features_fetched': moment().format(),
|
||||
'name': iq.querySelector('identity').getAttribute('name')
|
||||
};
|
||||
|
||||
@ -74144,6 +74147,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
}
|
||||
});
|
||||
_converse.RoomsListElementView = Backbone.VDOMView.extend({
|
||||
events: {
|
||||
'click a.room-info': 'showRoomDetailsModal'
|
||||
},
|
||||
|
||||
initialize() {
|
||||
this.model.on('destroy', this.remove, this);
|
||||
this.model.on('remove', this.remove, this);
|
||||
@ -74153,18 +74160,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
this.model.on('change:num_unread_general', this.render, this);
|
||||
},
|
||||
|
||||
getRoomsListElementName() {
|
||||
if (this.model.get('bookmarked') && _converse.bookmarksview) {
|
||||
const bookmark = _.head(_converse.bookmarksview.model.where({
|
||||
'jid': this.model.get('jid')
|
||||
}));
|
||||
|
||||
return bookmark.get('name');
|
||||
} else {
|
||||
return this.model.get('name');
|
||||
}
|
||||
},
|
||||
|
||||
toHTML() {
|
||||
return tpl_rooms_list_item(_.extend(this.model.toJSON(), {
|
||||
// XXX: By the time this renders, the _converse.bookmarks
|
||||
@ -74179,6 +74174,32 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
||||
'name': this.getRoomsListElementName(),
|
||||
'open_title': __('Click to open this room')
|
||||
}));
|
||||
},
|
||||
|
||||
showRoomDetailsModal(ev) {
|
||||
const room = _converse.chatboxes.get(this.model.get('jid'));
|
||||
|
||||
ev.preventDefault();
|
||||
|
||||
if (_.isUndefined(room.room_details_modal)) {
|
||||
room.room_details_modal = new _converse.RoomDetailsModal({
|
||||
'model': room
|
||||
});
|
||||
}
|
||||
|
||||
room.room_details_modal.show(ev);
|
||||
},
|
||||
|
||||
getRoomsListElementName() {
|
||||
if (this.model.get('bookmarked') && _converse.bookmarksview) {
|
||||
const bookmark = _.head(_converse.bookmarksview.model.where({
|
||||
'jid': this.model.get('jid')
|
||||
}));
|
||||
|
||||
return bookmark.get('name');
|
||||
} else {
|
||||
return this.model.get('name');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@ -77666,6 +77687,149 @@ return __p
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/templates/chatroom_details_modal.html":
|
||||
/*!***************************************************!*\
|
||||
!*** ./src/templates/chatroom_details_modal.html ***!
|
||||
\***************************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var _ = {escape:__webpack_require__(/*! ./node_modules/lodash/escape.js */ "./node_modules/lodash/escape.js")};
|
||||
module.exports = function(o) {
|
||||
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
__p += '<!-- src/templates/chatroom_details_modal.html -->\n<div class="modal fade" id="room-details-modal" tabindex="-1" role="dialog" aria-labelledby="user-profile-modal-label" aria-hidden="true">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="user-profile-modal-label">' +
|
||||
__e(o.display_name) +
|
||||
'</h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="' +
|
||||
__e(o.label_close) +
|
||||
'"><span aria-hidden="true">×</span></button>\n </div>\n <div class="modal-body">\n <div class="room-info">\n <p class="room-info"><strong>' +
|
||||
__e(o.__('Room address (JID)')) +
|
||||
'</strong>: ' +
|
||||
__e(o.jid) +
|
||||
'</p>\n <p class="room-info"><strong>' +
|
||||
__e(o.__('Name')) +
|
||||
'</strong>: ' +
|
||||
__e(o.name) +
|
||||
'</p>\n <p class="room-info"><strong>' +
|
||||
__e(o.__('Description')) +
|
||||
'</strong>: ' +
|
||||
__e(o.description) +
|
||||
'</p>\n <p class="room-info"><strong>' +
|
||||
__e(o.__('Online users')) +
|
||||
'</strong>: ' +
|
||||
__e(o.num_occupants) +
|
||||
'</p>\n <p class="room-info"><strong>' +
|
||||
__e(o.__('Features')) +
|
||||
'</strong>:\n <div class="chatroom-features">\n <ul class="features-list">\n ';
|
||||
if (o.passwordprotected) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-lock"></span>' +
|
||||
__e( o.__('Password protected') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('This room requires a password before entry') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.unsecured) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-unlock"></span>' +
|
||||
__e( o.__('No password required') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('This room does not require a password upon entry') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.hidden) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-eye-slash"></span>' +
|
||||
__e( o.__('Hidden') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('This room is not publicly searchable') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.public_room) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-eye"></span>' +
|
||||
__e( o.__('Public') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('This room is publicly searchable') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.membersonly) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-address-book"></span>' +
|
||||
__e( o.__('Members only') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('this room is restricted to members only') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.open) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-globe"></span>' +
|
||||
__e( o.__('Open') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('Anyone can join this room') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.persistent) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-save"></span>' +
|
||||
__e( o.__('Persistent') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('This room persists even if it\'s unoccupied') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.temporary) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-snowflake-o"></span>' +
|
||||
__e( o.__('Temporary') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('This room will disappear once the last person leaves') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.nonanonymous) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-id-card"></span>' +
|
||||
__e( o.__('Not anonymous') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('All other room occupants can see your XMPP username') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.semianonymous) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-user-secret"></span>' +
|
||||
__e( o.__('Semi-anonymous') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('Only moderators can see your XMPP username') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.moderated) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-gavel"></span>' +
|
||||
__e( o.__('Moderated') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('This room is being moderated') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.unmoderated) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-info-circle"></span>' +
|
||||
__e( o.__('Not moderated') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('This room is not being moderated') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n ';
|
||||
if (o.mam_enabled) { ;
|
||||
__p += '\n <li class="feature" ><span class="fa fa-database"></span>' +
|
||||
__e( o.__('Message archiving') ) +
|
||||
' - <em>' +
|
||||
__e( o.__('Messages are archived on the server') ) +
|
||||
'</em></li>\n ';
|
||||
} ;
|
||||
__p += '\n </ul>\n </div>\n </p>\n </div>\n </div>\n </div>\n </div>\n</div>\n';
|
||||
return __p
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/templates/chatroom_disconnect.html":
|
||||
/*!************************************************!*\
|
||||
!*** ./src/templates/chatroom_disconnect.html ***!
|
||||
@ -77698,111 +77862,111 @@ function print() { __p += __j.call(arguments, '') }
|
||||
__p += '<!-- src/templates/chatroom_features.html -->\n';
|
||||
if (o.has_features) { ;
|
||||
__p += '\n<p class="occupants-heading">' +
|
||||
__e(o.label_features) +
|
||||
__e(o.__('Features')) +
|
||||
'</p>\n';
|
||||
} ;
|
||||
__p += '\n<ul class="features-list">\n';
|
||||
if (o.passwordprotected) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_passwordprotected ) +
|
||||
__e( o.__('This room requires a password before entry') ) +
|
||||
'"><span class="fa fa-lock"></span>' +
|
||||
__e( o.label_passwordprotected ) +
|
||||
__e( o.__('Password protected') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.unsecured) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_unsecured ) +
|
||||
__e( o.__('This room does not require a password upon entry') ) +
|
||||
'"><span class="fa fa-unlock"></span>' +
|
||||
__e( o.label_unsecured ) +
|
||||
__e( o.__('No password') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.hidden) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_hidden ) +
|
||||
__e( o.__('This room is not publicly searchable') ) +
|
||||
'"><span class="fa fa-eye-slash"></span>' +
|
||||
__e( o.label_hidden ) +
|
||||
__e( o.__('Hidden') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.public_room) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_public ) +
|
||||
__e( o.__('This room is publicly searchable') ) +
|
||||
'"><span class="fa fa-eye"></span>' +
|
||||
__e( o.label_public ) +
|
||||
__e( o.__('Public') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.membersonly) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_membersonly ) +
|
||||
__e( o.__('this room is restricted to members only') ) +
|
||||
'"><span class="fa fa-address-book"></span>' +
|
||||
__e( o.label_membersonly ) +
|
||||
__e( o.__('Members only') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.open) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_open ) +
|
||||
__e( o.__('Anyone can join this room') ) +
|
||||
'"><span class="fa fa-globe"></span>' +
|
||||
__e( o.label_open ) +
|
||||
__e( o.__('Open') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.persistent) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_persistent ) +
|
||||
__e( o.__('This room persists even if it\'s unoccupied') ) +
|
||||
'"><span class="fa fa-save"></span>' +
|
||||
__e( o.label_persistent ) +
|
||||
__e( o.__('Persistent') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.temporary) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_temporary ) +
|
||||
__e( o.__('This room will disappear once the last person leaves') ) +
|
||||
'"><span class="fa fa-snowflake-o"></span>' +
|
||||
__e( o.label_temporary ) +
|
||||
__e( o.__('Temporary') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.nonanonymous) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_nonanonymous ) +
|
||||
__e( o.__('All other room occupants can see your XMPP username') ) +
|
||||
'"><span class="fa fa-id-card"></span>' +
|
||||
__e( o.label_nonanonymous ) +
|
||||
__e( o.__('Not anonymous') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.semianonymous) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_semianonymous ) +
|
||||
__e( o.__('Only moderators can see your XMPP username') ) +
|
||||
'"><span class="fa fa-user-secret"></span>' +
|
||||
__e( o.label_semianonymous ) +
|
||||
__e( o.__('Semi-anonymous') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.moderated) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_moderated ) +
|
||||
__e( o.__('This room is being moderated') ) +
|
||||
'"><span class="fa fa-gavel"></span>' +
|
||||
__e( o.label_moderated ) +
|
||||
__e( o.__('Moderated') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.unmoderated) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_unmoderated ) +
|
||||
__e( o.__('This room is not being moderated') ) +
|
||||
'"><span class="fa fa-info-circle"></span>' +
|
||||
__e( o.label_unmoderated ) +
|
||||
__e( o.__('Not moderated') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n';
|
||||
if (o.mam_enabled) { ;
|
||||
__p += '\n<li class="feature" title="' +
|
||||
__e( o.tt_mam_enabled ) +
|
||||
__e( o.__('Messages are archived on the server') ) +
|
||||
'"><span class="fa fa-database"></span>' +
|
||||
__e( o.label_mam_enabled ) +
|
||||
__e( o.__('Message archiving') ) +
|
||||
'</li>\n';
|
||||
} ;
|
||||
__p += '\n</ul>\n';
|
||||
@ -77862,7 +78026,9 @@ __p += '\n <a class="chatbox-btn configure-chatroom-button fa fa-wrench" titl
|
||||
__e(o.info_configure) +
|
||||
' "></a>\n ';
|
||||
} ;
|
||||
__p += '\n</div>\n';
|
||||
__p += '\n <a class="chatbox-btn show-room-details-modal fa fa-info-circle" title="' +
|
||||
__e(o.info_details) +
|
||||
'"></a>\n</div>\n';
|
||||
return __p
|
||||
};
|
||||
|
||||
|
1511
locale/converse.pot
1511
locale/converse.pot
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
#room-details-modal {
|
||||
.features-list {
|
||||
margin-left: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.chatroom-features {
|
||||
width: 100%;
|
||||
.features-list {
|
||||
padding-top: 0;
|
||||
.feature {
|
||||
width: 100%;
|
||||
margin-right: 0.5em;
|
||||
padding-right: 0;
|
||||
font-size: 1em;
|
||||
cursor: help;
|
||||
.fa {
|
||||
margin-right: 0.5em;
|
||||
color: $text-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.chat-head-chatroom {
|
||||
background-color: $chatroom-head-color;
|
||||
|
||||
@ -133,16 +158,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.chatroom-features {
|
||||
width: 100%;
|
||||
.feature {
|
||||
float: left;
|
||||
margin-right: 0.5em;
|
||||
padding-right: 0;
|
||||
font-size: 1em;
|
||||
cursor: help;
|
||||
}
|
||||
}
|
||||
.awesomplete {
|
||||
ul {
|
||||
padding: 0;
|
||||
@ -164,15 +179,6 @@
|
||||
flex-grow: 1;
|
||||
border-bottom: 1px solid lightgrey;
|
||||
}
|
||||
&.features-list {
|
||||
padding-top: 0;
|
||||
.feature {
|
||||
width: 100%;
|
||||
.fa {
|
||||
color: $text-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
li {
|
||||
cursor: default;
|
||||
display: block;
|
||||
|
@ -159,6 +159,10 @@ body.reset {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
@ -814,9 +814,8 @@
|
||||
.c('field', {'type':'text-single', 'var':'muc#roominfo_occupants', 'label':'Number of occupants'})
|
||||
.c('value').t(0);
|
||||
_converse.connection._dataRecv(test_utils.createRequest(features_stanza));
|
||||
test_utils.waitUntil(function () {
|
||||
return _.get(view.el.querySelector('.chatroom-description'), 'textContent');
|
||||
}).then(function () {
|
||||
test_utils.waitUntil(() => _.get(view.el.querySelector('.chatroom-description'), 'textContent'))
|
||||
.then(function () {
|
||||
expect($(view.el.querySelector('.chatroom-description')).text()).toBe('This is the description');
|
||||
done();
|
||||
});
|
||||
@ -1842,7 +1841,7 @@
|
||||
_converse.connection._dataRecv(test_utils.createRequest(features_stanza));
|
||||
|
||||
var view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
|
||||
expect(view.model.get('features_fetched')).toBe(true);
|
||||
expect(view.model.get('features_fetched')).toBeTruthy();
|
||||
expect(view.model.get('passwordprotected')).toBe(true);
|
||||
expect(view.model.get('hidden')).toBe(true);
|
||||
expect(view.model.get('temporary')).toBe(true);
|
||||
|
@ -3,11 +3,15 @@
|
||||
} (this, function (jasmine, mock, test_utils) {
|
||||
var _ = converse.env._;
|
||||
var $msg = converse.env.$msg;
|
||||
var $iq = converse.env.$iq;
|
||||
var $pres = converse.env.$pres;
|
||||
var Promise = converse.env.Promise;
|
||||
var Strophe = converse.env.Strophe;
|
||||
var u = converse.env.utils;
|
||||
|
||||
describe("The converse-roomslist plugin", function () {
|
||||
describe("A list of open rooms", function () {
|
||||
|
||||
it("is shown under a list of open rooms in the \"Rooms\" panel", mock.initConverseWithPromises(
|
||||
it("is shown in the \"Rooms\" panel", mock.initConverseWithPromises(
|
||||
null, ['rosterGroupsFetched'],
|
||||
{ allow_bookmarks: false // Makes testing easier, otherwise we
|
||||
// have to mock stanza traffic.
|
||||
@ -50,7 +54,104 @@
|
||||
));
|
||||
});
|
||||
|
||||
describe("An room shown in the rooms list", function () {
|
||||
describe("A room shown in the rooms list", function () {
|
||||
|
||||
it("has an info icon which opens a details modal when clicked", mock.initConverseWithPromises(
|
||||
null, ['rosterGroupsFetched'],
|
||||
{ whitelisted_plugins: ['converse-roomslist'],
|
||||
allow_bookmarks: false // Makes testing easier, otherwise we
|
||||
// have to mock stanza traffic.
|
||||
}, function (done, _converse) {
|
||||
|
||||
test_utils.openControlBox();
|
||||
_converse.api.rooms.open('coven@chat.shakespeare.lit', {'nick': 'some1'});
|
||||
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
|
||||
const last_stanza = _.last(_converse.connection.IQ_stanzas).nodeTree;
|
||||
const IQ_id = last_stanza.getAttribute('id');
|
||||
const features_stanza = $iq({
|
||||
'from': 'coven@chat.shakespeare.lit',
|
||||
'id': IQ_id,
|
||||
'to': 'dummy@localhost/desktop',
|
||||
'type': 'result'
|
||||
})
|
||||
.c('query', { 'xmlns': 'http://jabber.org/protocol/disco#info'})
|
||||
.c('identity', {
|
||||
'category': 'conference',
|
||||
'name': 'A Dark Cave',
|
||||
'type': 'text'
|
||||
}).up()
|
||||
.c('feature', {'var': 'http://jabber.org/protocol/muc'}).up()
|
||||
.c('feature', {'var': 'muc_passwordprotected'}).up()
|
||||
.c('feature', {'var': 'muc_hidden'}).up()
|
||||
.c('feature', {'var': 'muc_temporary'}).up()
|
||||
.c('feature', {'var': 'muc_open'}).up()
|
||||
.c('feature', {'var': 'muc_unmoderated'}).up()
|
||||
.c('feature', {'var': 'muc_nonanonymous'}).up()
|
||||
.c('feature', {'var': 'urn:xmpp:mam:0'}).up()
|
||||
.c('x', { 'xmlns':'jabber:x:data', 'type':'result'})
|
||||
.c('field', {'var':'FORM_TYPE', 'type':'hidden'})
|
||||
.c('value').t('http://jabber.org/protocol/muc#roominfo').up().up()
|
||||
.c('field', {'type':'text-single', 'var':'muc#roominfo_description', 'label':'Description'})
|
||||
.c('value').t('This is the description').up().up()
|
||||
.c('field', {'type':'text-single', 'var':'muc#roominfo_occupants', 'label':'Number of occupants'})
|
||||
.c('value').t(0);
|
||||
_converse.connection._dataRecv(test_utils.createRequest(features_stanza));
|
||||
|
||||
test_utils.waitUntil(() => view.model.get('connection_status') === converse.ROOMSTATUS.CONNECTING)
|
||||
.then(function () {
|
||||
var presence = $pres({
|
||||
to: _converse.connection.jid,
|
||||
from: 'coven@chat.shakespeare.lit/some1',
|
||||
id: 'DC352437-C019-40EC-B590-AF29E879AF97'
|
||||
}).c('x').attrs({xmlns:'http://jabber.org/protocol/muc#user'})
|
||||
.c('item').attrs({
|
||||
affiliation: 'member',
|
||||
jid: _converse.bare_jid,
|
||||
role: 'participant'
|
||||
}).up()
|
||||
.c('status').attrs({code:'110'});
|
||||
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
||||
|
||||
const room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room");
|
||||
expect(room_els.length).toBe(1);
|
||||
var info_el = _converse.rooms_list_view.el.querySelector(".room-info");
|
||||
info_el.click();
|
||||
|
||||
const modal = view.model.room_details_modal;
|
||||
return test_utils.waitUntil(() => u.isVisible(modal.el), 2000);
|
||||
}).then(() => {
|
||||
const modal = view.model.room_details_modal;
|
||||
let els = modal.el.querySelectorAll('p.room-info');
|
||||
expect(els[0].textContent).toBe("Room address (JID): coven@chat.shakespeare.lit")
|
||||
expect(els[1].textContent).toBe("Name: A Dark Cave")
|
||||
expect(els[2].textContent).toBe("Description: This is the description")
|
||||
expect(els[3].textContent).toBe("Online users: 1")
|
||||
const features_list = modal.el.querySelector('.features-list');
|
||||
expect(features_list.textContent.replace(/(\n|\s{2,})/g, '')).toBe(
|
||||
'Password protected - This room requires a password before entry'+
|
||||
'Hidden - This room is not publicly searchable'+
|
||||
'Open - Anyone can join this room'+
|
||||
'Temporary - This room will disappear once the last person leaves'+
|
||||
'Not anonymous - All other room occupants can see your XMPP username'+
|
||||
'Not moderated - This room is not being moderated'
|
||||
);
|
||||
const presence = $pres({
|
||||
to: 'dummy@localhost/_converse.js-29092160',
|
||||
from: 'coven@chat.shakespeare.lit/newguy'
|
||||
})
|
||||
.c('x', {xmlns: Strophe.NS.MUC_USER})
|
||||
.c('item', {
|
||||
'affiliation': 'none',
|
||||
'jid': 'newguy@localhost/_converse.js-290929789',
|
||||
'role': 'participant'
|
||||
});
|
||||
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
||||
|
||||
els = modal.el.querySelectorAll('p.room-info');
|
||||
expect(els[3].textContent).toBe("Online users: 2")
|
||||
done();
|
||||
});
|
||||
}));
|
||||
|
||||
it("can be closed", mock.initConverseWithPromises(
|
||||
null, ['rosterGroupsFetched'],
|
||||
|
@ -1,7 +1,6 @@
|
||||
(function (root, factory) {
|
||||
define(["jasmine", "mock", "test-utils"], factory);
|
||||
} (this, function (jasmine, mock, test_utils) {
|
||||
|
||||
var _ = converse.env._;
|
||||
var Strophe = converse.env.Strophe;
|
||||
var $msg = converse.env.$msg;
|
||||
|
@ -422,6 +422,7 @@
|
||||
},
|
||||
|
||||
showUserDetailsModal (ev) {
|
||||
ev.preventDefault();
|
||||
if (_.isUndefined(this.user_details_modal)) {
|
||||
this.user_details_modal = new _converse.UserDetailsModal({model: this.model});
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
"templates/add_chatroom_modal.html",
|
||||
"templates/chatarea.html",
|
||||
"templates/chatroom.html",
|
||||
"templates/chatroom_details_modal.html",
|
||||
"templates/chatroom_disconnect.html",
|
||||
"templates/chatroom_features.html",
|
||||
"templates/chatroom_form.html",
|
||||
@ -37,6 +38,7 @@
|
||||
tpl_add_chatroom_modal,
|
||||
tpl_chatarea,
|
||||
tpl_chatroom,
|
||||
tpl_chatroom_details_modal,
|
||||
tpl_chatroom_disconnect,
|
||||
tpl_chatroom_features,
|
||||
tpl_chatroom_form,
|
||||
@ -482,6 +484,26 @@
|
||||
});
|
||||
|
||||
|
||||
_converse.RoomDetailsModal = _converse.BootstrapModal.extend({
|
||||
|
||||
initialize () {
|
||||
_converse.BootstrapModal.prototype.initialize.apply(this, arguments);
|
||||
this.model.on('change', this.render, this);
|
||||
this.model.occupants.on('change', this.render, this);
|
||||
},
|
||||
|
||||
toHTML () {
|
||||
return tpl_chatroom_details_modal(_.extend(
|
||||
this.model.toJSON(), {
|
||||
'__': __,
|
||||
'display_name': this.model.getDisplayName(),
|
||||
'num_occupants': this.model.occupants.length
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
_converse.ChatRoomView = _converse.ChatBoxView.extend({
|
||||
/* Backbone.NativeView which renders a chat room, based upon the view
|
||||
* for normal one-on-one chat boxes.
|
||||
@ -495,6 +517,7 @@
|
||||
'click .chatbox-navback': 'showControlBox',
|
||||
'click .close-chatbox-button': 'close',
|
||||
'click .configure-chatroom-button': 'getAndRenderConfigurationForm',
|
||||
'click .show-room-details-modal': 'showRoomDetailsModal',
|
||||
'click .hide-occupants': 'hideOccupants',
|
||||
'click .new-msgs-indicator': 'viewUnreadMessages',
|
||||
'click .occupant-nick': 'onOccupantClicked',
|
||||
@ -595,6 +618,14 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
showRoomDetailsModal (ev) {
|
||||
ev.preventDefault();
|
||||
if (_.isUndefined(this.model.room_details_modal)) {
|
||||
this.model.room_details_modal = new _converse.RoomDetailsModal({'model': this.model});
|
||||
}
|
||||
this.model.room_details_modal.show(ev);
|
||||
},
|
||||
|
||||
showChatStateNotification (message) {
|
||||
if (message.get('sender') === 'me') {
|
||||
return;
|
||||
@ -632,10 +663,11 @@
|
||||
*/
|
||||
return tpl_chatroom_head(
|
||||
_.extend(this.model.toJSON(), {
|
||||
Strophe: Strophe,
|
||||
info_close: __('Close and leave this room'),
|
||||
info_configure: __('Configure this room'),
|
||||
description: this.model.get('description') || ''
|
||||
'Strophe': Strophe,
|
||||
'info_close': __('Close and leave this room'),
|
||||
'info_configure': __('Configure this room'),
|
||||
'info_details': __('Show more details about this room'),
|
||||
'description': this.model.get('description') || ''
|
||||
}));
|
||||
},
|
||||
|
||||
@ -1035,7 +1067,8 @@
|
||||
this.closeForm();
|
||||
});
|
||||
|
||||
form_el.addEventListener('submit', (ev) => {
|
||||
form_el.addEventListener('submit',
|
||||
(ev) => {
|
||||
ev.preventDefault();
|
||||
this.model.saveConfiguration(ev.target).then(
|
||||
this.model.getRoomFeatures.bind(this.model)
|
||||
@ -1547,16 +1580,13 @@
|
||||
|
||||
_converse.RoomsPanel = Backbone.NativeView.extend({
|
||||
/* Backbone.NativeView which renders MUC section of the control box.
|
||||
*
|
||||
* Chat rooms can be listed, joined and new rooms can be created.
|
||||
*/
|
||||
tagName: 'div',
|
||||
className: 'controlbox-section',
|
||||
id: 'chatrooms',
|
||||
events: {
|
||||
'click a.chatbox-btn.show-add-muc-modal': 'showAddRoomModal',
|
||||
'click a.chatbox-btn.show-list-muc-modal': 'showListRoomsModal',
|
||||
'click a.room-info': 'toggleRoomInfo'
|
||||
'click a.chatbox-btn.show-list-muc-modal': 'showListRoomsModal'
|
||||
},
|
||||
|
||||
render () {
|
||||
@ -1568,11 +1598,6 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
toggleRoomInfo (ev) {
|
||||
ev.preventDefault();
|
||||
toggleRoomInfo(ev);
|
||||
},
|
||||
|
||||
showAddRoomModal (ev) {
|
||||
if (_.isUndefined(this.add_room_modal)) {
|
||||
this.add_room_modal = new _converse.AddChatRoomModal({'model': this.model});
|
||||
@ -1703,34 +1728,8 @@
|
||||
|
||||
el.innerHTML = tpl_chatroom_features(
|
||||
_.extend(this.chatroomview.model.toJSON(), {
|
||||
'has_features': _.reduce(_.values(picks), iteratee),
|
||||
'label_features': __('Features'),
|
||||
'label_hidden': __('Hidden'),
|
||||
'label_mam_enabled': __('Message archiving'),
|
||||
'label_membersonly': __('Members only'),
|
||||
'label_moderated': __('Moderated'),
|
||||
'label_nonanonymous': __('Non-anonymous'),
|
||||
'label_open': __('Open'),
|
||||
'label_passwordprotected': __('Password protected'),
|
||||
'label_persistent': __('Persistent'),
|
||||
'label_public': __('Public'),
|
||||
'label_semianonymous': __('Semi-anonymous'),
|
||||
'label_temporary': __('Temporary'),
|
||||
'label_unmoderated': __('Unmoderated'),
|
||||
'label_unsecured': __('No password'),
|
||||
'tt_hidden': __('This room is not publicly searchable'),
|
||||
'tt_mam_enabled': __('Messages are archived on the server'),
|
||||
'tt_membersonly': __('This room is restricted to members only'),
|
||||
'tt_moderated': __('This room is being moderated'),
|
||||
'tt_nonanonymous': __('All other room occupants can see your XMPP username'),
|
||||
'tt_open': __('Anyone can join this room'),
|
||||
'tt_passwordprotected': __('This room requires a password before entry'),
|
||||
'tt_persistent': __('This room persists even if it\'s unoccupied'),
|
||||
'tt_public': __('This room is publicly searchable'),
|
||||
'tt_semianonymous': __('Only moderators can see your XMPP username'),
|
||||
'tt_temporary': __('This room will disappear once the last person leaves'),
|
||||
'tt_unmoderated': __('This room is not being moderated'),
|
||||
'tt_unsecured': __('This room does not require a password upon entry')
|
||||
'__': __,
|
||||
'has_features': _.reduce(_.values(picks), iteratee)
|
||||
}));
|
||||
this.setOccupantsHeight();
|
||||
return this;
|
||||
|
@ -246,6 +246,10 @@
|
||||
this.handlers[type][name] = callback;
|
||||
},
|
||||
|
||||
getDisplayName () {
|
||||
return this.get('name') || this.get('jid');
|
||||
},
|
||||
|
||||
join (nick, password) {
|
||||
/* Join the chat room.
|
||||
*
|
||||
@ -430,7 +434,7 @@
|
||||
* <feature var='urn:xmpp:mam:0'/>
|
||||
*/
|
||||
const features = {
|
||||
'features_fetched': true,
|
||||
'features_fetched': moment().format(),
|
||||
'name': iq.querySelector('identity').getAttribute('name')
|
||||
}
|
||||
_.each(iq.querySelectorAll('feature'), function (field) {
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
|
||||
_converse.OpenRooms = Backbone.Collection.extend({
|
||||
|
||||
comparator (room) {
|
||||
if (room.get('bookmarked')) {
|
||||
const bookmark = _.head(_converse.bookmarksview.model.where({'jid': room.get('jid')}));
|
||||
@ -97,6 +98,10 @@
|
||||
});
|
||||
|
||||
_converse.RoomsListElementView = Backbone.VDOMView.extend({
|
||||
events: {
|
||||
'click a.room-info': 'showRoomDetailsModal'
|
||||
},
|
||||
|
||||
initialize () {
|
||||
this.model.on('destroy', this.remove, this);
|
||||
this.model.on('remove', this.remove, this);
|
||||
@ -106,15 +111,6 @@
|
||||
this.model.on('change:num_unread_general', this.render, this);
|
||||
},
|
||||
|
||||
getRoomsListElementName () {
|
||||
if (this.model.get('bookmarked') && _converse.bookmarksview) {
|
||||
const bookmark = _.head(_converse.bookmarksview.model.where({'jid': this.model.get('jid')}));
|
||||
return bookmark.get('name');
|
||||
} else {
|
||||
return this.model.get('name');
|
||||
}
|
||||
},
|
||||
|
||||
toHTML () {
|
||||
return tpl_rooms_list_item(
|
||||
_.extend(this.model.toJSON(), {
|
||||
@ -130,9 +126,28 @@
|
||||
'name': this.getRoomsListElementName(),
|
||||
'open_title': __('Click to open this room')
|
||||
}));
|
||||
},
|
||||
|
||||
showRoomDetailsModal (ev) {
|
||||
const room = _converse.chatboxes.get(this.model.get('jid'));
|
||||
ev.preventDefault();
|
||||
if (_.isUndefined(room.room_details_modal)) {
|
||||
room.room_details_modal = new _converse.RoomDetailsModal({'model': room});
|
||||
}
|
||||
room.room_details_modal.show(ev);
|
||||
},
|
||||
|
||||
getRoomsListElementName () {
|
||||
if (this.model.get('bookmarked') && _converse.bookmarksview) {
|
||||
const bookmark = _.head(_converse.bookmarksview.model.where({'jid': this.model.get('jid')}));
|
||||
return bookmark.get('name');
|
||||
} else {
|
||||
return this.model.get('name');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
_converse.RoomsListView = Backbone.OrderedListView.extend({
|
||||
tagName: 'div',
|
||||
className: 'open-rooms-list list-container rooms-list-container',
|
||||
|
63
src/templates/chatroom_details_modal.html
Normal file
63
src/templates/chatroom_details_modal.html
Normal file
@ -0,0 +1,63 @@
|
||||
<div class="modal fade" id="room-details-modal" tabindex="-1" role="dialog" aria-labelledby="user-profile-modal-label" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="user-profile-modal-label">{{{o.display_name}}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="{{{o.label_close}}}"><span aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="room-info">
|
||||
<p class="room-info"><strong>{{{o.__('Room address (JID)')}}}</strong>: {{{o.jid}}}</p>
|
||||
<p class="room-info"><strong>{{{o.__('Name')}}}</strong>: {{{o.name}}}</p>
|
||||
<p class="room-info"><strong>{{{o.__('Description')}}}</strong>: {{{o.description}}}</p>
|
||||
<p class="room-info"><strong>{{{o.__('Online users')}}}</strong>: {{{o.num_occupants}}}</p>
|
||||
<p class="room-info"><strong>{{{o.__('Features')}}}</strong>:
|
||||
<div class="chatroom-features">
|
||||
<ul class="features-list">
|
||||
{[ if (o.passwordprotected) { ]}
|
||||
<li class="feature" ><span class="fa fa-lock"></span>{{{ o.__('Password protected') }}} - <em>{{{ o.__('This room requires a password before entry') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.unsecured) { ]}
|
||||
<li class="feature" ><span class="fa fa-unlock"></span>{{{ o.__('No password required') }}} - <em>{{{ o.__('This room does not require a password upon entry') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.hidden) { ]}
|
||||
<li class="feature" ><span class="fa fa-eye-slash"></span>{{{ o.__('Hidden') }}} - <em>{{{ o.__('This room is not publicly searchable') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.public_room) { ]}
|
||||
<li class="feature" ><span class="fa fa-eye"></span>{{{ o.__('Public') }}} - <em>{{{ o.__('This room is publicly searchable') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.membersonly) { ]}
|
||||
<li class="feature" ><span class="fa fa-address-book"></span>{{{ o.__('Members only') }}} - <em>{{{ o.__('this room is restricted to members only') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.open) { ]}
|
||||
<li class="feature" ><span class="fa fa-globe"></span>{{{ o.__('Open') }}} - <em>{{{ o.__('Anyone can join this room') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.persistent) { ]}
|
||||
<li class="feature" ><span class="fa fa-save"></span>{{{ o.__('Persistent') }}} - <em>{{{ o.__('This room persists even if it\'s unoccupied') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.temporary) { ]}
|
||||
<li class="feature" ><span class="fa fa-snowflake-o"></span>{{{ o.__('Temporary') }}} - <em>{{{ o.__('This room will disappear once the last person leaves') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.nonanonymous) { ]}
|
||||
<li class="feature" ><span class="fa fa-id-card"></span>{{{ o.__('Not anonymous') }}} - <em>{{{ o.__('All other room occupants can see your XMPP username') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.semianonymous) { ]}
|
||||
<li class="feature" ><span class="fa fa-user-secret"></span>{{{ o.__('Semi-anonymous') }}} - <em>{{{ o.__('Only moderators can see your XMPP username') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.moderated) { ]}
|
||||
<li class="feature" ><span class="fa fa-gavel"></span>{{{ o.__('Moderated') }}} - <em>{{{ o.__('This room is being moderated') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.unmoderated) { ]}
|
||||
<li class="feature" ><span class="fa fa-info-circle"></span>{{{ o.__('Not moderated') }}} - <em>{{{ o.__('This room is not being moderated') }}}</em></li>
|
||||
{[ } ]}
|
||||
{[ if (o.mam_enabled) { ]}
|
||||
<li class="feature" ><span class="fa fa-database"></span>{{{ o.__('Message archiving') }}} - <em>{{{ o.__('Messages are archived on the server') }}}</em></li>
|
||||
{[ } ]}
|
||||
</ul>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,44 +1,44 @@
|
||||
{[ if (o.has_features) { ]}
|
||||
<p class="occupants-heading">{{{o.label_features}}}</p>
|
||||
<p class="occupants-heading">{{{o.__('Features')}}}</p>
|
||||
{[ } ]}
|
||||
<ul class="features-list">
|
||||
{[ if (o.passwordprotected) { ]}
|
||||
<li class="feature" title="{{{ o.tt_passwordprotected }}}"><span class="fa fa-lock"></span>{{{ o.label_passwordprotected }}}</li>
|
||||
<li class="feature" title="{{{ o.__('This room requires a password before entry') }}}"><span class="fa fa-lock"></span>{{{ o.__('Password protected') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.unsecured) { ]}
|
||||
<li class="feature" title="{{{ o.tt_unsecured }}}"><span class="fa fa-unlock"></span>{{{ o.label_unsecured }}}</li>
|
||||
<li class="feature" title="{{{ o.__('This room does not require a password upon entry') }}}"><span class="fa fa-unlock"></span>{{{ o.__('No password') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.hidden) { ]}
|
||||
<li class="feature" title="{{{ o.tt_hidden }}}"><span class="fa fa-eye-slash"></span>{{{ o.label_hidden }}}</li>
|
||||
<li class="feature" title="{{{ o.__('This room is not publicly searchable') }}}"><span class="fa fa-eye-slash"></span>{{{ o.__('Hidden') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.public_room) { ]}
|
||||
<li class="feature" title="{{{ o.tt_public }}}"><span class="fa fa-eye"></span>{{{ o.label_public }}}</li>
|
||||
<li class="feature" title="{{{ o.__('This room is publicly searchable') }}}"><span class="fa fa-eye"></span>{{{ o.__('Public') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.membersonly) { ]}
|
||||
<li class="feature" title="{{{ o.tt_membersonly }}}"><span class="fa fa-address-book"></span>{{{ o.label_membersonly }}}</li>
|
||||
<li class="feature" title="{{{ o.__('this room is restricted to members only') }}}"><span class="fa fa-address-book"></span>{{{ o.__('Members only') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.open) { ]}
|
||||
<li class="feature" title="{{{ o.tt_open }}}"><span class="fa fa-globe"></span>{{{ o.label_open }}}</li>
|
||||
<li class="feature" title="{{{ o.__('Anyone can join this room') }}}"><span class="fa fa-globe"></span>{{{ o.__('Open') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.persistent) { ]}
|
||||
<li class="feature" title="{{{ o.tt_persistent }}}"><span class="fa fa-save"></span>{{{ o.label_persistent }}}</li>
|
||||
<li class="feature" title="{{{ o.__('This room persists even if it\'s unoccupied') }}}"><span class="fa fa-save"></span>{{{ o.__('Persistent') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.temporary) { ]}
|
||||
<li class="feature" title="{{{ o.tt_temporary }}}"><span class="fa fa-snowflake-o"></span>{{{ o.label_temporary }}}</li>
|
||||
<li class="feature" title="{{{ o.__('This room will disappear once the last person leaves') }}}"><span class="fa fa-snowflake-o"></span>{{{ o.__('Temporary') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.nonanonymous) { ]}
|
||||
<li class="feature" title="{{{ o.tt_nonanonymous }}}"><span class="fa fa-id-card"></span>{{{ o.label_nonanonymous }}}</li>
|
||||
<li class="feature" title="{{{ o.__('All other room occupants can see your XMPP username') }}}"><span class="fa fa-id-card"></span>{{{ o.__('Not anonymous') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.semianonymous) { ]}
|
||||
<li class="feature" title="{{{ o.tt_semianonymous }}}"><span class="fa fa-user-secret"></span>{{{ o.label_semianonymous }}}</li>
|
||||
<li class="feature" title="{{{ o.__('Only moderators can see your XMPP username') }}}"><span class="fa fa-user-secret"></span>{{{ o.__('Semi-anonymous') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.moderated) { ]}
|
||||
<li class="feature" title="{{{ o.tt_moderated }}}"><span class="fa fa-gavel"></span>{{{ o.label_moderated }}}</li>
|
||||
<li class="feature" title="{{{ o.__('This room is being moderated') }}}"><span class="fa fa-gavel"></span>{{{ o.__('Moderated') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.unmoderated) { ]}
|
||||
<li class="feature" title="{{{ o.tt_unmoderated }}}"><span class="fa fa-info-circle"></span>{{{ o.label_unmoderated }}}</li>
|
||||
<li class="feature" title="{{{ o.__('This room is not being moderated') }}}"><span class="fa fa-info-circle"></span>{{{ o.__('Not moderated') }}}</li>
|
||||
{[ } ]}
|
||||
{[ if (o.mam_enabled) { ]}
|
||||
<li class="feature" title="{{{ o.tt_mam_enabled }}}"><span class="fa fa-database"></span>{{{ o.label_mam_enabled }}}</li>
|
||||
<li class="feature" title="{{{ o.__('Messages are archived on the server') }}}"><span class="fa fa-database"></span>{{{ o.__('Message archiving') }}}</li>
|
||||
{[ } ]}
|
||||
</ul>
|
||||
|
@ -14,4 +14,5 @@
|
||||
{[ if (o.affiliation == 'owner') { ]}
|
||||
<a class="chatbox-btn configure-chatroom-button fa fa-wrench" title="{{{o.info_configure}}} "></a>
|
||||
{[ } ]}
|
||||
<a class="chatbox-btn show-room-details-modal fa fa-info-circle" title="{{{o.info_details}}}"></a>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user