From e1f3352ac249faf6a3c6ac82a5b2498550656708 Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Tue, 22 Oct 2019 13:36:46 +0200 Subject: [PATCH 2/2] [wip] website: Add documentation videos. * website/static/videos/img/everyday-use-01.png: New file. * website/static/videos/img/everyday-use-02.png: New file. * website/static/videos/img/installation-from-script.png: New file. * website/apps/videos/data.scm: New file. * website/apps/videos/types.scm: New file. * website/apps/videos/utils.scm: New file. * website/apps/videos/templates/components.scm: New file. * website/apps/videos/templates/video-list.scm: New file. * website/apps/videos/templates/video.scm: New file. * website/apps/videos/builder.scm: New file. * website/haunt.scm (site): Add the builder. * website/apps/base/templates/components.scm (navbar): Add to navbar. * website/static/base/css/navbar.css: Increase size at which website switches to mobile mode. * website/apps/base/templates/home.scm (home-t): Reference videos in Discover Guix section. --- website/apps/base/templates/components.scm | 1 + website/apps/base/templates/home.scm | 8 ++- website/apps/videos/builder.scm | 65 +++++++++++++++++ website/apps/videos/data.scm | 46 ++++++++++++ website/apps/videos/templates/components.scm | 30 ++++++++ website/apps/videos/templates/video-list.scm | 46 ++++++++++++ website/apps/videos/templates/video.scm | 50 +++++++++++++ website/apps/videos/types.scm | 66 ++++++++++++++++++ website/apps/videos/utils.scm | 19 +++++ website/haunt.scm | 2 + website/static/base/css/navbar.css | 2 +- website/static/videos/img/everyday-use-01.png | Bin 0 -> 102437 bytes website/static/videos/img/everyday-use-02.png | Bin 0 -> 120292 bytes .../videos/img/installation-from-script.png | Bin 0 -> 91881 bytes 14 files changed, 333 insertions(+), 2 deletions(-) create mode 100644 website/apps/videos/builder.scm create mode 100644 website/apps/videos/data.scm create mode 100644 website/apps/videos/templates/components.scm create mode 100644 website/apps/videos/templates/video-list.scm create mode 100644 website/apps/videos/templates/video.scm create mode 100644 website/apps/videos/types.scm create mode 100644 website/apps/videos/utils.scm create mode 100644 website/static/videos/img/everyday-use-01.png create mode 100644 website/static/videos/img/everyday-use-02.png create mode 100644 website/static/videos/img/installation-from-script.png diff --git a/website/apps/base/templates/components.scm b/website/apps/base/templates/components.scm index d3f6af1..ac3cd7b 100644 --- a/website/apps/base/templates/components.scm +++ b/website/apps/base/templates/components.scm @@ -294,6 +294,7 @@ ,(menu-item #:label "Download" #:active-item active-item #:url (guix-url "download/")) ,(menu-item #:label "Packages" #:active-item active-item #:url (guix-url "packages/")) ,(menu-item #:label "Blog" #:active-item active-item #:url (guix-url "blog/")) + ,(menu-item #:label "Videos" #:active-item active-item #:url (guix-url "videos/")) ,(menu-item #:label "Help" #:active-item active-item #:url (guix-url "help/")) ,(menu-item #:label "Donate" #:active-item active-item #:url (guix-url "donate/")) diff --git a/website/apps/base/templates/home.scm b/website/apps/base/templates/home.scm index 5cb3bf5..6a856ca 100644 --- a/website/apps/base/templates/home.scm +++ b/website/apps/base/templates/home.scm @@ -117,7 +117,13 @@ ,@(map screenshot->shtml (context-datum context "screenshots"))) (div - (@ (class "action-box centered-text")) + (@ (class "fields-box")) + + ,(button-big + #:label "VIDEOS" + #:url (guix-url "videos/") + #:light #true) + " " ,(button-big #:label "ALL PACKAGES" #:url (guix-url "packages/") diff --git a/website/apps/videos/builder.scm b/website/apps/videos/builder.scm new file mode 100644 index 0000000..2a42220 --- /dev/null +++ b/website/apps/videos/builder.scm @@ -0,0 +1,65 @@ +;;; GNU Guix web site +;;; Copyright © 2019 Florian Pelz +;;; Initially written by sirgazil who waives all +;;; copyright interest on this file. + +(define-module (apps videos builder) + #:use-module (apps aux web) + #:use-module (apps videos data) + #:use-module (apps videos templates video) + #:use-module (apps videos templates video-list) + #:use-module (apps videos utils) + #:use-module (haunt html) + #:use-module (haunt page) + #:use-module (haunt utils) + #:use-module (srfi srfi-1) + #:export (builder)) + + +;;; +;;; Application builder. +;;; + +(define (builder site posts) + "Return the list of web resources that compose the app. + + This procedure is a Haunt builder procedure. + + SITE () + A site object that defines all the properties of the website. See + Haunt objects for more information. + + POSTS (list of ) + A list of post objects that represent articles from the blog. See + Haunt objects for more information. + + RETURN (list of ) + A list of page objects that represent the web resources of the + application. See Haunt objects for more information." + (flatten + (list (video-list-builder) + (videos-builder)))) + +;;; +;;; Helper builders. +;;; + +(define (videos-builder) + "Return a list of Haunt pages representing videos." + (map-in-order + (lambda (playlist) + (map-in-order + (lambda (previous video next) + (make-page (video->url video) + (video-t previous video next) + sxml->html)) + (cons #f (drop-right playlist 1)) + playlist + (append (cdr playlist) '(#f)))) + playlists)) + +(define (video-list-builder) + "Return a Haunt page displaying all videos." + (make-page (url-path-join "videos" "index.html") + (video-list-t) + sxml->html)) diff --git a/website/apps/videos/data.scm b/website/apps/videos/data.scm new file mode 100644 index 0000000..db11c98 --- /dev/null +++ b/website/apps/videos/data.scm @@ -0,0 +1,46 @@ +;;; GNU Guix web site +;;; Copyright © 2019 Florian Pelz +;;; Initially written by sirgazil who waves all +;;; copyright interest on this file. + +(define-module (apps videos data) + #:use-module (apps base utils) + #:use-module (apps videos types) + #:use-module (srfi srfi-19) + #:export (playlists)) + + +;;; +;;; Data. +;;; + + +(define playlists + ;; List of "playlists" of related videos in proper order. + (list + (list + (video + #:title "Installation from Script" + #:description + '(p "Explains how to install Guix on distributions not running +GNU Guix.") + #:url "https://archive.org/download/guix-videos/01-installation-from-script.webm" + #:poster (guix-url "static/videos/img/installation-from-script.png") + #:last-updated (string->date "2019-10-21T20:00:00" "~Y-~m-~dT~H:~M:~S"))) + (list + (video + #:title "Everyday use of GNU Guix, Part One" + #:description + '(p "Shows you how to install packages and how to manage software +package generations.") + #:url "https://archive.org/download/guix-videos/02-everyday-use-part-one.webm" + #:poster (guix-url "static/videos/img/everyday-use-01.png") + #:last-updated (string->date "2019-10-21T20:00:00" "~Y-~m-~dT~H:~M:~S")) + (video + #:title "Everyday use of GNU Guix, Part Two" + #:description + '(p "Shows you how to upgrade software and how to reclaim storage +space.") + #:url "https://archive.org/download/guix-videos/02-everyday-use-part-two.webm" + #:poster (guix-url "static/videos/img/everyday-use-02.png") + #:last-updated (string->date "2019-10-21T20:00:00" "~Y-~m-~dT~H:~M:~S"))))) diff --git a/website/apps/videos/templates/components.scm b/website/apps/videos/templates/components.scm new file mode 100644 index 0000000..fc9f916 --- /dev/null +++ b/website/apps/videos/templates/components.scm @@ -0,0 +1,30 @@ +;;; GNU Guix web site +;;; Copyright © 2019 Florian Pelz +;;; Initially written by sirgazil who waves all +;;; copyright interest on this file. + +(define-module (apps videos templates components) + #:use-module (apps base templates components) + #:use-module (apps videos types) + #:use-module (srfi srfi-19) + #:export (video-content)) + + +(define (video-content video) + `((div + (video + (@ (class "video-preview") + (src ,(video-url video)) + (poster ,(video-poster video)) + (controls "controls")) + (p + "Download video: " + ,(link-yellow + #:label (video-title video) + #:url (video-url video)) + " (1 minute, 30 seconds)."))) + ,(video-description video) + ,(let ((date (video-last-updated video))) + (if date + `(p "Last updated: " ,(date->string date)) + "")))) diff --git a/website/apps/videos/templates/video-list.scm b/website/apps/videos/templates/video-list.scm new file mode 100644 index 0000000..7847225 --- /dev/null +++ b/website/apps/videos/templates/video-list.scm @@ -0,0 +1,46 @@ +;;; GNU Guix web site +;;; Copyright © 2019 Florian Pelz +;;; Initially written by sirgazil who waves all +;;; copyright interest on this file. + +(define-module (apps videos templates video-list) + #:use-module (apps base templates components) + #:use-module (apps base templates theme) + #:use-module (apps base types) + #:use-module (apps base utils) + #:use-module (apps videos data) + #:use-module (apps videos templates components) + #:use-module (apps videos types) + #:use-module (apps videos utils) + #:export (video-list-t)) + + +(define (video-list-t) + "Return a list of videos in SHTML." + (theme + #:title '("Videos") + #:description + "Video about GNU Guix." + #:keywords + '("GNU" "Linux" "Unix" "Free software" "Libre software" + "Operating system" "GNU Hurd" "GNU Guix package manager" + "Help resources" "Videos") + #:active-menu-item "Videos" + #:css (list + (guix-url "static/base/css/page.css") + (guix-url "static/base/css/index.css")) + #:crumbs (list (crumb "Videos" (guix-url "videos/"))) + #:content + `(main + (@ (class "page centered-block limit-width")) + ,(map-in-order + (lambda (playlist) + `(,(map-in-order + (lambda (video) + `((h2 ,(link-yellow + #:label (video-title video) + #:url (guix-url (video->url video)))) + ,(video-content video))) + playlist) + ,(horizontal-separator))) + playlists)))) diff --git a/website/apps/videos/templates/video.scm b/website/apps/videos/templates/video.scm new file mode 100644 index 0000000..1737178 --- /dev/null +++ b/website/apps/videos/templates/video.scm @@ -0,0 +1,50 @@ +;;; GNU Guix web site +;;; Copyright © 2019 Florian Pelz +;;; Initially written by sirgazil who waves all +;;; copyright interest on this file. + +(define-module (apps videos templates video) + #:use-module (apps base templates components) + #:use-module (apps base templates theme) + #:use-module (apps base types) + #:use-module (apps base utils) + #:use-module (apps videos templates components) + #:use-module (apps videos types) + #:use-module (apps videos utils) + #:export (video-t)) + + +(define (video-t previous video next) + "Return a page in SHTML for the given VIDEO. If true, links to the +PREVIOUS and NEXT videos are added." + (theme + #:title (list "Video" (video-title video)) + #:description + "Video about GNU Guix." + #:keywords + '("GNU" "Linux" "Unix" "Free software" "Libre software" + "Operating system" "GNU Hurd" "GNU Guix package manager" + "Help resources" "Videos") + #:active-menu-item "Videos" + #:css (list + (guix-url "static/base/css/page.css") + (guix-url "static/base/css/index.css")) + #:crumbs (list (crumb "Videos" (guix-url "videos/")) + (crumb (video-title video) "./")) + #:content + `(main + (@ (class "page centered-block limit-width")) + (h2 ,(video-title video)) + ,(video-content video) + ,(if previous + `(div + ,(link-yellow + #:label "← Previous" + #:url (guix-url (video->url previous)))) + "") + ,(if next + `(div + ,(link-yellow + #:label "Next →" + #:url (guix-url (video->url next)))) + "")))) diff --git a/website/apps/videos/types.scm b/website/apps/videos/types.scm new file mode 100644 index 0000000..ababb44 --- /dev/null +++ b/website/apps/videos/types.scm @@ -0,0 +1,66 @@ +;;; GNU Guix web site +;;; Copyright © 2019 Florian Pelz +;;; Initially written by sirgazil who waves all +;;; copyright interest on this file. + +(define-module (apps videos types) + #:use-module (srfi srfi-9) + #:export (video + video? + video-description + video-last-updated + video-poster + video-title + video-url)) + + +;;; +;;; Data types. +;;; + +;;; Video (record type) +;;; --------------------- +;;; +;;; A video object represents something viewable in an HTML video +;;; element and accessible from the videos list on the website. +;;; +;;; Objects of this type can be created with the "video" procedure as +;;; well (see Helper procedures below). +;;; +;;; Fields: +;;; +;;; title (string) +;;; The full name of the video. For example: +;;; "Everyday use of GNU Guix, Part One". +;;; +;;; description (SXML) +;;; A short description. For example: +;;; '(p "Shows you how to install packages and how to manage +;;; software package generations."). +;;; +;;; url (string) +;;; A URL to the video file. +;;; +;;; poster (string) +;;; A URL to a representative preview image for the video. +;;; +;;; last-updated (date) +;;; Optional SRFI-19 upload date of the video file's most recent +;;; version, or #f. This should be specified for videos that +;;; possibly become outdated over time such as documentation videos. +;;; +(define-record-type