mirror of https://github.com/zulip/zulip.git
help: Merge api.js and help.js bundles to fix code blocks.
In addition to decreasing the excessive number of bundles we had, this will set us up to fix rendering of code blocks when clicking the sidebar links in the /api-new site.
This commit is contained in:
parent
e86e259cb1
commit
f01f596138
|
@ -1,21 +0,0 @@
|
|||
function registerCodeSection($codeSection) {
|
||||
const $li = $codeSection.find("ul.nav li");
|
||||
const $blocks = $codeSection.find(".blocks div");
|
||||
|
||||
$li.click(function () {
|
||||
const language = this.dataset.language;
|
||||
|
||||
$li.removeClass("active");
|
||||
$li.filter("[data-language="+language+"]").addClass("active");
|
||||
|
||||
$blocks.removeClass("active");
|
||||
$blocks.filter("[data-language="+language+"]").addClass("active");
|
||||
});
|
||||
|
||||
$li.eq(0).click();
|
||||
}
|
||||
|
||||
|
||||
$(".code-section").each(function () {
|
||||
registerCodeSection($(this));
|
||||
});
|
|
@ -1,5 +1,28 @@
|
|||
const Ps = require('perfect-scrollbar');
|
||||
|
||||
function registerCodeSection($codeSection) {
|
||||
const $li = $codeSection.find("ul.nav li");
|
||||
const $blocks = $codeSection.find(".blocks div");
|
||||
|
||||
$li.click(function () {
|
||||
const language = this.dataset.language;
|
||||
|
||||
$li.removeClass("active");
|
||||
$li.filter("[data-language="+language+"]").addClass("active");
|
||||
|
||||
$blocks.removeClass("active");
|
||||
$blocks.filter("[data-language="+language+"]").addClass("active");
|
||||
});
|
||||
|
||||
$li.eq(0).click();
|
||||
}
|
||||
|
||||
function render_code_sections() {
|
||||
$(".code-section").each(function () {
|
||||
registerCodeSection($(this));
|
||||
});
|
||||
}
|
||||
|
||||
(function () {
|
||||
var html_map = {};
|
||||
var loading = {
|
||||
|
@ -86,4 +109,6 @@ const Ps = require('perfect-scrollbar');
|
|||
$(".sidebar.show").toggleClass("show");
|
||||
}
|
||||
});
|
||||
|
||||
render_code_sections();
|
||||
}());
|
||||
|
|
|
@ -29,5 +29,5 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{{ render_bundle("api") }}
|
||||
{{ render_bundle("help") }}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"activity": "./static/third/sorttable/sorttable.js",
|
||||
"api": "./static/js/portico/api.js",
|
||||
"portico": [
|
||||
"./static/js/portico/header.js"
|
||||
],
|
||||
|
@ -17,11 +16,6 @@
|
|||
"./node_modules/perfect-scrollbar/dist/js/perfect-scrollbar.jquery.js",
|
||||
"./static/js/portico/help.js"
|
||||
],
|
||||
"api": [
|
||||
"./node_modules/perfect-scrollbar/dist/js/perfect-scrollbar.jquery.js",
|
||||
"./static/js/portico/api.js",
|
||||
"./static/js/portico/help.js"
|
||||
],
|
||||
"katex": "./node_modules/katex/dist/katex.min.js",
|
||||
"landing-page": "./static/js/portico/landing-page.js",
|
||||
"integrations": "./static/js/portico/integrations.js",
|
||||
|
|
Loading…
Reference in New Issue