Repository navigation
Expand file tree
/
Copy pathprojects.html
More file actions
251 lines (215 loc) · 9.37 KB
/
Copy pathprojects.html
File metadata and controls
251 lines (215 loc) · 9.37 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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Projects - Open Gov Hack Night</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/custom.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class='col-md-10 col-md-offset-1'>
<div class="header">
<ul class="nav nav-pills pull-right">
<li><a href="index.html">Home</a></li>
<li><a href="events.html">Events</a></li>
<li class="active"><a href="projects.html">Projects</a></li>
<li><a href="people.html">People</a></li>
</ul>
<h3 class="text-muted"><a href="index.html" >Open Gov Hack Night</a></h3>
</div>
<!-- Begin page content-->
<h1>Projects <small id='project-count'></small></h1>
<p>Open source civic tech projects from Chicago's open gov community. Most were built using <a href="http://data.cityofchicago.org">open data</a>.</p>
<h4><a id='share-toggle' href='#'>Share your civic tech project »</a></h4>
<div id='share-project' style='display:none;'>
<div class='well'>
<p>Add a project for us to track. We <a href='https://github.com/open-city/civic-json-worker'>automatically update</a> this list based on your <a href='https://github.com/'>Github</a> activity.</p>
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="github-url" class="col-lg-2 control-label">Github URL</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="github-url" placeholder="https://github.com/my-name/my-project">
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button id='submit-project' type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
<div id='submit-message' class="alert" style="display: none;"></div>
</div>
<hr />
<table id='hack-night-projects' class='table'>
<thead>
<tr>
<th>Project</th>
<th>Description</th>
<th>Stars</th>
<th>Forks</th>
<th>Issues</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<!-- End page content-->
<div class="footer">
<p class='pull-right'>© Open City 2013 | <a href='https://github.com/open-city/open-gov-hack-night'><i class='icon-github'></i> Pull requests welcome!</a></p>
</div>
</div>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/analytics_lib.js"></script>
<script src="js/moment.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/jquery.dataTables.sorting.js"></script>
<script src="js/jquery.address.js"></script>
<script src="js/mustache.js"></script>
<script src="js/spin.min.js"></script>
<script src="js/jquery.spin.js"></script>
<script>
// Set this up like this to make it easier to dev this locally -- evz
var data_host = 'http://civic-json.e-vz.com'
// var data_host = 'http://civic-json.datamade.dev.work'
// helper function for displaying messages when submitting projects
function displayMessage(message, type) {
$( "#submit-message" ).fadeOut(function() {
$( "#submit-message" ).attr('class', 'alert alert-' + type);
$( "#submit-message" ).html(message);
});
$( "#submit-message" ).fadeIn();
}
$('#share-toggle').click(function(){
$('#share-project').slideToggle();
return false;
});
// AJAX form submission to civic-json-worker
// https://github.com/open-city/civic-json-worker
$('#submit-project').click(function(){
$.post(
data_host + '/add-project/',
data={'project_url': $('#github-url').val()},
function(resp){
displayMessage( "<strong>Your project has been submitted!</strong> It should display below within 5 minutes.", 'success' );
$("#github-url").val("");
}
).fail(function() {
displayMessage( "<strong>Error submitting your project!</strong> Check that the URL is correct.", 'danger' );
});
return false;
});
// handle the case where someone hits the 'enter' key insted of the submit button
$("#github-url").keydown(function(e){
var key = e.keyCode ? e.keyCode : e.which;
if(key == 13) {
$('#submit-project').click();
return false;
}
});
var projects_table;
// this is a template used for mustache.js. Each one represents a table row.
var template = "\
<tr>\
<td>\
<h3><a href='{{html_url}}'>{{name}}</a></h3>\
{{#homepage}}\
<a href='{{homepage_formatted}}'>Website</a>\
{{/homepage}}\
<br /><strong>Created</strong>\
{{created_at_formatted}}\
{{#language}}\
<br /><strong>Language</strong>\
{{language}}\
{{/language}}\
</td>\
<td>\
<p>{{description}}</p>\
<h4>Contributors</h4>\
<p class='contributors'>\
{{#owner}}\
<a href='{{html_url}}' class='contributor-owner'><img class='img-thumbnail' src='{{avatar_url}}' alt='Owner: {{login}}'/></a>\
{{/owner}}\
{{#contributors}}\
{{^owner}}\
<a href='{{html_url}}'><img class='img-thumbnail' src='{{avatar_url}}' alt='{{login}}' /></a>\
{{/owner}}\
{{/contributors}}\
</p>\
</td>\
<td>\
<a class='btn btn-default' href='{{html_url}}/stargazers'>{{watchers_count}} <i class='icon-star'></i></a>\
</td>\
<td>\
<a class='btn btn-default' href='{{html_url}}/network'>{{forks_count}} <i class='icon-code-fork'></i></a>\
</td>\
<td>\
<a class='btn btn-default' href='{{html_url}}/issues'>{{open_issues}} <i class='icon-exclamation-sign'></i></a>\
</td>\
</tr>\
";
$('#hack-night-projects tbody').spin({top: '40px'}); //show a spinner while loading data
$.when( $.getJSON( data_host + "/data/project_details.json" ) ).then(function( data, textStatus, jqXHR ) {
// update project count at the top of the page
$('#project-count').html(data.length);
// loop through our json data
$.each(data, function(i, json){
// to display text like 'x days ago' we use moment.js's awesome fromNow function
// http://momentjs.com/docs/#/displaying/fromnow/
json['created_at_formatted'] = moment(json['created_at']).fromNow();
json['updated_at_formatted'] = moment(json['updated_at']).fromNow();
// check to make sure all our URL's have http:// in front of them
// otherwise they won't link properly
var prefix_regex = /^https?:\/\/.*/;
var homepage = json['homepage'];
if (homepage != null && !prefix_regex.test(homepage))
json['homepage_formatted'] = "http://" + homepage;
else
json['homepage_formatted'] = homepage;
// using the template above, add the project as a new row to our table
$("#hack-night-projects tbody").append(Mustache.render(template, json));
})
// initialize datatables for sorting and searching
// http://datatables.net/
projects_table = $('#hack-night-projects').dataTable( {
"aaSorting": [ [2,'desc'], [3, 'desc'] ],
"aoColumns": [
null,
null,
{ "sType": "num-html" },
{ "sType": "num-html" },
{ "sType": "num-html" }
],
"bInfo": false,
"bPaginate": false
} );
// allows linking directly to searches
if ($.address.parameter('search') != undefined) {
projects_table.fnFilter( $.address.parameter('search') );
// $('#project-count').html(projects_table.fnSettings().fnRecordsDisplay());
}
// when someone types a search value, it updates the URL
$('#hack-night-projects_filter input').keyup(function(e){
$.address.parameter('search', $('#hack-night-projects_filter input').val());
});
});
</script>
</body>
</html>