Remember which panel was open when reloading the page.
This commit is contained in:
parent
e5b2acde06
commit
d3090f80bc
@ -58,6 +58,8 @@
|
||||
converse.templates.search_contact = tpl_search_contact;
|
||||
converse.templates.status_option = tpl_status_option;
|
||||
|
||||
var USERS_PANEL_ID = 'users';
|
||||
|
||||
// Strophe methods for building stanzas
|
||||
var Strophe = converse_api.env.Strophe,
|
||||
utils = converse_api.env.utils;
|
||||
@ -323,6 +325,9 @@
|
||||
},
|
||||
|
||||
renderContactsPanel: function () {
|
||||
if (_.isUndefined(this.model.get('active-panel'))) {
|
||||
this.model.save({'active-panel': USERS_PANEL_ID});
|
||||
}
|
||||
this.contactspanel = new converse.ContactsPanel({
|
||||
'$parent': this.$el.find('.controlbox-panes')
|
||||
});
|
||||
@ -366,11 +371,12 @@
|
||||
},
|
||||
|
||||
onControlBoxToggleHidden: function () {
|
||||
var that = this;
|
||||
this.$el.show('fast', function () {
|
||||
converse.controlboxtoggle.updateOnlineCount();
|
||||
utils.refreshWebkit();
|
||||
converse.emit('controlBoxOpened', this);
|
||||
}.bind(this));
|
||||
converse.emit('controlBoxOpened', that);
|
||||
});
|
||||
},
|
||||
|
||||
show: function () {
|
||||
@ -386,10 +392,13 @@
|
||||
var $tab = $(ev.target),
|
||||
$sibling = $tab.parent().siblings('li').children('a'),
|
||||
$tab_panel = $($tab.attr('href'));
|
||||
$($sibling.attr('href')).hide();
|
||||
$($sibling.attr('href')).addClass('hidden');
|
||||
$sibling.removeClass('current');
|
||||
$tab.addClass('current');
|
||||
$tab_panel.show();
|
||||
$tab_panel.removeClass('hidden');
|
||||
if (converse.connection.connected) {
|
||||
this.model.save({'active-panel': $tab.data('id')});
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
@ -631,7 +640,11 @@
|
||||
include_offline_state: converse.include_offline_state,
|
||||
allow_logout: converse.allow_logout
|
||||
});
|
||||
this.$tabs.append(converse.templates.contacts_tab({label_contacts: LABEL_CONTACTS}));
|
||||
var controlbox = converse.chatboxes.get('controlbox');
|
||||
this.$tabs.append(converse.templates.contacts_tab({
|
||||
'label_contacts': LABEL_CONTACTS,
|
||||
'is_current': controlbox.get('active-panel') === USERS_PANEL_ID
|
||||
}));
|
||||
if (converse.xhr_user_search) {
|
||||
markup = converse.templates.search_contact({
|
||||
label_contact_name: __('Contact name'),
|
||||
@ -651,6 +664,9 @@
|
||||
}
|
||||
this.$el.html(widgets);
|
||||
this.$el.find('.search-xmpp ul').append(markup);
|
||||
if (controlbox.get('active-panel') !== USERS_PANEL_ID) {
|
||||
this.$el.addClass('hidden');
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -680,11 +680,7 @@
|
||||
// XXX: Deprecate in favor of init_deferred
|
||||
converse.callback();
|
||||
}
|
||||
if (converse.connection.service === 'jasmine tests') {
|
||||
init_deferred.resolve(converse);
|
||||
} else {
|
||||
init_deferred.resolve();
|
||||
}
|
||||
init_deferred.resolve();
|
||||
converse.emit('initialized');
|
||||
};
|
||||
|
||||
@ -1961,7 +1957,13 @@
|
||||
converse.emit('pluginsInitialized');
|
||||
converse._initialize();
|
||||
converse.registerGlobalEventHandlers();
|
||||
return init_deferred.promise();
|
||||
|
||||
if (!_.isUndefined(converse.connection) &&
|
||||
converse.connection.service === 'jasmine tests') {
|
||||
return converse;
|
||||
} else {
|
||||
return init_deferred.promise();
|
||||
}
|
||||
};
|
||||
return converse;
|
||||
}));
|
||||
|
@ -60,6 +60,8 @@
|
||||
converse.templates.room_item = tpl_room_item;
|
||||
converse.templates.room_panel = tpl_room_panel;
|
||||
|
||||
var ROOMS_PANEL_ID = 'chatrooms';
|
||||
|
||||
// Strophe methods for building stanzas
|
||||
var Strophe = converse_api.env.Strophe,
|
||||
$iq = converse_api.env.$iq,
|
||||
@ -1434,9 +1436,17 @@
|
||||
'label_join': __('Join Room'),
|
||||
'label_show_rooms': __('Show rooms')
|
||||
})
|
||||
).hide());
|
||||
));
|
||||
this.$tabs = this.$parent.parent().find('#controlbox-tabs');
|
||||
this.$tabs.append(converse.templates.chatrooms_tab({label_rooms: __('Rooms')}));
|
||||
|
||||
var controlbox = converse.chatboxes.get('controlbox');
|
||||
this.$tabs.append(converse.templates.chatrooms_tab({
|
||||
'label_rooms': __('Rooms'),
|
||||
'is_current': controlbox.get('active-panel') === ROOMS_PANEL_ID
|
||||
}));
|
||||
if (controlbox.get('active-panel') !== ROOMS_PANEL_ID) {
|
||||
this.$el.addClass('hidden');
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
'$parent': this.$el.find('.controlbox-panes'),
|
||||
'model': this
|
||||
});
|
||||
this.registerpanel.render().$el.hide();
|
||||
this.registerpanel.render().$el.addClass('hidden');
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -1 +1,4 @@
|
||||
<li><a class="s" href="#chatrooms">{{label_rooms}}</a></li>
|
||||
<li><a class="s {[ if (is_current) { ]} current {[ } ]}"
|
||||
data-id="chatrooms" href="#chatrooms">
|
||||
{{label_rooms}}
|
||||
</a></li>
|
||||
|
@ -1 +1,4 @@
|
||||
<li><a class="s current" href="#users">{{label_contacts}}</a></li>
|
||||
<li><a class="s {[ if (is_current) { ]} current {[ } ]}"
|
||||
data-id="users" href="#users">
|
||||
{{label_contacts}}
|
||||
</a></li>
|
||||
|
Loading…
Reference in New Issue
Block a user