forked from nav-e/nav-e.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-wiki-folders.html
More file actions
62 lines (46 loc) · 1.46 KB
/
github-wiki-folders.html
File metadata and controls
62 lines (46 loc) · 1.46 KB
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
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="bower_components/iron-collapse/iron-collapse.html">
<link rel="import" href="bower_components/paper-menu/paper-menu.html">
<link rel="import" href="bower_components/paper-menu/paper-submenu.html">
<link rel="import" href="github-markdown-files.html">
<dom-module id="github-wiki-folders">
<template>
<iron-ajax
auto
url="https://api.github.com/repos/Greennav/greennav.github.io/contents/wiki"
handle-as="json"
on-response="handleResponse"
debounce-duration="300"></iron-ajax>
<template is="dom-repeat" items="{{ folders }}">
<github-markdown-files files="{{ item.files }}" url="[[ item.url ]]"></github-markdown-files>
</template>
</template>
</dom-module>
<script>
Polymer({
is: 'github-wiki-folders',
properties: {
folders: {
type: Array,
notify: true,
files: {
type: Array,
notify: true
}
}
},
handleResponse: function(request) {
this.set('folders', []);
for (var i = 0; i < request.detail.response.length; i++) {
var file = request.detail.response[i]
if (file.type==="dir") {
this.unshift('folders', {
name: file.name,
url: file.url
});
}
};
}
});
</script>