summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-10-15 21:13:01 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-10-15 21:13:01 -0400
commit9b0ba5d668a20fc02bd28453395db9ed3fad3cf2 (patch)
treed6c73ef67d0c24efb8fd80ab8ae18f4eef7796c4
parent02251331ae3c67a31624ed84460444914b688a3e (diff)
Render footer on client instead of server.
* guix-web/view.scm (main-layout): Remove footer. (all-packages): Remove '#guix' div. (librejs): Add container and logo. * js/view/layout.js (guix.withLayout): Render footer.
-rw-r--r--guix-web/view.scm53
-rw-r--r--js/view/layout.js51
2 files changed, 55 insertions, 49 deletions
diff --git a/guix-web/view.scm b/guix-web/view.scm
index f444fbb..f8fc9d9 100644
--- a/guix-web/view.scm
+++ b/guix-web/view.scm
@@ -64,34 +64,14 @@
(define (main-layout subtitle body)
`(html
(head
+ (meta (@ (content "text/html;charset=utf-8")
+ (http-equiv "Content-Type")))
(title ,(string-append "GNU Guix - " subtitle))
(link (@ (rel "stylesheet")
(href "/css/bootstrap.css")))
(link (@ (rel "stylesheet")
(href "/css/guix.css"))))
- (body
- (div (@ (class "container"))
- (a (@ (href "/"))
- (image (@ (src "/images/logo.png"))))
- ,@body
- (footer
- (small
- ;; FIXME: Figure out why copyright character doesn't
- ;; render properly.
- (p "Copyright (C) 2014 Guix-web contributors")
- (p "Guix-web is licensed under the "
- (a (@ (href "http://www.gnu.org/licenses/agpl-3.0.html"))
- "GNU Affero General Public License (AGPL)")
- " - "
- (a (@ (href "https://getbootstrap.com"))
- "Bootstrap CSS")
- " is licensed under the "
- (a (@ (href "https://directory.fsf.org/wiki/License:Apache2.0"))
- "Apache 2.0 license")
- " - "
- (a (@ (href "/librejs")
- (rel "jslicense"))
- "JavaScript license information"))))))))
+ (body ,body)))
(define (license->json license)
(json
@@ -151,10 +131,7 @@
(else ""))))
(define (all-packages)
- (main-layout
- "Packages"
- `((div (@ (id "guix")) "")
- ,@(map script-tag javascripts))))
+ (main-layout "Packages" (map script-tag javascripts)))
;; This should be moved client-side and the server should just serve
;; the relevant JSON.
@@ -225,12 +202,16 @@
(main-layout
"LibreJS"
- `((h1 "JavaScript License Information")
- (table (@ (id "jslicense-labels1")
- (class "table"))
- (thead
- (tr
- (th "URI")
- (th "License")
- (th "Source Code")))
- (tbody ,@(map weblabel javascripts))))))
+ `(div (@ (class "container"))
+ (div
+ (a (@ (href "/"))
+ (img (@ (src "/images/logo.png")))))
+ (h1 "JavaScript License Information")
+ (table (@ (id "jslicense-labels1")
+ (class "table"))
+ (thead
+ (tr
+ (th "URI")
+ (th "License")
+ (th "Source Code")))
+ (tbody ,@(map weblabel javascripts))))))
diff --git a/js/view/layout.js b/js/view/layout.js
index 310c6c9..1ff641a 100644
--- a/js/view/layout.js
+++ b/js/view/layout.js
@@ -17,17 +17,42 @@
var guix = guix || {};
-guix.withLayout = function(elem) {
- return [
- m("nav.navbar.navbar-default.navbar-static-top", {
- role: "navigation"
- }, m(".container", [
- m(".navbar-header", m("img.logo", { src: "/images/logo.png" })),
- m("ul.nav.navbar-nav", [
- m("li.active", m("a", "Packages")),
+guix.withLayout = (function() {
+ var footer = m("footer", m("small.text-center", [
+ m("p", "Copyright 2014 guix-web contributors"),
+ m("ul.list-inline", [
+ m("li", [
+ "Guix-web is licensed under the ",
+ m("a", {
+ href: "http://www.gnu.org/licenses/agpl-3.0.html"
+ }, "GNU Affero General Public License version 3 or later")
]),
- m("ul.nav.navbar-nav.navbar-right")
- ])),
- m(".container", elem)
- ];
-};
+ m("li", [
+ m("a", {
+ href: "https://getbootstrap.com"
+ }, "Bootstrap CSS"),
+ " is licensed under the ",
+ m("a", {
+ href: "https://directory.fsf.org/wiki/License:Apache2.0"
+ }, "Apache 2.0 license")
+ ]),
+ m("li",
+ m("a", { href: "/librejs" }, "JavaScript license information"))
+ ])
+ ]));
+
+ return function(elem) {
+ return [
+ m("nav.navbar.navbar-default.navbar-static-top", {
+ role: "navigation"
+ }, m(".container", [
+ m(".navbar-header", m("img.logo", { src: "/images/logo.png" })),
+ m("ul.nav.navbar-nav", [
+ m("li.active", m("a", "Packages")),
+ ]),
+ m("ul.nav.navbar-nav.navbar-right")
+ ])),
+ m(".container", elem.concat([footer]))
+ ];
+ };
+})();