-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
145 lines (122 loc) · 5.43 KB
/
index.html
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>GitHub Issue Widget</title>
<meta name="description" content="A simple widget to fetch and display github issues inline in static websites.">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/gh-issues.css">
</head>
<body>
<!-- Prompt IE 6 users to install Chrome Frame. -->
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
<div role="main" class="container">
<header>
<h1>GitHub Issues Widget</h1>
<p class="desc">
A bit of <a href="http://developer.github.com/v3/issues/">GitHub API v3</a>,
<a href="https://github.com/isaacs/github-flavored-markdown">GitHub Flavored Markdown</a>,
a soupcon of <code>data-*</code> attributes and you get
<em>github issue powered blog comments</em>.
</p>
<!--
<p>Use jQuery or Prototype for non
<a href="http://caniuse.com/#search=querySelectorAll"><code>document.querySelectorAll</code>-able
browsers</a>.</p>
-->
</header>
<section class="body"></section>
<section class="readme">
<!--
<h2>What</h2>
<h2>Why</h2>
<h2>How</h2>
<h2>Who</h2>
<h2>Todo</h2>
<p>Still requires jquery and underscore as hard dependency</p>
<p>
<pre><code>
// required:
//
// $(el), $.getJSON ( jsonp ), $.fn.html, $.data, $.ready
// _.template, _.extend, _.bind
</code></pre>
</p>
-->
<p>As simple as it could be.</p>
<pre><code><div data-repo="mklabs/gh-issues-widget" data-id="hello" data-template="#tmpl-issues"></div>
</code></pre>
<p>
The only required option is <code>data-repo</code>.
</p>
<ul>
<li><strong>data-repo</strong>: in the form of <code>username/repository</code><li>
<li><strong>data-id</strong>: used to filter related issue. If not provided, the widget will do a best-guest based on <code>location.pathname</code>.<li>
<li><strong>data-template</strong>: selector of inline template to use and overidde the default one.<li>
</ul>
<form>
<p>
<input type="text" name="repo" placeholder="user/repo" />
<input type="text" name="identifier" placeholder="title filter" />
<input type="submit" value="refresh" />
</p>
</form>
<div data-repo="mklabs/gh-issues-widget" data-id="." data-template="#tmpl-issues"></div>
<script type="text/template" id="tmpl-issues">
<p class="comment-count"><%= num %></p>
<div class="gh-thread gh">
<% _.each(issues, function(issue) { %>
<div class="avatar-bubble starting-thread">
<span class="avatar">
<img src="<%= issue.issue.user.avatar_url %>" />
</span>
<div class="bubble">
<div class="body">
<p class="author"><a href="https://github.com/<%= issue.issue.user.login %>">@<%= issue.issue.user.login %></a>
started this thread <span class="date"><%= issue.issue.created_at %></span></p>
<h2 class="content-title"><%= issue.issue.title %></h2>
<div class="content-body markdown-body markdown-format">
<%= ghm(issue.issue.body, repo) %>
</div>
</div>
</div>
</div>
<% _.each(issue.comments.data, function(comment) { %>
<div class="avatar-bubble">
<span class="avatar">
<img src="<%= comment.user.avatar_url %>" />
</span>
<div class="body">
<p class="author">
<a href="https://github.com/<%= comment.user.login %>">@<%= comment.user.login %></a>
<a href="<%= issue.issue.html_url %>#issuecomment-<%= comment.id %>">commented</a>
</p>
<p class="info">
<em class="date">
<a href="<%= issue.issue.html_url %>#issuecomment-<%= comment.id %>"><%= comment.created_at %></a>
</em>
</p>
<div class="content-body markdown-body markdown-format">
<%= ghm(comment.body, repo) %>
</div>
</div>
</div>
<% }); %>
<% }); %>
</div>
</script>
</section>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>
<script src="js/libs/underscore-min.js"></script>
<script src="js/libs/github-flavored-markdown.js"></script>
<script src="js/gh-issues.js"></script>
<script src="js/demo.js"></script>
</body>
</html>