Add polygerrit plugin example showing how to add section of metadata to change view panel
Add a polygerrit plugin example that uses "change-metadata-item"
extension point to add section of metadata to the change view left
panel.
Change-Id: I5d7bada4d44afa22f072a50b8f317aa794eca18c
diff --git a/example-polyChangeMetadataItem/README.md b/example-polyChangeMetadataItem/README.md
new file mode 100644
index 0000000..7ebe9c4
--- /dev/null
+++ b/example-polyChangeMetadataItem/README.md
@@ -0,0 +1,13 @@
+# PolyGerrit Add section of metadata to change view left panel
+
+Adds section of metadata to change view left panel using change-metadata-item
+extension point, which is located on the bottom of the change view left panel.
+
+
+
+## How to install
+
+There is nothing to build, just copy the gerrit-change-metadataItem.html into
+the Gerrit's /plugins directory. There is no need to restart anything,
+once the file gets copied, Gerrit will detect the new PolyGerrit plugin after
+a few moments and will use it transparently.
diff --git a/example-polyChangeMetadataItem/change-metadata-item-example.html b/example-polyChangeMetadataItem/change-metadata-item-example.html
new file mode 100644
index 0000000..cb72a40
--- /dev/null
+++ b/example-polyChangeMetadataItem/change-metadata-item-example.html
@@ -0,0 +1,29 @@
+<dom-module id='example'>
+ <!--
+ Copyright (C) 2021 The Android Open Source Project
+
+ 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.
+ -->
+ <script>
+ 'use strict';
+ Gerrit.install(plugin => {
+ const endpoint = 'change-metadata-item';
+ plugin.hook(endpoint).onAttached(element => {
+ const el = element.appendChild(document.createElement('div'));
+ el.textContent = 'Ah, there it is. Lovely.';
+ el.style = 'background: pink; line-height: 4em; text-align: center;';
+ });
+ });
+ </script>
+</dom-module>
+