| 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 | * Index page for a repository. |
| 18 | * |
| 19 | * @param repositoryName name of this repository. |
| 20 | * @param? menuEntries menu entries. |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 21 | * @param? customVariant variant name for custom styling. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 22 | * @param breadcrumbs breadcrumbs for this page. |
| 23 | * @param cloneUrl clone URL for this repository. |
| 24 | * @param description description text of the repository. |
| Shawn Pearce | 49b519b | 2012-12-21 21:15:45 -0800 | [diff] [blame] | 25 | * @param? mirroredFromUrl URL this repository is mirrored from. |
| Dave Borowitz | e5fead0 | 2013-01-07 13:12:59 -0800 | [diff] [blame] | 26 | * @param branches list of branch objects with url, name, and isHead keys. |
| Dave Borowitz | 209d0aa | 2012-12-28 14:28:53 -0800 | [diff] [blame] | 27 | * @param? moreBranchesUrl URL to show more branches, if necessary. |
| 28 | * @param tags list of tag objects with url and name keys. |
| 29 | * @param? moreTagsUrl URL to show more branches, if necessary. |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 30 | * @param hasLog whether a log should be shown for HEAD. |
| Shawn Pearce | 45e8375 | 2015-02-20 17:59:05 -0800 | [diff] [blame] | 31 | * @param? readmeHtml optional rendered README.md contents. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 32 | */ |
| 33 | {template .repositoryIndex} |
| Shawn Pearce | 45e8375 | 2015-02-20 17:59:05 -0800 | [diff] [blame] | 34 | {if $readmeHtml} |
| 35 | {call .header data="all"} |
| 36 | {param title: $repositoryName /} |
| 37 | {param repositoryName: null /} |
| 38 | {param menuEntries: $menuEntries /} |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 39 | {param customVariant: $customVariant /} |
| Shawn Pearce | 45e8375 | 2015-02-20 17:59:05 -0800 | [diff] [blame] | 40 | {param breadcrumbs: $breadcrumbs /} |
| 41 | {param css: [gitiles.DOC_CSS_URL] /} |
| 42 | {/call} |
| 43 | {else} |
| 44 | {call .header} |
| 45 | {param title: $repositoryName /} |
| 46 | {param repositoryName: null /} |
| 47 | {param menuEntries: $menuEntries /} |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 48 | {param customVariant: $customVariant /} |
| Shawn Pearce | 45e8375 | 2015-02-20 17:59:05 -0800 | [diff] [blame] | 49 | {param breadcrumbs: $breadcrumbs /} |
| 50 | {/call} |
| 51 | {/if} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 52 | |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 53 | {if $description} |
| 54 | <h2 class="RepoDescription">{$description}</h2> |
| 55 | {/if} |
| 56 | |
| 57 | {if $mirroredFromUrl} |
| 58 | <div class="RepoMirroredFrom"> |
| Shawn Pearce | 49b519b | 2012-12-21 21:15:45 -0800 | [diff] [blame] | 59 | {msg desc="Informational text describing source of repository"} |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 60 | Mirrored from <a href="{$mirroredFromUrl}">{$mirroredFromUrl}</a> |
| Shawn Pearce | 49b519b | 2012-12-21 21:15:45 -0800 | [diff] [blame] | 61 | {/msg} |
| Shawn Pearce | 49b519b | 2012-12-21 21:15:45 -0800 | [diff] [blame] | 62 | </div> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 63 | {/if} |
| 64 | |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 65 | <div class="CloneRepo"> |
| 66 | <div class="CloneRepo-title">Clone this repo:</div> |
| Andrew Bonventre | 0ffb282 | 2015-09-16 15:28:02 -0400 | [diff] [blame] | 67 | <input type="text" class="u-monospace CloneRepo-command" |
| Jonathan Nieder | 332f498 | 2016-04-07 10:20:55 -0700 | [diff] [blame] | 68 | onclick="this.focus();if(this.selectionStart==this.selectionEnd){lb}this.select(){rb}" |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 69 | readonly="readonly" value="git clone {$cloneUrl}"> |
| 70 | </div> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 71 | |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 72 | {if $hasLog and (length($branches) or length($tags))} |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 73 | <div class="RepoShortlog"> |
| 74 | <div class="RepoShortlog-refs"> |
| 75 | {call .branches_ data="all" /} |
| 76 | {call .tags_ data="all" /} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 77 | </div> |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 78 | <div class="RepoShortlog-log"> |
| 79 | {call .streamingPlaceholder /} |
| 80 | {if $readmeHtml} |
| 81 | <div class="doc RepoIndexDoc">{$readmeHtml}</div> |
| 82 | {/if} |
| 83 | </div> |
| Dave Borowitz | 209d0aa | 2012-12-28 14:28:53 -0800 | [diff] [blame] | 84 | </div> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 85 | |
| Dave Borowitz | f6dcf7a | 2014-07-30 10:26:58 -0700 | [diff] [blame] | 86 | {elseif $hasLog} |
| 87 | {call .streamingPlaceholder /} |
| Dave Borowitz | 209d0aa | 2012-12-28 14:28:53 -0800 | [diff] [blame] | 88 | {elseif length($branches) or length($tags)} |
| 89 | {call .branches_ data="all" /} |
| 90 | {call .tags_ data="all" /} |
| 91 | {/if} |
| 92 | |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 93 | {call .footer} |
| 94 | {param customVariant: $customVariant /} |
| 95 | {/call} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 96 | {/template} |
| 97 | |
| 98 | /** |
| Dave Borowitz | 209d0aa | 2012-12-28 14:28:53 -0800 | [diff] [blame] | 99 | * List of branches. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 100 | * |
| Dave Borowitz | 209d0aa | 2012-12-28 14:28:53 -0800 | [diff] [blame] | 101 | * @param? branches list of branch objects with url and name keys. |
| 102 | * @param? moreBranchesUrl URL to show more branches, if necessary. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 103 | */ |
| Andrew Bonventre | 869581c | 2017-06-22 12:40:15 -0700 | [diff] [blame] | 104 | {template .branches_ visibility="private"} |
| Dave Borowitz | 209d0aa | 2012-12-28 14:28:53 -0800 | [diff] [blame] | 105 | {if length($branches)} |
| 106 | {call .refList} |
| 107 | {param type: 'Branches' /} |
| 108 | {param refs: $branches /} |
| 109 | {/call} |
| 110 | {if $moreBranchesUrl} |
| 111 | <a href="{$moreBranchesUrl}">{msg desc="link to view more branches"}More...{/msg}</a> |
| 112 | {/if} |
| 113 | {/if} |
| 114 | {/template} |
| 115 | |
| 116 | /** |
| 117 | * List of tags. |
| 118 | * |
| 119 | * @param? tags list of branch objects with url and name keys. |
| 120 | * @param? moreTagsUrl URL to show more tags, if necessary. |
| 121 | */ |
| Andrew Bonventre | 869581c | 2017-06-22 12:40:15 -0700 | [diff] [blame] | 122 | {template .tags_ visibility="private"} |
| Dave Borowitz | 209d0aa | 2012-12-28 14:28:53 -0800 | [diff] [blame] | 123 | {if length($tags)} |
| 124 | {call .refList} |
| 125 | {param type: 'Tags' /} |
| 126 | {param refs: $tags /} |
| 127 | {/call} |
| 128 | {if $moreTagsUrl} |
| 129 | <a href="{$moreTagsUrl}">{msg desc="link to view more tags"}More...{/msg}</a> |
| 130 | {/if} |
| 131 | {/if} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 132 | {/template} |