| <html> |
| <head> |
| <title>gold-status-sk demo</title> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> |
| <script src="../../node_modules/native-promise-only/npo.js"></script> |
| <script src="../common/js/common.js"></script> |
| <script src="../js/gold.js"></script> |
| <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script> |
| <script src="bower_components/sinonjs/sinon.js"></script> |
| <link rel="import" href="bower_components/polymer/polymer.html"> |
| |
| <script> |
| var server = sinon.fakeServer.create(); |
| server.respondImmediately = true; |
| var RESPONSE = { |
| corpStatus: [ |
| {name: "svg", untriagedCount: 47, negativeCount:949 }, |
| {name: "colorImage", untriagedCount: 17, negativeCount:449 }, |
| {name: "gm", untriagedCount: 27, negativeCount:649 }, |
| {name: "image", untriagedCount: 61, negativeCount:9 } |
| ], |
| lastCommit: { |
| hash: "136baaa927877e0f7fcc97acb456ee0d63f7f343", |
| author: "username", |
| } |
| }; |
| server.respondWith("GET", "/json/trstatus", function(request) { |
| request.respond(200, {"Content-Type":"application/json"}, |
| JSON.stringify(RESPONSE)); |
| }); |
| </script> |
| <link rel="import" href="gold-status-sk.html"> |
| </head> |
| <body> |
| <h1>gold-status-sk demo</h1> |
| |
| <dom-module id="main-document-element"> |
| <template> |
| <div style="background-color: #D95F02; height:48px;"> |
| <gold-status-sk id="status" corpus="{{_corpus}}"></gold-status-sk> |
| </div> |
| <div style="clear:both;"> |
| <br> |
| <br> |
| Selected: "{{_corpus}}" |
| <br> |
| <br> |
| Event Data: "{{_eventData}}" |
| </div> |
| |
| </template> |
| |
| <script> |
| HTMLImports.whenReady(function () { |
| Polymer({ |
| is: 'main-document-element', |
| |
| properties: { |
| _eventData: { |
| type: Array |
| } |
| }, |
| |
| ready: function() { |
| this.listen(this.$.status, 'corpus-change', '_handleCorpusChanged'); |
| |
| var setCorpus = function() { |
| if (this.$.status.corpus == "gm") { |
| this.$.status.corpus = "colorImage"; |
| } else { |
| this.$.status.corpus = "gm"; |
| } |
| this.async(setCorpus, 3000); |
| }; |
| this.async(setCorpus, 3000); |
| }, |
| |
| _handleCorpusChanged: function(ev) { |
| console.log(new Date() + ": Event fired : " + ev.detail) |
| this.set("_eventData", ev.detail.slice(0)); |
| } |
| }); |
| }); |
| |
| </script> |
| </dom-module> |
| |
| <!-- Instantite the element defined above --> |
| <main-document-element></main-document-element> |
| |
| </body> |
| </html> |