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