| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 1 | // Copyright 2012 Google Inc. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| Dave Borowitz | e16e486 | 2014-06-26 12:23:18 -0700 | [diff] [blame] | 14 | {namespace gitiles autoescape="strict"} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 15 | |
| 16 | /** |
| 17 | * Detail page showing a shortlog for a commit. |
| 18 | * |
| 19 | * @param title human-readable revision name. |
| 20 | * @param repositoryName name of this repository. |
| 21 | * @param? menuEntries menu entries. |
| Dave Borowitz | 76bbefd | 2014-03-11 16:57:45 -0700 | [diff] [blame] | 22 | * @param? headerVariant variant name for custom header. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 23 | * @param breadcrumbs breadcrumbs for this page. |
| 24 | * @param? tags optional list of tags encountered when peeling this object, with |
| 25 | * keys corresponding to gitiles.tagDetail. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 26 | */ |
| 27 | {template .logDetail} |
| 28 | {call .header data="all" /} |
| 29 | |
| 30 | {if $tags} |
| 31 | {foreach $tag in $tags} |
| 32 | {call gitiles.tagDetail data="$tag" /} |
| 33 | {/foreach} |
| 34 | {/if} |
| 35 | |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 36 | {call .streamingPlaceholder /} |
| Dave Borowitz | b772cce | 2012-12-28 13:57:22 -0800 | [diff] [blame] | 37 | |
| 38 | {call .footer /} |
| 39 | {/template} |
| 40 | |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 41 | |
| Dave Borowitz | b772cce | 2012-12-28 13:57:22 -0800 | [diff] [blame] | 42 | /** |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 43 | * Header for list of log entries. |
| Dave Borowitz | b772cce | 2012-12-28 13:57:22 -0800 | [diff] [blame] | 44 | * |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 45 | * @param? pretty base "pretty" format for the log entry template. |
| Dave Borowitz | b772cce | 2012-12-28 13:57:22 -0800 | [diff] [blame] | 46 | * @param? previousUrl URL for the previous page of results. |
| 47 | */ |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 48 | {template .logEntriesHeader} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 49 | {if $previousUrl} |
| 50 | <div class="log-nav"> |
| 51 | <a href="{$previousUrl}">{msg desc="text for previous URL"}« Previous{/msg}</a> |
| 52 | </div> |
| 53 | {/if} |
| 54 | |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 55 | <ol class="{$pretty ?: 'default'} log"> |
| 56 | {/template} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 57 | |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Wrapper for a single log entry with pretty format and variant. |
| 61 | * |
| 62 | * @param firstWithPrevious whether this entry is the first in the current list, |
| 63 | * but also comes below a "Previous" link. |
| 64 | * @param variant variant name for log entry template. |
| 65 | * @param entry log entry; see .logEntry. |
| 66 | */ |
| 67 | {template .logEntryWrapper} |
| 68 | // TODO(dborowitz): Better CSS instead of this firstWithPrevious hack. |
| 69 | <li{if $firstWithPrevious} class="first"{/if}> |
| 70 | {delcall gitiles.logEntry variant="$variant ?: 'default'" data="$entry" /} |
| 71 | </li> |
| 72 | {/template} |
| 73 | |
| 74 | |
| 75 | /** |
| 76 | * Footer for the list of log entries. |
| 77 | * |
| 78 | * @param? nextUrl URL for the next page of results. |
| 79 | */ |
| 80 | {template .logEntriesFooter} |
| 81 | </ol> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 82 | {if $nextUrl} |
| 83 | <div class="log-nav"> |
| 84 | <a href="{$nextUrl}">{msg desc="text for next URL"}Next »{/msg}</a> |
| 85 | </div> |
| 86 | {/if} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 87 | {/template} |
| 88 | |
| Dave Borowitz | b772cce | 2012-12-28 13:57:22 -0800 | [diff] [blame] | 89 | |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 90 | /** |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 91 | * Single log entry indicating the full log is empty. |
| 92 | */ |
| 93 | {template .emptyLog} |
| 94 | <li class="empty">{msg desc="informational text for when the log is empty"}No commits.{/msg}</p> |
| 95 | {/template} |
| 96 | |
| 97 | |
| 98 | /** |
| Michael Moss | 558f864 | 2014-04-15 09:29:21 -0700 | [diff] [blame] | 99 | * Single pretty log entry, similar to --pretty=oneline. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 100 | * |
| 101 | * @param abbrevSha abbreviated SHA-1. |
| Michael Moss | 558f864 | 2014-04-15 09:29:21 -0700 | [diff] [blame] | 102 | * @param sha commit SHA-1. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 103 | * @param url URL to commit detail page. |
| 104 | * @param shortMessage short commit message. |
| Michael Moss | 558f864 | 2014-04-15 09:29:21 -0700 | [diff] [blame] | 105 | * @param message list of commit message parts, where each part contains: |
| 106 | * text: raw text of the part. |
| 107 | * url: optional URL that should be linked to from the part. |
| 108 | * @param author author information with at least "name" and "relativeTime" keys. |
| 109 | * @param committer committer information with at least "time" and "relativeTime" keys. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 110 | * @param branches list of branches for this entry, with "name" and "url" keys. |
| 111 | * @param tags list of tags for this entry, with "name" and "url" keys. |
| Michael Moss | 92bb12f | 2014-05-09 10:55:35 -0700 | [diff] [blame] | 112 | * @param diffTree unused in this variant. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 113 | */ |
| Michael Moss | 558f864 | 2014-04-15 09:29:21 -0700 | [diff] [blame] | 114 | {deltemplate gitiles.logEntry variant="'oneline'"} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 115 | <a href="{$url}"> |
| 116 | <span class="sha1">{$abbrevSha}</span> |
| 117 | // nbsp instad of CSS padding/margin because those cause a break in the |
| 118 | // underline. |
| 119 | |
| Michael Moss | 558f864 | 2014-04-15 09:29:21 -0700 | [diff] [blame] | 120 | {sp}<span>{$shortMessage}</span> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 121 | </a> |
| Dave Borowitz | 9cc6fd7 | 2014-04-07 19:08:29 -0700 | [diff] [blame] | 122 | {sp}<span class="author" title="{$author.email}">{msg desc="commit author name"}by {$author.name}{/msg}</span> |
| 123 | {sp}<span class="time" title="{$author.time}">- {$author.relativeTime}</span> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 124 | {if length($branches)} |
| 125 | {foreach $branch in $branches} |
| 126 | {sp}<a href="{$branch.url}" class="branch-label">{$branch.name}</a> |
| 127 | {/foreach} |
| 128 | {/if} |
| 129 | {if length($tags)} |
| 130 | {foreach $tag in $tags} |
| 131 | {sp}<a href="{$tag.url}" class="tag-label">{$tag.name}</a> |
| 132 | {/foreach} |
| 133 | {/if} |
| Stefan Zager | d218743 | 2014-02-28 02:23:02 -0800 | [diff] [blame] | 134 | {/deltemplate} |
| Michael Moss | 558f864 | 2014-04-15 09:29:21 -0700 | [diff] [blame] | 135 | |
| 136 | |
| 137 | /** |
| 138 | * Default single log entry (oneline format). |
| 139 | * |
| 140 | * @param abbrevSha abbreviated SHA-1. |
| 141 | * @param sha commit SHA-1. |
| 142 | * @param url URL to commit detail page. |
| 143 | * @param shortMessage short commit message. |
| 144 | * @param message list of commit message parts, where each part contains: |
| 145 | * text: raw text of the part. |
| 146 | * url: optional URL that should be linked to from the part. |
| 147 | * @param author author information with at least "name" and "relativeTime" keys. |
| 148 | * @param committer committer information with at least "time" and "relativeTime" keys. |
| 149 | * @param branches list of branches for this entry, with "name" and "url" keys. |
| 150 | * @param tags list of tags for this entry, with "name" and "url" keys. |
| Michael Moss | 92bb12f | 2014-05-09 10:55:35 -0700 | [diff] [blame] | 151 | * @param diffTree unused in this variant. |
| Michael Moss | 558f864 | 2014-04-15 09:29:21 -0700 | [diff] [blame] | 152 | */ |
| 153 | {deltemplate gitiles.logEntry variant="'default'"} |
| 154 | {delcall gitiles.logEntry variant="'oneline'" data="all" /} |
| 155 | {/deltemplate} |
| 156 | |
| 157 | |
| 158 | /** |
| 159 | * Single pretty log entry, similar to --pretty=full. |
| 160 | * |
| 161 | * @param abbrevSha abbreviated SHA-1. |
| 162 | * @param sha commit SHA-1. |
| 163 | * @param url URL to commit detail page. |
| 164 | * @param shortMessage short commit message. |
| 165 | * @param message list of commit message parts, where each part contains: |
| 166 | * text: raw text of the part. |
| 167 | * url: optional URL that should be linked to from the part. |
| 168 | * @param author author information with at least "name" and "relativeTime" keys. |
| 169 | * @param committer committer information with at least "time" and "relativeTime" keys. |
| 170 | * @param branches list of branches for this entry, with "name" and "url" keys. |
| 171 | * @param tags list of tags for this entry, with "name" and "url" keys. |
| Michael Moss | 92bb12f | 2014-05-09 10:55:35 -0700 | [diff] [blame] | 172 | * @param diffTree unused in this variant. |
| Michael Moss | 558f864 | 2014-04-15 09:29:21 -0700 | [diff] [blame] | 173 | */ |
| 174 | {deltemplate gitiles.logEntry variant="'full'"} |
| 175 | <div class="git-commit"> |
| 176 | <table> |
| 177 | <tr> |
| 178 | <th>{msg desc="Header for commit SHA entry"}commit{/msg}</th> |
| 179 | <td class="sha1"> |
| 180 | <a href="{$url}">{$sha}</a> |
| 181 | </td> |
| 182 | <td> |
| 183 | {if length($branches)} |
| 184 | {foreach $branch in $branches} |
| 185 | {sp}<a href="{$branch.url}" class="branch-label">{$branch.name}</a> |
| 186 | {/foreach} |
| 187 | {/if} |
| 188 | {if length($tags)} |
| 189 | {foreach $tag in $tags} |
| 190 | {sp}<a href="{$tag.url}" class="tag-label">{$tag.name}</a> |
| 191 | {/foreach} |
| 192 | {else} |
| 193 | {sp} |
| 194 | {/if} |
| 195 | </td> |
| 196 | </tr> |
| 197 | <tr> |
| 198 | <th>{msg desc="Header for commit author"}author{/msg}</th> |
| 199 | <td>{call .person_ data="$author" /}</td> |
| 200 | <td>{$author.time}</td> |
| 201 | </tr> |
| 202 | <tr> |
| 203 | <th>{msg desc="Header for committer"}committer{/msg}</th> |
| 204 | <td>{call .person_ data="$committer" /}</td> |
| 205 | <td>{$committer.time}</td> |
| 206 | </tr> |
| 207 | </table> |
| 208 | </div> |
| 209 | <pre class="commit-message"> |
| 210 | {$message} |
| 211 | </pre> |
| 212 | {/deltemplate} |