1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
| | ;;; GNU Guix web site
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of the GNU Guix web site.
;;;
;;; The GNU Guix web site is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU Affero General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; The GNU Guix web site is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU Affero General Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public License
;;; along with the GNU Guix web site. If not, see <http://www.gnu.org/licenses/>.
(define-module (apps development templates components)
#:use-module (apps aux lists)
#:use-module (apps aux web)
#:use-module (apps base templates components)
#:use-module (apps base utils)
#:use-module (apps i18n)
#:use-module (apps development data)
#:use-module (srfi srfi-19)
#:export (branch->shtml))
(define (next-deadline date period)
"Return DATE or, if DATE is past, DATE + PERIOD. DATE must be a SRFI-19
date and PERIOD is a number of seconds."
(let ((now (current-time time-utc))
(then (date->time-utc date)))
(if (and (time>? now then)
(time> (time-difference now then)
(make-time time-utc 0
(* 2 7 3600 24))))
(time-utc->date
(make-time time-utc 0
(+ (time-second then) period)))
date)))
(define (branch->shtml branch)
`(div (@ (class "branch-overview"))
(div (@ (class "branch-overview-heading"))
(a (@ (href ,(branch-git-view-url branch)))
(tt ,(branch-name branch)))
(a (@ (href ,(branch-build-status-url branch)))
(img (@ (alt ,(G_ "branch build status"))
(src ,(branch-build-badge-url branch))))))
(div (@ (class "branch-synopsis"))
,(branch-synopsis branch))
(div (@ (class "branch-description"))
,(branch-description branch))
,@(if (branch-target-date branch)
`(,(G_ `(div (@ (class "branch-date"))
"target merge date: "
,(date->string
(next-deadline (branch-target-date branch)
(branch-merge-period branch))
(C_ "SRFI-19 data->string format"
"~Y-~m-~d")))))
'())))
|