Repair relative urls within static-rendered files in non-default settings
This commit is contained in:
parent
f5ba9045c5
commit
316daca342
|
@ -11,6 +11,7 @@
|
||||||
bootstrap-page-stylesheets
|
bootstrap-page-stylesheets
|
||||||
bootstrap-page-scripts
|
bootstrap-page-scripts
|
||||||
bootstrap-cookies
|
bootstrap-cookies
|
||||||
|
bootstrap-inline-js
|
||||||
|
|
||||||
bootstrap-response
|
bootstrap-response
|
||||||
bootstrap-redirect
|
bootstrap-redirect
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
(define bootstrap-page-stylesheets (make-parameter '()))
|
(define bootstrap-page-stylesheets (make-parameter '()))
|
||||||
(define bootstrap-page-scripts (make-parameter '()))
|
(define bootstrap-page-scripts (make-parameter '()))
|
||||||
(define bootstrap-cookies (make-parameter '()))
|
(define bootstrap-cookies (make-parameter '()))
|
||||||
|
(define bootstrap-inline-js (make-parameter #f))
|
||||||
|
|
||||||
(define (static str)
|
(define (static str)
|
||||||
(string-append (bootstrap-static-urlprefix) str))
|
(string-append (bootstrap-static-urlprefix) str))
|
||||||
|
@ -90,6 +92,7 @@
|
||||||
,title-element
|
,title-element
|
||||||
,@body-contents)
|
,@body-contents)
|
||||||
|
|
||||||
|
(script ,@(cond [(bootstrap-inline-js) => list] [else '()]))
|
||||||
(script ((type "text/javascript") (src ,(static "/jquery.min.js"))))
|
(script ((type "text/javascript") (src ,(static "/jquery.min.js"))))
|
||||||
(script ((type "text/javascript") (src ,(static "/jquery.tablesorter.min.js"))))
|
(script ((type "text/javascript") (src ,(static "/jquery.tablesorter.min.js"))))
|
||||||
(script ((type "text/javascript") (src ,(static "/jquery-ui.min.js"))))
|
(script ((type "text/javascript") (src ,(static "/jquery-ui.min.js"))))
|
||||||
|
|
24
src/site.rkt
24
src/site.rkt
|
@ -98,16 +98,18 @@
|
||||||
(authentication-wrap* #t request (lambda () body ...)))
|
(authentication-wrap* #t request (lambda () body ...)))
|
||||||
|
|
||||||
(define-syntax-rule (with-site-config body ...)
|
(define-syntax-rule (with-site-config body ...)
|
||||||
(parameterize ((bootstrap-navbar-header navbar-header)
|
(let ((static-base (if (rendering-static-page?) static-urlprefix "")))
|
||||||
(bootstrap-navigation `((,nav-index ,(main-page-url))
|
(parameterize ((bootstrap-navbar-header navbar-header)
|
||||||
(,nav-search ,(named-url search-page))
|
(bootstrap-navigation `((,nav-index ,(main-page-url))
|
||||||
;; ((div ,(glyphicon 'download-alt)
|
(,nav-search ,(named-url search-page))
|
||||||
;; " Download")
|
;; ((div ,(glyphicon 'download-alt)
|
||||||
;; "http://download.racket-lang.org/")
|
;; " Download")
|
||||||
))
|
;; "http://download.racket-lang.org/")
|
||||||
(bootstrap-static-urlprefix (if (rendering-static-page?) static-urlprefix ""))
|
))
|
||||||
(jsonp-baseurl backend-baseurl))
|
(bootstrap-static-urlprefix static-base)
|
||||||
body ...))
|
(bootstrap-inline-js (format "PkgSiteBaseUrl = '~a/json/';" static-base))
|
||||||
|
(jsonp-baseurl backend-baseurl))
|
||||||
|
body ...)))
|
||||||
|
|
||||||
(define clear-session-cookie (make-cookie COOKIE
|
(define clear-session-cookie (make-cookie COOKIE
|
||||||
""
|
""
|
||||||
|
@ -579,7 +581,7 @@
|
||||||
|
|
||||||
(define (main-page request)
|
(define (main-page request)
|
||||||
(parameterize ((bootstrap-active-navigation nav-index)
|
(parameterize ((bootstrap-active-navigation nav-index)
|
||||||
(bootstrap-page-scripts '("/searchbox.js")))
|
(bootstrap-page-scripts (list (string-append static-urlprefix "/searchbox.js"))))
|
||||||
(define package-name-list (package-search "" '((main-distribution #f))))
|
(define package-name-list (package-search "" '((main-distribution #f))))
|
||||||
(authentication-wrap
|
(authentication-wrap
|
||||||
#:request request
|
#:request request
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#q").focus();
|
$("#q").focus();
|
||||||
$.getJSON("/json/search-completions", function (searchCompletions) {
|
PkgSite.getJSON("search-completions", function (searchCompletions) {
|
||||||
searchCompletions.sort();
|
searchCompletions.sort();
|
||||||
PkgSite.multiTermComplete(PkgSite.preventTabMovingDuringSelection($("#q")), searchCompletions);
|
PkgSite.multiTermComplete(PkgSite.preventTabMovingDuringSelection($("#q")), searchCompletions);
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,6 +25,10 @@ PkgSite = (function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getJSON(relative_url, k) {
|
||||||
|
return $.getJSON(PkgSiteJsonBaseUrl + relative_url, k);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
multiTermComplete: multiTermComplete,
|
multiTermComplete: multiTermComplete,
|
||||||
preventTabMovingDuringSelection: preventTabMovingDuringSelection
|
preventTabMovingDuringSelection: preventTabMovingDuringSelection
|
||||||
|
@ -35,13 +39,13 @@ $(document).ready(function () {
|
||||||
$("table.sortable").tablesorter();
|
$("table.sortable").tablesorter();
|
||||||
|
|
||||||
if ($("#tags").length) {
|
if ($("#tags").length) {
|
||||||
$.getJSON((document.body.className === "package-form")
|
PkgSite.getJSON((document.body.className === "package-form")
|
||||||
? "/json/formal-tags"
|
? "formal-tags"
|
||||||
: "/json/tag-search-completions",
|
: "tag-search-completions",
|
||||||
function (completions) {
|
function (completions) {
|
||||||
completions.sort();
|
completions.sort();
|
||||||
PkgSite.multiTermComplete(PkgSite.preventTabMovingDuringSelection($("#tags")),
|
PkgSite.multiTermComplete(PkgSite.preventTabMovingDuringSelection($("#tags")),
|
||||||
completions);
|
completions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user