blob: f069055489c7ed97f92602471b48cdf64e8f1599 [file] [log] [blame]
// Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{namespace com.google.gitiles.templates.RepositoryIndex}
import * as common from 'com/google/gitiles/templates/Common.soy';
import * as refList from 'com/google/gitiles/templates/RefList.soy';
/**
* Index page for a repository.
*/
{template repositoryIndex stricthtml="false"}
{@param repositoryName: ?} /** name of this repository. */
{@param? menuEntries: ?} /** menu entries. */
{@param? customVariant: ?} /** variant name for custom styling. */
{@param breadcrumbs: ?} /** breadcrumbs for this page. */
{@param cloneUrl: ?} /** clone URL for this repository. */
{@param description: ?} /** description text of the repository. */
{@param? mirroredFromUrl: ?} /** URL this repository is mirrored from. */
{@param branches: ?} /** list of branch objects with url, name, and isHead keys. */
{@param? moreBranchesUrl: ?} /** URL to show more branches, if necessary. */
{@param tags: ?} /** list of tag objects with url and name keys. */
{@param? moreTagsUrl: ?} /** URL to show more branches, if necessary. */
{@param hasLog: ?} /** whether a log should be shown for HEAD. */
{@param? readmeHtml: ?} /** optional rendered README.md contents. */
{@inject staticUrls: ?}
{if $readmeHtml}
{call common.header data="all"}
{param title: $repositoryName /}
{param repositoryName: null /}
{param menuEntries: $menuEntries /}
{param customVariant: $customVariant /}
{param breadcrumbs: $breadcrumbs /}
{param css: [$staticUrls['DOC_CSS_URL']] /}
{/call}
{else}
{call common.header}
{param title: $repositoryName /}
{param repositoryName: null /}
{param menuEntries: $menuEntries /}
{param customVariant: $customVariant /}
{param breadcrumbs: $breadcrumbs /}
{/call}
{/if}
{if $description}
<h2 class="RepoDescription">{$description}</h2>
{/if}
{if $mirroredFromUrl}
<div class="RepoMirroredFrom">
{msg desc="Informational text describing source of repository"}
Mirrored from <a href="{$mirroredFromUrl}">{$mirroredFromUrl}</a>
{/msg}
</div>
{/if}
<div class="CloneRepo">
<div class="CloneRepo-title">Clone this repo:</div>
<input id="clone-repo-input" type="text" class="u-monospace CloneRepo-command"
readonly="readonly" value="git clone {$cloneUrl}">
</div>
{if $hasLog && (length($branches) || length($tags))}
<div class="RepoShortlog">
<div class="RepoShortlog-refs">
{call branches_ data="all" /}
{call tags_ data="all" /}
</div>
<div class="RepoShortlog-log">
{call common.streamingPlaceholder /}
{if $readmeHtml}
<div class="doc RepoIndexDoc">{$readmeHtml}</div>
{/if}
</div>
</div>
{elseif $hasLog}
{call common.streamingPlaceholder /}
{elseif length($branches) || length($tags)}
{call branches_ data="all" /}
{call tags_ data="all" /}
{else}
<h1 class="EmptyRepo-header">Empty Repository</h1>
<p class="EmptyRepo-description">This repository is empty. Push to it to show branches and history.</p>
{/if}
{call common.footer}
{param customVariant: $customVariant /}
{/call}
<script>
{lb}
let f = document.getElementById("clone-repo-input");
f.onclick = () => {lb}
f.focus();
if (f.selectionStart === f.selectionEnd) {lb}
f.select();
{rb}
{rb};
{rb}
</script>
{/template}
/**
* List of branches.
*/
{template branches_ visibility="private"}
{@param? branches: ?} /** list of branch objects with url and name keys. */
{@param? moreBranchesUrl: ?} /** URL to show more branches, if necessary. */
{if length($branches)}
{call refList.refList}
{param type: 'Branches' /}
{param refs: $branches /}
{param variant: 'responsive' /}
{/call}
{if $moreBranchesUrl}
<a href="{$moreBranchesUrl}">{msg desc="link to view more branches"}More...{/msg}</a>
{/if}
{/if}
{/template}
/**
* List of tags.
*/
{template tags_ visibility="private"}
{@param? tags: ?} /** list of branch objects with url and name keys. */
{@param? moreTagsUrl: ?} /** URL to show more tags, if necessary. */
{if length($tags)}
{call refList.refList}
{param type: 'Tags' /}
{param refs: $tags /}
{param variant: 'responsive' /}
{/call}
{if $moreTagsUrl}
<a href="{$moreTagsUrl}">{msg desc="link to view more tags"}More...{/msg}</a>
{/if}
{/if}
{/template}