Skip to content

Commit

Permalink
displaying check results in individual tabs on the webapp
Browse files Browse the repository at this point in the history
(issue fonttools#1121 and issue fonttools#1129)
  • Loading branch information
felipesanches committed Oct 27, 2016
1 parent 6a84d88 commit 56e1a79
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions fontbakery-check-ttf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,8 @@ def installed_version_is_newer(installed, used):
if ttfautohint_missing:
fb.skip("This check requires ttfautohint"
" to be available in the system.")
elif webapp is True:
fb.skip("This check is not supported on Google App Engine.")
else:
version_strings = get_name_string(font, NAMEID_VERSION_STRING)
ttfa_version = ttfautohint_version(version_strings)
Expand Down
8 changes: 6 additions & 2 deletions webapp/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ def run_fontbakery():
else:
from markdown import markdown
report_data = ""
i = 1
tabs = ""
for desc, report_file in reports:
if desc["filename"] is not None:
report_data += "<h3>{}</h3>{}".format(desc["filename"], markdown(report_file))
tabs += '<li><a href="#tabs-{}">{}</a></li>'.format(i, desc["filename"])
report_data += '<div id="tabs-{}">{}</div>'.format(i, markdown(report_file))
i+=1

return "<h2>Fontbakery check results</h2><div>{}</div>".format(report_data)
return '<div id="tabs"><ul>{}</ul>{}</div>'.format(tabs, report_data)

@app.errorhandler(500)
def server_error(e):
Expand Down
10 changes: 9 additions & 1 deletion webapp/app/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<title>FontBakery</title>
<script src="js/bower_components/requirejs/require.js"></script>
<link href="https://fonts.googleapis.com/css?family=Monoton|Raleway:300,400" rel="stylesheet">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<!--
<link href="bower_components/jquery-ui/themes/base/jquery-ui.min.css" rel="stylesheet">
-->
<style>

html {
Expand Down Expand Up @@ -72,7 +76,11 @@

</style>
<script>
require.config({baseUrl: 'js'});
require.config({baseUrl: 'js',
paths: {'jquery': 'bower_components/jquery/dist/jquery',
'jquery-ui': 'bower_components/jquery-ui/jquery-ui.min'
}
});
require(['bootstrap'], function(require) {
require(['main'], function(main){main()});
});
Expand Down
5 changes: 5 additions & 0 deletions webapp/app/static/js/Controller.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
define([
'dom-tool'
, 'opentype'
, 'jquery'
, 'jquery-ui'
], function(
dom
, opentype
, JQ
) {
"use strict";
/*global window, console, XMLHttpRequest, URL, TextDecoder, Blob, Uint8Array, TextEncoder, Uint32Array*/
Expand Down Expand Up @@ -220,6 +223,8 @@ define([
else {
//alert(xhr.response);
document.getElementById("results").innerHTML = xhr.response;
JQ("#tabs").tabs();

console.info('Received:', xhr.responseType, xhr.response.byteLength, 'Bytes');
//blob = new Blob([xhr.response], {type: "application/zip"});
//window.open(URL.createObjectURL(blob));
Expand Down
3 changes: 2 additions & 1 deletion webapp/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dependencies": {
"requirejs": "~2.3.2",
"opentype.js": "~0.6.5",
"marked": "~0.3.4"
"marked": "~0.3.4",
"jquery-ui": "~1.12.1"
}
}

0 comments on commit 56e1a79

Please sign in to comment.