Blame view

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