Blame view

bower_components/polymer-element-catalog/app/elements/catalog-guide/catalog-guide.html 973 Bytes
07d13c9c   isisadmin   polymer catalog
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
  <link rel="import" href="../catalog-data/catalog-data.html">
  
  <dom-module id="catalog-guide">
    <template>
      <catalog-data guide-map="{{_guides}}"></catalog-data>
      <iron-ajax id="req" auto url="[[src]]" method="get" handle-as="text" last-response="{{content}}" on-error="_didReceiveError"></iron-ajax>
    </template>
  </dom-module>
  <script>
    Polymer({
      is: 'catalog-guide',
      properties: {
        name: {type: String, notify: true},
        _guides: {type: Object, notify: true},
  
        data: {type: Object, notify: true, computed: 'getData(_guides,name)'},
        src: {type: String, notify: true, computed: 'getSrc(name)'},
        content: {type: String, notify: true}
      },
      getData: function(_guides,name) {
        if (!_guides) return;
        return _guides[name];
      },
      getSrc: function(name) {
        return "/data/guides/" + name + ".html";
      },
      _didReceiveError: function(e) {
        this.fire('catalog-guide-error', e.detail);
      }
    });
  </script>