Add an extension point for Source Browser link

A plugin or a site theme (gerrit-theme.html) may register a custom
Element to be inserted into this endpoint.

``` js
Gerrit.install(plugin => {
  plugin.registerCustomComponent(
      'header-browse-source', 'gt-header-source', {replace: true});
});
```

``` html
<dom-module id="gt-header-source">
  <template>
    <a href="http://somecode.com/">Repositories</a>
  </template>
  <script>
    Polymer({is: 'gt-header-source'});
  </script>
</dom-module>
````

Feature: Issue 7120
Change-Id: Ib4b133de755c16ae32e464e7c4352310f29ef5b0
This commit is contained in:
Viktar Donich
2017-09-05 15:37:45 -07:00
parent ebf009cc5c
commit f3407cfb98
2 changed files with 8 additions and 1 deletions

View File

@@ -78,6 +78,9 @@ limitations under the License.
flex: 1;
justify-content: flex-end;
}
.rightItems gr-endpoint-decorator:not(:empty) {
margin-left: 1em;
}
gr-search-bar {
flex-grow: 1;
margin-left: .5em;
@@ -121,6 +124,7 @@ limitations under the License.
}
gr-search-bar,
.browse,
.rightItems .hideOnMobile,
.links > li.hideOnMobile {
display: none;
}
@@ -159,6 +163,9 @@ limitations under the License.
</ul>
<div class="rightItems">
<gr-search-bar value="{{searchQuery}}" role="search"></gr-search-bar>
<gr-endpoint-decorator
class="hideOnMobile"
name="header-browse-source"></gr-endpoint-decorator>
<div class="accountContainer" id="accountContainer">
<a class="loginButton" href$="[[_loginURL]]">Sign in</a>
<gr-account-dropdown account="[[_account]]"></gr-account-dropdown>

View File

@@ -18,7 +18,7 @@ limitations under the License.
<link rel="import" href="../../shared/gr-js-api-interface/gr-js-api-interface.html">
<dom-module id="gr-endpoint-decorator">
<template>
<template strip-whitespace>
<content></content>
</template>
<script src="gr-endpoint-decorator.js"></script>