zulip/web/src/spectators.js
Anders Kaseorg c1675913a2 web: Move web app to ‘web’ directory.
Ever since we started bundling the app with webpack, there’s been less
and less overlap between our ‘static’ directory (files belonging to
the frontend app) and Django’s interpretation of the ‘static’
directory (files served directly to the web).

Split the app out to its own ‘web’ directory outside of ‘static’, and
remove all the custom collectstatic --ignore rules.  This makes it
much clearer what’s actually being served to the web, and what’s being
bundled by webpack.  It also shrinks the release tarball by 3%.

Signed-off-by: Anders Kaseorg <[email protected]>
2023-02-23 16:04:17 -08:00

39 lines
1.3 KiB
JavaScript

// Module for displaying the modal asking spectators to log in when
// attempting to do things that are not possible as a spectator (like
// add an emoji reaction, star a message, etc.). While in many cases,
// we will prefer to hide menu options that don't make sense for
// spectators, this modal is useful for everything that doesn't make
// sense to remove from a design perspective.
import $ from "jquery";
import render_login_to_access_modal from "../templates/login_to_access.hbs";
import * as browser_history from "./browser_history";
import * as hash_util from "./hash_util";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
export function login_to_access(empty_narrow) {
// Hide all overlays, popover and go back to the previous hash if the
// hash has changed.
const login_link = hash_util.build_login_link();
const realm_name = page_params.realm_name;
$("body").append(
render_login_to_access_modal({
signup_link: "/register/",
login_link,
empty_narrow,
realm_name,
}),
);
overlays.open_modal("login_to_access_modal", {
autoremove: true,
on_hide() {
browser_history.return_to_web_public_hash();
},
});
}