1. add `@extends` for all polymer elements 2. add `@override` for all lifecycle methods 3. fix a wrong type in gr-auth Change-Id: Id9dea76b169197084d2e0b5f267459cdc4aaec3e
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<dom-module id="some-screen">
 | 
						|
  <script>
 | 
						|
    Gerrit.install(plugin => {
 | 
						|
      // Recommended approach for screen() API.
 | 
						|
      plugin.screen('main', 'some-screen-main');
 | 
						|
 | 
						|
      const mainUrl = plugin.screenUrl('main');
 | 
						|
 | 
						|
      // Support for deprecated screen API.
 | 
						|
      plugin.deprecated.screen('foo', ({token, body, show}) => {
 | 
						|
        body.innerHTML = `This is a plugin screen at ${token}<br/>` +
 | 
						|
            `<a href="${mainUrl}">Go to main plugin screen</a>`;
 | 
						|
        show();
 | 
						|
      });
 | 
						|
 | 
						|
      // Quick and dirty way to get something on screen.
 | 
						|
      plugin.screen('bar').onAttached(el => {
 | 
						|
        el.innerHTML = `This is a plugin screen at ${el.token}<br/>` +
 | 
						|
            `<a href="${mainUrl}">Go to main plugin screen</a>`;
 | 
						|
      });
 | 
						|
 | 
						|
      // Add a "Plugin screen" link to the change view screen.
 | 
						|
      plugin.hook('change-metadata-item').onAttached(el => {
 | 
						|
        el.innerHTML = `<a href="${mainUrl}">Plugin screen</a>`;
 | 
						|
      });
 | 
						|
    });
 | 
						|
  </script>
 | 
						|
</dom-module>
 | 
						|
 | 
						|
<dom-module id="some-screen-main">
 | 
						|
  <template>
 | 
						|
    This is the <b>main</b> plugin screen at [[token]]
 | 
						|
    <ul>
 | 
						|
      <li><a href$="[[rootUrl]]/foo">via deprecated</a></li>
 | 
						|
      <li><a href$="[[rootUrl]]/bar">without component</a></li>
 | 
						|
    </ul>
 | 
						|
  </template>
 | 
						|
  <script>
 | 
						|
    Polymer({
 | 
						|
      is: 'some-screen-main',
 | 
						|
 | 
						|
      properties: {
 | 
						|
        rootUrl: String,
 | 
						|
      },
 | 
						|
      /** @override */
 | 
						|
      attached() {
 | 
						|
        this.rootUrl = `${this.plugin.screenUrl()}`;
 | 
						|
      },
 | 
						|
    });
 | 
						|
  </script>
 | 
						|
</dom-module>
 |