Blame view

bower_components/polymer-element-catalog/app/elements/pages/page-packages.html 2.47 KB
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
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
  <link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
  <link rel="import" href="../../bower_components/iron-icons/maps-icons.html">
  <link rel="import" href="../../bower_components/paper-material/paper-material.html">
  
  <link rel="import" href="../catalog-data/catalog-data.html">
  <link rel="import" href="../package-tile/package-tile.html">
  <link rel="import" href="../guide-card/guide-card.html">
  <link rel="import" href="../cart-icon/cart-icon.html">
  
  <dom-module id="page-packages">
    <link rel="import" type="css" href="page-packages.css">
    <template>
      <catalog-data packages="{{packages}}" guides="{{guides}}"></catalog-data>
      <paper-header-panel mode="seamed" class="fit">
        <paper-toolbar class="paper-header">
          <app-logo full class="flex"></app-logo>
          <app-bar class="horizontal layout center end-justified" query="{{q}}"></app-bar>
          <cart-icon></cart-icon>
        </paper-toolbar>
  
        <div class="content fit">
          <div class="packages layout horizontal wrap">
            <template is="dom-repeat" items="[[packages]]">
              <a href$="[[_packageLink(item.name)]]" is="app-link" class="package flex-none"><package-tile name$="[[item.name]]"></package-tile></a>
            </template>
          </div>
  
          <div id="guides-container">
            <h3>Element Guides</h3>
            <div id="guide-list" class="horizontal layout wrap">
              <template is="dom-repeat" items="[[guides]]">
                <a href$="[[_link('guides',item.name)]]" is="app-link"><guide-card guide="[[item.name]]"></guide-card></a>
              </template>
              <div id="coming-soon">More guides coming soon, stay tuned!</div>  
            </div>
          </div>
        </div>
      </paper-header-panel>
    </template>
  </dom-module>
  
  <script>
    Polymer({
      is: 'page-packages',
      enableCustomStyleProperties: true,
      properties: {
        q: { type: String, notify: true }
      },
      attached: function() {
        // reset page title since this is the default page
        this.fire('page-meta', {title: null});
      },
      observers: [
        'search(q)'
      ],
      search: function(q) {
        if (q || this.q) {
          this.router.go('/browse?q=' + (q || this.q));
        }
      },
      _link: function() {
        return "/" + Array.prototype.slice.call(arguments).join("/");
      },
      _packageLink: function(name) {
        return "/browse?package=" + name;
      },
      guideSelect: function(e) {
        this.router.go('/guides/' + e.currentTarget.guide);
      }
    });
  </script>