| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <!-- Copyright (c) 2014 Google Inc. All rights reserved. --> |
| 3 <html> |
| 4 <head> |
| 5 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1.0, user-scalable=yes"> |
| 6 <title>google-sheets Demo</title> |
| 7 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 8 <link rel="import" href="../../iron-flex-layout/classes/iron-flex-layout.html"
> |
| 9 <link rel="import" href="../google-sheets.html"> |
| 10 <link rel="import" href="../../google-map/google-map.html"> |
| 11 <style> |
| 12 * { |
| 13 box-sizing: border-box; |
| 14 } |
| 15 body { |
| 16 margin: 2em; |
| 17 font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial; |
| 18 font-weight: 300; |
| 19 background-color: #f1f1f3; |
| 20 } |
| 21 a { |
| 22 text-decoration: none; |
| 23 color: blue; |
| 24 } |
| 25 ul { |
| 26 padding-left: 0; |
| 27 } |
| 28 ul, li { |
| 29 list-style: none; |
| 30 font-size: 14px; |
| 31 } |
| 32 section { |
| 33 border-radius: 3px; |
| 34 box-shadow: 1px 1px 3px #ccc; |
| 35 padding: 1em 2em; |
| 36 background-color: white; |
| 37 width: 500px; |
| 38 height: 500px; |
| 39 } |
| 40 google-map { |
| 41 display: block; |
| 42 height: 100%; |
| 43 width: 100%; |
| 44 } |
| 45 main { |
| 46 justify-content: space-around; |
| 47 margin-top: 2em; |
| 48 } |
| 49 </style> |
| 50 </head> |
| 51 <body> |
| 52 |
| 53 <p>A <code><google-sheets></code> element returns data from a Google Spreadsh
eet:</p> |
| 54 |
| 55 <main class="layout horizontal"> |
| 56 |
| 57 <template id="container" is="dom-bind"> |
| 58 |
| 59 <section> |
| 60 |
| 61 <!-- Example: published spreadsheet --> |
| 62 <google-sheets id="sheet" key="0Anye-JMjUkZZdDBkMVluMEhZMmFGeHpYdDJJV1FBRW
c" tab-id="1" |
| 63 published rows="{{rows}}" tab="{{tab}}" open-in-google-docs
-url="{{openInGoogleDocsUrl}}"></google-sheets> |
| 64 |
| 65 <heading> |
| 66 <h3>Spreadsheet rows: |
| 67 <a href="{{openInGoogleDocsUrl}}" target="_blank" title="Open in Googl
e Docs →"> |
| 68 "<span>{{tab.title}}</span>" tab |
| 69 </a> |
| 70 </h3> |
| 71 <h5>updated: <span>{{tab.updated}}</span>, by: <template is="dom-repeat"
items="{{rows.authors}}">{{item.name}}</template></h5> |
| 72 </heading> |
| 73 <ul> |
| 74 <template is="dom-repeat" items="[[rows]]"> |
| 75 <li>Name: <span>{{item.gsx$name.$t}}</span> ( lat: <span>{{item.gsx$la
t.$t}}</span>, lng: <span>{{item.gsx$lng.$t}}</span> )</li> |
| 76 </template> |
| 77 </ul> |
| 78 |
| 79 </section> |
| 80 |
| 81 <section style="padding: 0;"> |
| 82 |
| 83 <google-map disable-default-ui fit-to-markers> |
| 84 <template is="dom-repeat" items="[[rows]]"> |
| 85 <google-map-marker latitude="{{item.gsx$lat.$t}}" longitude="{{item.gsx$
lng.$t}}"></google-map-marker> |
| 86 </template> |
| 87 </google-map> |
| 88 |
| 89 <button on-click="useTab" data-tabid="1">View tab 1 data</button> |
| 90 <button on-click="useTab" data-tabid="2">View tab 2 data</button> |
| 91 |
| 92 </section> |
| 93 |
| 94 </template> |
| 95 </main> |
| 96 |
| 97 <script> |
| 98 var template = document.querySelector('#container'); |
| 99 |
| 100 template.useTab = function(e, detail, sender) { |
| 101 document.querySelector('#sheet').tabId = Number(e.currentTarget.dataset.tabid)
; |
| 102 }; |
| 103 </script> |
| 104 </body> |
| 105 </html> |
| OLD | NEW |