blob: 3d617d7f241fb032c87b95c0335fbfb477444cca [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.
Jakub Vranabd9924f2017-09-29 12:14:48 -070014{namespace gitiles}
Dave Borowitz9de65952012-08-13 16:09:45 -070015
16/**
17 * Index page for a repository.
Dave Borowitz9de65952012-08-13 16:09:45 -070018 */
Gerrit Code Review6cbcb0e2017-09-19 05:10:59 -070019{template .repositoryIndex stricthtml="false"}
Jakub Vranac3962332019-03-04 11:21:52 +010020 {@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 Pearce45e83752015-02-20 17:59:05 -080033{if $readmeHtml}
34 {call .header data="all"}
35 {param title: $repositoryName /}
36 {param repositoryName: null /}
37 {param menuEntries: $menuEntries /}
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020038 {param customVariant: $customVariant /}
Shawn Pearce45e83752015-02-20 17:59:05 -080039 {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 Pedersenbc0eaaa2016-03-29 15:30:29 +020047 {param customVariant: $customVariant /}
Shawn Pearce45e83752015-02-20 17:59:05 -080048 {param breadcrumbs: $breadcrumbs /}
49 {/call}
50{/if}
Dave Borowitz9de65952012-08-13 16:09:45 -070051
Andrew Bonventreb33426e2015-09-09 18:28:28 -040052{if $description}
53 <h2 class="RepoDescription">{$description}</h2>
54{/if}
55
56{if $mirroredFromUrl}
57 <div class="RepoMirroredFrom">
Shawn Pearce49b519b2012-12-21 21:15:45 -080058 {msg desc="Informational text describing source of repository"}
Andrew Bonventreb33426e2015-09-09 18:28:28 -040059 Mirrored from <a href="{$mirroredFromUrl}">{$mirroredFromUrl}</a>
Shawn Pearce49b519b2012-12-21 21:15:45 -080060 {/msg}
Shawn Pearce49b519b2012-12-21 21:15:45 -080061 </div>
Dave Borowitz9de65952012-08-13 16:09:45 -070062{/if}
63
Andrew Bonventreb33426e2015-09-09 18:28:28 -040064<div class="CloneRepo">
65 <div class="CloneRepo-title">Clone this repo:</div>
Andrew Bonventre0ffb2822015-09-16 15:28:02 -040066 <input type="text" class="u-monospace CloneRepo-command"
Jonathan Nieder332f4982016-04-07 10:20:55 -070067 onclick="this.focus();if(this.selectionStart==this.selectionEnd){lb}this.select(){rb}"
Andrew Bonventreb33426e2015-09-09 18:28:28 -040068 readonly="readonly" value="git clone {$cloneUrl}">
69</div>
Dave Borowitz9de65952012-08-13 16:09:45 -070070
Dave Borowitzf6dcf7a2014-07-30 10:26:58 -070071{if $hasLog and (length($branches) or length($tags))}
Andrew Bonventreb33426e2015-09-09 18:28:28 -040072 <div class="RepoShortlog">
73 <div class="RepoShortlog-refs">
74 {call .branches_ data="all" /}
75 {call .tags_ data="all" /}
Dave Borowitz9de65952012-08-13 16:09:45 -070076 </div>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040077 <div class="RepoShortlog-log">
78 {call .streamingPlaceholder /}
79 {if $readmeHtml}
80 <div class="doc RepoIndexDoc">{$readmeHtml}</div>
81 {/if}
82 </div>
Dave Borowitz209d0aa2012-12-28 14:28:53 -080083 </div>
Dave Borowitz9de65952012-08-13 16:09:45 -070084
Dave Borowitzf6dcf7a2014-07-30 10:26:58 -070085{elseif $hasLog}
86 {call .streamingPlaceholder /}
Dave Borowitz209d0aa2012-12-28 14:28:53 -080087{elseif length($branches) or length($tags)}
88 {call .branches_ data="all" /}
89 {call .tags_ data="all" /}
Chuck Pierce03290c72018-05-11 16:33:19 -070090{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 Borowitz209d0aa2012-12-28 14:28:53 -080093{/if}
94
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020095{call .footer}
96 {param customVariant: $customVariant /}
97{/call}
Dave Borowitz9de65952012-08-13 16:09:45 -070098{/template}
99
100/**
Dave Borowitz209d0aa2012-12-28 14:28:53 -0800101 * List of branches.
Dave Borowitz9de65952012-08-13 16:09:45 -0700102 */
Andrew Bonventre869581c2017-06-22 12:40:15 -0700103{template .branches_ visibility="private"}
Jakub Vranac3962332019-03-04 11:21:52 +0100104 {@param? branches: ?} /** list of branch objects with url and name keys. */
105 {@param? moreBranchesUrl: ?} /** URL to show more branches, if necessary. */
Dave Borowitz209d0aa2012-12-28 14:28:53 -0800106 {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 Borowitz209d0aa2012-12-28 14:28:53 -0800119 */
Andrew Bonventre869581c2017-06-22 12:40:15 -0700120{template .tags_ visibility="private"}
Jakub Vranac3962332019-03-04 11:21:52 +0100121 {@param? tags: ?} /** list of branch objects with url and name keys. */
122 {@param? moreTagsUrl: ?} /** URL to show more tags, if necessary. */
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}