Add goto button in commit box
gitile/pages.scm
60 | 60 | `(p "Empty repository") | |
61 | 61 | (if (null? files) | |
62 | 62 | `(,path-box | |
63 | - | (div (@ (class "content")) | |
63 | + | (div (@ (class "content")) | |
64 | 64 | (p ,(basename path)) | |
65 | - | (p (@ (class "button-row")) | |
66 | - | (a (@ (href "/" ,repository-name "/raw/" ,(or ref "-") | |
67 | - | "/" ,path)) | |
68 | - | (img (@ (src "/images/file-type-3.svg")))))) | |
65 | + | (p (@ (class "button-row")) | |
66 | + | (a (@ (href "/" ,repository-name "/raw/" ,(or ref "-") | |
67 | + | "/" ,path)) | |
68 | + | (img (@ (src "/images/file-type-3.svg")))))) | |
69 | 69 | (pre ,(utf8->string (get-file-content repo path #:ref ref)))) | |
70 | 70 | `(,(last-commit-infobox repository-name repo ref) | |
71 | 71 | ,path-box | |
… | |||
121 | 121 | (commit (last-commit repo ref))) | |
122 | 122 | (commit-infobox repository-name commit))) | |
123 | 123 | ||
124 | - | (define (commit-infobox repository-name commit) | |
124 | + | (define* (commit-infobox repository-name commit #:key (open? #f)) | |
125 | 125 | `(div (@ (class "commit-info")) | |
126 | 126 | (p (img (@ (src ,(author-image (commit-author commit)))))) | |
127 | 127 | (div (@ (class "commit")) | |
… | |||
138 | 138 | ,(string-take (oid->string (commit-id commit)) 7)) | |
139 | 139 | (button (@ (data-clipboard-copy ,(oid->string (commit-id commit))) | |
140 | 140 | (class "copy")) | |
141 | - | (img (@ (src "/images/copy.png"))))))) | |
141 | + | (img (@ (src "/images/copy.png")))) | |
142 | + | ,(if open? | |
143 | + | `(a (@ (href "/" ,repository-name "/tree/" | |
144 | + | ,(oid->string (commit-id commit)))) | |
145 | + | (img (@ (src "/images/go.png")))) | |
146 | + | '())))) | |
142 | 147 | ||
143 | 148 | (define (project-commits repository-name repo ref) | |
144 | 149 | (let* ((commits (get-commits repo ref)) | |
145 | 150 | (next (cdr commits)) | |
146 | 151 | (commits (car commits))) | |
147 | 152 | `(,(map (lambda (commit) | |
148 | - | (commit-infobox repository-name commit)) | |
153 | + | (commit-infobox repository-name commit #:open? #t)) | |
149 | 154 | commits) | |
150 | 155 | ,(if next | |
151 | 156 | `(p (a (@ (href "/" ,repository-name "/commits/" | |
… | |||
155 | 160 | (define (parent-paths-box repository-name ref path) | |
156 | 161 | `(div (@ (class "path-box")) | |
157 | 162 | ,(if (null? (pk 'path path)) | |
158 | - | `(a (@ (href "/" ,repository-name)) ,repository-name) | |
163 | + | `(a (@ (href "/" ,repository-name)) ,repository-name) | |
159 | 164 | (fold | |
160 | 165 | (lambda (p res) | |
161 | 166 | (cons* p "/" res)) | |
162 | 167 | (list `(a ,(car (reverse path)))) | |
163 | 168 | (map | |
164 | 169 | (lambda (p) | |
165 | - | (let ((p (if (string-null? p) p (substring p 1))) | |
166 | - | (base (if (string-null? (basename p)) | |
167 | - | repository-name | |
168 | - | (basename p)))) | |
170 | + | (let ((p (if (string-null? p) p (substring p 1))) | |
171 | + | (base (if (string-null? (basename p)) | |
172 | + | repository-name | |
173 | + | (basename p)))) | |
169 | 174 | `(a (@ (href "/" ,repository-name "/tree/" ,(or ref "-") "/" ,p)) | |
170 | 175 | ,base))) | |
171 | 176 | (fold |