Programmatically set the occupants height

since I couldn't find a way to do this with only CSS.
This commit is contained in:
JC Brand 2017-03-01 08:42:26 +01:00
parent 78865bbccb
commit a895c91f14

View File

@ -445,6 +445,7 @@
// localstorage // localstorage
this.model.save(); this.model.save();
} }
this.occupantsview.setOccupantsHeight();
}, },
afterConnected: function () { afterConnected: function () {
@ -2005,9 +2006,10 @@
renderRoomFeatures: function () { renderRoomFeatures: function () {
var picks = _.pick(this.chatroomview.model.attributes, ROOM_FEATURES), var picks = _.pick(this.chatroomview.model.attributes, ROOM_FEATURES),
iteratee = function (a, v) { return a || v; }; iteratee = function (a, v) { return a || v; },
this.$('.chatroom-features').html( el = this.el.querySelector('.chatroom-features');
tpl_chatroom_features(
el.innerHTML = tpl_chatroom_features(
_.extend(this.chatroomview.model.toJSON(), { _.extend(this.chatroomview.model.toJSON(), {
'has_features': _.reduce(_.values(picks), iteratee), 'has_features': _.reduce(_.values(picks), iteratee),
'label_features': __('Features'), 'label_features': __('Features'),
@ -2037,11 +2039,17 @@
'tt_temporary': __('This room will disappear once the last person leaves'), 'tt_temporary': __('This room will disappear once the last person leaves'),
'tt_unmoderated': __('This room is not being moderated'), 'tt_unmoderated': __('This room is not being moderated'),
'tt_unsecured': __('This room does not require a password upon entry') 'tt_unsecured': __('This room does not require a password upon entry')
})) }));
); this.setOccupantsHeight();
return this; return this;
}, },
setOccupantsHeight: function () {
var el = this.el.querySelector('.chatroom-features');
this.el.querySelector('.occupant-list').style.cssText =
'height: calc(100% - '+el.offsetHeight+'px - 5em);';
},
onOccupantAdded: function (item) { onOccupantAdded: function (item) {
var view = this.get(item.get('id')); var view = this.get(item.get('id'));
if (!view) { if (!view) {