blob: 78f5b79fcc2e0c11fe4537a913f2bb02c6dd3b26 [file] [log] [blame]
Dave Borowitz9de65952012-08-13 16:09:45 -07001// 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 Borowitze16e4862014-06-26 12:23:18 -070014{namespace gitiles autoescape="strict"}
Dave Borowitz9de65952012-08-13 16:09:45 -070015
16/**
17 * Index page for a repository.
18 *
19 * @param repositoryName name of this repository.
20 * @param? menuEntries menu entries.
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020021 * @param? customVariant variant name for custom styling.
Dave Borowitz9de65952012-08-13 16:09:45 -070022 * @param breadcrumbs breadcrumbs for this page.
23 * @param cloneUrl clone URL for this repository.
24 * @param description description text of the repository.
Shawn Pearce49b519b2012-12-21 21:15:45 -080025 * @param? mirroredFromUrl URL this repository is mirrored from.
Dave Borowitze5fead02013-01-07 13:12:59 -080026 * @param branches list of branch objects with url, name, and isHead keys.
Dave Borowitz209d0aa2012-12-28 14:28:53 -080027 * @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 Borowitzf6dcf7a2014-07-30 10:26:58 -070030 * @param hasLog whether a log should be shown for HEAD.
Shawn Pearce45e83752015-02-20 17:59:05 -080031 * @param? readmeHtml optional rendered README.md contents.
Dave Borowitz9de65952012-08-13 16:09:45 -070032 */
33{template .repositoryIndex}
Shawn Pearce45e83752015-02-20 17:59:05 -080034{if $readmeHtml}
35 {call .header data="all"}
36 {param title: $repositoryName /}
37 {param repositoryName: null /}
38 {param menuEntries: $menuEntries /}
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020039 {param customVariant: $customVariant /}
Shawn Pearce45e83752015-02-20 17:59:05 -080040 {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 Pedersenbc0eaaa2016-03-29 15:30:29 +020048 {param customVariant: $customVariant /}
Shawn Pearce45e83752015-02-20 17:59:05 -080049 {param breadcrumbs: $breadcrumbs /}
50 {/call}
51{/if}
Dave Borowitz9de65952012-08-13 16:09:45 -070052
Andrew Bonventreb33426e2015-09-09 18:28:28 -040053{if $description}
54 <h2 class="RepoDescription">{$description}</h2>
55{/if}
56
57{if $mirroredFromUrl}
58 <div class="RepoMirroredFrom">
Shawn Pearce49b519b2012-12-21 21:15:45 -080059 {msg desc="Informational text describing source of repository"}
Andrew Bonventreb33426e2015-09-09 18:28:28 -040060 Mirrored from <a href="{$mirroredFromUrl}">{$mirroredFromUrl}</a>
Shawn Pearce49b519b2012-12-21 21:15:45 -080061 {/msg}
Shawn Pearce49b519b2012-12-21 21:15:45 -080062 </div>
Dave Borowitz9de65952012-08-13 16:09:45 -070063{/if}
64
Andrew Bonventreb33426e2015-09-09 18:28:28 -040065<div class="CloneRepo">
66 <div class="CloneRepo-title">Clone this repo:</div>
Andrew Bonventre0ffb2822015-09-16 15:28:02 -040067 <input type="text" class="u-monospace CloneRepo-command"
Jonathan Nieder332f4982016-04-07 10:20:55 -070068 onclick="this.focus();if(this.selectionStart==this.selectionEnd){lb}this.select(){rb}"
Andrew Bonventreb33426e2015-09-09 18:28:28 -040069 readonly="readonly" value="git clone {$cloneUrl}">
70</div>
Dave Borowitz9de65952012-08-13 16:09:45 -070071
Dave Borowitzf6dcf7a2014-07-30 10:26:58 -070072{if $hasLog and (length($branches) or length($tags))}
Andrew Bonventreb33426e2015-09-09 18:28:28 -040073 <div class="RepoShortlog">
74 <div class="RepoShortlog-refs">
75 {call .branches_ data="all" /}
76 {call .tags_ data="all" /}
Dave Borowitz9de65952012-08-13 16:09:45 -070077 </div>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040078 <div class="RepoShortlog-log">
79 {call .streamingPlaceholder /}
80 {if $readmeHtml}
81 <div class="doc RepoIndexDoc">{$readmeHtml}</div>
82 {/if}
83 </div>
Dave Borowitz209d0aa2012-12-28 14:28:53 -080084 </div>
Dave Borowitz9de65952012-08-13 16:09:45 -070085
Dave Borowitzf6dcf7a2014-07-30 10:26:58 -070086{elseif $hasLog}
87 {call .streamingPlaceholder /}
Dave Borowitz209d0aa2012-12-28 14:28:53 -080088{elseif length($branches) or length($tags)}
89 {call .branches_ data="all" /}
90 {call .tags_ data="all" /}
91{/if}
92
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020093{call .footer}
94 {param customVariant: $customVariant /}
95{/call}
Dave Borowitz9de65952012-08-13 16:09:45 -070096{/template}
97
98/**
Dave Borowitz209d0aa2012-12-28 14:28:53 -080099 * List of branches.
Dave Borowitz9de65952012-08-13 16:09:45 -0700100 *
Dave Borowitz209d0aa2012-12-28 14:28:53 -0800101 * @param? branches list of branch objects with url and name keys.
102 * @param? moreBranchesUrl URL to show more branches, if necessary.
Dave Borowitz9de65952012-08-13 16:09:45 -0700103 */
Andrew Bonventre869581c2017-06-22 12:40:15 -0700104{template .branches_ visibility="private"}
Dave Borowitz209d0aa2012-12-28 14:28:53 -0800105 {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 Bonventre869581c2017-06-22 12:40:15 -0700122{template .tags_ visibility="private"}
Dave Borowitz209d0aa2012-12-28 14:28:53 -0800123 {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 Borowitz9de65952012-08-13 16:09:45 -0700132{/template}