Blame view

controllets/list-controllet/list-controllet.html 1.39 KB
47c2b7f7   Luigi Serra   added demo page
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
  <link rel="import" href="../../bower_components/polymer/polymer.html">
  <link rel="import" href="../../bower_components/paper-styles/paper-styles.html">
  <link rel="import" href="../../bower_components/paper-toolbar/paper-toolbar.html">
  <link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">
  <link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
  <link rel="import" href="../list-view-controllet/list-view-controllet.html">
  <link rel="import" href="../full-view-controllet/full-view-controllet.html">
  
  <dom-module id="list-controllet">
  
    <style>
  
      :host {
        display: block;
      }
  
      neon-animated-pages {
        height: 100%;
      }
  
    </style>
  
    <template>
  
      <neon-animated-pages id="pages" selected="0">
  
        <list-view-controllet data="[[data]]" on-item-click="_onItemClick"></list-view-controllet>
  
        <full-view-controllet id="view" on-close="_onClose" datalet="{{selected}}"></full-view-controllet>
  
      </neon-animated-pages>
  
    </template>
  
  </dom-module>
  
  
  
  <script>
  
    Polymer({
  
      is: 'list-controllet',
  
      properties: {
  
        data: {
          type: Array,
          value: []
        }
      },
  
      _onItemClick: function(e) {
        this.$.pages.selected = 1;
        this.$.view.$.main.innerHTML = this.data[parseInt(e.detail.item.id)].html;
      },
  
      _onClose: function() {
        this.$.pages.selected = 0;
      }
  
    });
  
  </script>