redesign: Change /#settings and /#administration to an overlay.

This also adds a box-shadow to the #deactivate_self_modal so that it
looks similar to the old backdrop.
This commit is contained in:
Brock Whittaker
2016-12-02 16:12:52 -08:00
committed by Tim Abbott
parent 7a76f3dcc8
commit 1143ed7219
22 changed files with 644 additions and 122 deletions

View File

@@ -149,6 +149,17 @@ function _setup_page() {
// at page load. This promise will be resolved with a list of streams after
// the first settings page load. build_stream_list then adds a callback to
// the promise, which in most cases will already be resolved.
var tab = (function () {
var tab = false;
var hash_sequence = window.location.hash.split(/\//);
if (/#*(settings)/.test(hash_sequence[0])) {
tab = hash_sequence[1];
return tab || "your-account";
}
return tab;
}());
if (_streams_deferred.state() !== "resolved") {
channel.get({
url: '/json/streams',
@@ -173,7 +184,7 @@ function _setup_page() {
zuliprc: 'zuliprc',
});
$("#settings").html(settings_tab);
$(".settings-box").html(settings_tab);
$("#settings-status").hide();
$("#notify-settings-status").hide();
$("#display-settings-status").hide();
@@ -186,6 +197,10 @@ function _setup_page() {
$("#show_api_key_box").hide();
$("#api_key_button_box").show();
if (tab) {
exports.launch_page(tab);
}
function clear_password_change() {
// Clear the password boxes so that passwords don't linger in the DOM
// for an XSS attacker to find.
@@ -463,10 +478,14 @@ function _setup_page() {
});
});
$("#default_language_modal [data-dismiss]").click(function () {
$("#default_language_modal").fadeOut(300);
});
$("#default_language_modal .language").click(function (e) {
e.preventDefault();
e.stopPropagation();
$('#default_language_modal').modal('hide');
$('#default_language_modal').fadeOut(300);
var data = {};
var $link = $(e.target).closest("a[data-code]");
@@ -495,7 +514,7 @@ function _setup_page() {
$('#default_language').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$('#default_language_modal').modal('show');
$('#default_language_modal').show().attr('aria-hidden', false);
});
$("#user_deactivate_account_button").on('click', function (e) {
@@ -835,6 +854,17 @@ exports.update_page = function () {
i18n.ensure_i18n(_update_page);
};
exports.launch_page = function (tab) {
var $active_tab = $("#settings_overlay_container li[data-section='" + tab + "']");
if (!$active_tab.hasClass("admin")) {
$(".sidebar .ind-tab[data-name='settings']").click();
}
$("#settings_overlay_container").addClass("show");
$active_tab.click();
};
return exports;
}());