mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-10-01 11:41:28 +02:00
Added BootStrap3 to the archive and improved format.py (#28).
We now use more external resources in the normal HTML output (cdnjs). This makes the generated HTML substantially smaller. Also took the opportunity to add a comment about the slightly modified tablesorter.js plug in that we are using.
This commit is contained in:
parent
91d94446a7
commit
75f1924823
@ -69,12 +69,11 @@ def output_header(repos):
|
||||
if __selected_format__ == "html" or __selected_format__ == "htmlembedded":
|
||||
base = basedir.get_basedir()
|
||||
html_header = __output_html_template__(base + "/html/html.header")
|
||||
tablesorter_js = __get_zip_file_content__("jquery.tablesorter.min.js",
|
||||
"/html/jquery.tablesorter.min.js.zip").encode("latin-1", "replace")
|
||||
tablesorter_js = tablesorter_js.decode("utf-8", "ignore")
|
||||
flot_js = __get_zip_file_content__("jquery.flot.js")
|
||||
pie_js = __get_zip_file_content__("jquery.flot.pie.js")
|
||||
resize_js = __get_zip_file_content__("jquery.flot.resize.js")
|
||||
|
||||
# The version of the table sorter is a modified version with support for the "euro" sign removed from the code.
|
||||
# This is because it's been found that on Windows environments it can cause trouble with certain character maps.
|
||||
tablesorter_js = __get_zip_file_content__("jquery.tablesorter.min.js", "/html/jquery.tablesorter.min.js.zip"). \
|
||||
encode("latin-1", "replace").decode("utf-8", "ignore")
|
||||
|
||||
logo_file = open(base + "/html/gitinspector_piclet.png", "rb")
|
||||
logo = logo_file.read()
|
||||
@ -83,8 +82,20 @@ def output_header(repos):
|
||||
|
||||
if __selected_format__ == "htmlembedded":
|
||||
jquery_js = ">" + __get_zip_file_content__("jquery.js")
|
||||
flot_js = ">" + __get_zip_file_content__("jquery.flot.js")
|
||||
pie_js = ">" + __get_zip_file_content__("jquery.flot.pie.js")
|
||||
resize_js = ">" + __get_zip_file_content__("jquery.flot.resize.js")
|
||||
bootstrap_js = ">" + __get_zip_file_content__("bootstrap.min.js", "/html/bootstrap.zip")
|
||||
bootstrap_css = "<style type=\"text/css\">%s</style>" % \
|
||||
__get_zip_file_content__("bootstrap.min.css", "/html/bootstrap.zip")
|
||||
else:
|
||||
jquery_js = " src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\">"
|
||||
flot_js = " src=\"https://cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot.min.js\">"
|
||||
pie_js = " src=\"https://cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot.pie.min.js\">"
|
||||
resize_js = " src=\"https://cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot.resize.min.js\">"
|
||||
bootstrap_js = " src=\"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js\">"
|
||||
bootstrap_css = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + \
|
||||
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css\">"
|
||||
|
||||
print(html_header.format(title=_("Repository statistics for '{0}'").format(repos_string),
|
||||
jquery=jquery_js,
|
||||
@ -92,6 +103,8 @@ def output_header(repos):
|
||||
jquery_flot=flot_js,
|
||||
jquery_flot_pie=pie_js,
|
||||
jquery_flot_resize=resize_js,
|
||||
bootstrap=bootstrap_js,
|
||||
bootstrap_css=bootstrap_css,
|
||||
logo=logo.decode("utf-8", "replace"),
|
||||
logo_text=_("The output has been generated by {0} {1}. The statistical analysis tool"
|
||||
" for git repositories.").format(
|
||||
|
BIN
gitinspector/html/bootstrap.zip
Normal file
BIN
gitinspector/html/bootstrap.zip
Normal file
Binary file not shown.
@ -5,9 +5,11 @@
|
||||
<title>{title}</title>
|
||||
<script type="application/javascript"{jquery}</script>
|
||||
<script type="application/javascript">{jquery_tablesorter}</script>
|
||||
<script type="application/javascript">{jquery_flot}</script>
|
||||
<script type="application/javascript">{jquery_flot_pie}</script>
|
||||
<script type="application/javascript">{jquery_flot_resize}</script>
|
||||
<script type="application/javascript"{jquery_flot}</script>
|
||||
<script type="application/javascript"{jquery_flot_pie}</script>
|
||||
<script type="application/javascript"{jquery_flot_resize}</script>
|
||||
{bootstrap_css}
|
||||
<script type="application/javascript"{bootstrap}</script>
|
||||
<script type="application/javascript">
|
||||
$(document).ready(function() {{
|
||||
var row = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user