-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pikesley
committed
Jan 2, 2016
1 parent
b4727b5
commit a96ef06
Showing
7 changed files
with
117 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
//@import 'bootstrap'; | ||
|
||
#numbers { | ||
#data { | ||
text-align: center; | ||
} | ||
|
||
#numbers h1, h2, h3, h4 { | ||
#data h1, h2, h3, h4 { | ||
padding: 0px; | ||
margin: 0px; | ||
} | ||
|
||
#numbers h1 { | ||
#data h1 { | ||
font-size: 1.5em; | ||
} | ||
|
||
#numbers h3 { | ||
#data h3 { | ||
font-size: 1em; | ||
} | ||
|
||
#numbers div { | ||
#data div { | ||
padding: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
function cellContent(id, data) { | ||
fixedDate = moment(data, 'YYYY-MM-DD').format('dddd Do MMMM') | ||
subject = id.replace('-', ' ') | ||
|
||
content = '<p>Last ' + subject + ' was on</p><h2>' + fixedDate + '</h2>' | ||
|
||
return "<div class='col-md-4' id='#" + id + "'>" + content + "</div>" | ||
function githubLink(json) { | ||
return '<a href="' + json['url'] + '">Source</a>' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Dashboard | ||
module Helpers | ||
def repo_map | ||
l = Cleaner.lookups.keys.map { |k| { Cleaner.lookups[k]['url'][1..-1] => Cleaner.lookups[k]['repo'] } } | ||
map = {} | ||
l.each do |m| | ||
m.each_pair do |k, v| | ||
map[k] = v | ||
end | ||
end | ||
|
||
map | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<div class='row' id='data'> | ||
</div> | ||
|
||
<script> | ||
$.getJSON(document.URL, function(json) { | ||
console.log(json['type']) | ||
if (json['type'] === 'latest') { | ||
$('#data').append( | ||
latestCell(json) | ||
) | ||
} | ||
else if (json['type'] === 'graph') { | ||
graph(json) | ||
} | ||
}) | ||
|
||
function graph(json) { | ||
ecks = Object.keys(json['data'][0])[0] | ||
why = Object.keys(json['data'][0])[1] | ||
var points = [ | ||
{ | ||
x: json['data'].map(function(item){ return item[ecks] }), | ||
y: json['data'].map(function(item){ return item[why] }), | ||
type: 'scatter' | ||
} | ||
] | ||
|
||
var layout = { | ||
title: json['title'] + ' (' + githubLink(json) + ')', | ||
xaxis: { | ||
tickformat: "%b %Y", | ||
tickangle: 90 | ||
}, | ||
yaxis: { | ||
title: why, | ||
titlefont: { | ||
size: 14, | ||
color: '#7f7f7f' | ||
} | ||
}, | ||
margin: { | ||
l: 50, r: 10 | ||
} | ||
} | ||
|
||
$('#data').html("<div id='" + json['id'] + "' class='col-md-12' style='height: 400px'></div>") | ||
Plotly.newPlot(json['id'], points, layout) | ||
} | ||
|
||
function latestCell(json) { | ||
d = json['data'][json['data'].length -1][json['date-field']] | ||
fixedDate = moment(d, 'YYYY-MM-DD').format('Do MMMM') | ||
age = moment(d, 'YYYY-MM-DD').fromNow() | ||
content = '<h1><small>Last</small> ' | ||
content += json['title'] + ':</h1>' | ||
if(json['special_fields']) { | ||
content += '<h4>' | ||
|
||
json['special_fields'].forEach(function(field) { | ||
content += json['data'][json['data'].length -1][field] | ||
content += ' ' | ||
}) | ||
|
||
content += '</h4>' | ||
} | ||
content += '<h2>' + fixedDate + '</h2>' | ||
content += '<h3>(' + age + ')</h3>' | ||
content += githubLink(json) | ||
|
||
return cellContent(json['id'], content) | ||
} | ||
|
||
function githubLink(json) { | ||
return '<a href="' + json['url'] + '">Source</a>' | ||
} | ||
|
||
function cellContent(id, content) { | ||
return "<div class='col-md-12' id='#" + id + "'>" + content + "</div>" | ||
} | ||
</script> |