--- a/src/colorado/static/colorado.css +++ b/src/colorado/static/colorado.css @@ -1,69 +1,12 @@ -.list { width: 100%; } -#file-list { margin-top: 1em; } -.tidbit { font-style: italic; } +.diff-add { color: #008000; } +.diff-del { color: #800000; } +.diff-hunk { font-weight: bold; } .ellipsis { text-overflow: ellipsis; overflow: hidden; } .file-box { background-color: white; margin: 1em; padding: 1em; } .file-box h3 { margin-top: 0; } +.list { width: 100%; } .rev-id { display: inline-block; max-width: 6em; text-overflow: ellipsis; overflow: hidden; } -#rev-diff-id { display: inline-block; margin: 0; } -.diff-hunk { font-weight: bold; } -.diff-add { color: #008000; } -.diff-del { color: #800000; } +.tidbit { font-style: italic; } -/* Copy-pasta */ -@media screen { - body { - background-color: #fafcef; - padding-top: 3.5em; - } - h1 { - background-color: #880c1c; - color: #fafcef; - left: 0px; - margin: 0em; - padding-bottom: 0.2em; - padding-left: 0.4em; - padding-right: 0.4em; - padding-top: 0.2em; - position: absolute; - top: 0px; - right: 0px; - } - h1 a { - color: #fafcef; - } -} -@media print { - h1 { color: #880c1c } -} -body { - color: black; -} -h1 { - font-size: xx-large; - font-weight: bold; -} -h1 a { - text-decoration: none; -} -h1:after { - content: ".name"; - font-size: x-large; - font-style: italic; - font-weight: normal; - opacity: 0.6; -} -h1,h2,h3 { - font-family: "Utopia", serif; -} -h2,h3 { - color: #880c1c; - font-weight: normal; -} -p,li { - text-align: justify; -} -a { - color: #880c1c; - text-decoration: underline; -} +#file-list { margin-top: 1em; } +#rev-diff-id { display: inline-block; margin: 0; } --- a/src/colorado/static/colorado.js +++ /dev/null @@ -1,21 +0,0 @@ -const setTimes = () => { - for(let ele of document.getElementsByClassName("dt-rel")) { - let val = ele.getAttribute("title"); - if (val) { - ele.innerHTML = moment(val).fromNow(); - } - } -}; - -const changeBranch = (e) => { - location.href = e.selectedOptions[0].value; -}; - -const bindClickButtons = () => { - for(let ele of document.getElementsByClassName("click-button")) { - let val = ele.getAttribute("href"); - if (val) { - ele.onclick = () => { location.href = val; }; - } - } -}; --- /dev/null +++ b/src/colorado/templates/base.xml @@ -0,0 +1,17 @@ + + + + + + +Git Viewer + + + + +

Git Viewer

+ +
+ + + --- a/src/colorado/templates/index.xml +++ b/src/colorado/templates/index.xml @@ -1,16 +1,5 @@ - - - - - -Repository - - - - - -

Luke Ross

+

Repositories

@@ -18,6 +7,4 @@

Last updated 2017-01-01 00:00:00

Description

- - - +
--- a/src/colorado/templates/repo-blob.xml +++ b/src/colorado/templates/repo-blob.xml @@ -1,15 +1,5 @@ - - - - - -Repository - - - - -

Luke Ross

+

Repository

@@ -35,5 +25,4 @@ content
- - +
--- a/src/colorado/templates/repo-history.xml +++ b/src/colorado/templates/repo-history.xml @@ -1,15 +1,5 @@ - - - - - -Repository - - - - -

Luke Ross

+

Repository

@@ -33,5 +23,4 @@ Brief introduction to the repo. - - +
--- a/src/colorado/templates/repo-home.xml +++ b/src/colorado/templates/repo-home.xml @@ -1,15 +1,5 @@ - - - - - -Repository - - - - -

Luke Ross

+

Repository

@@ -46,5 +36,4 @@ This is the contents of README.txt
- - +
--- a/src/colorado/templates/repo-revision.xml +++ b/src/colorado/templates/repo-revision.xml @@ -1,15 +1,5 @@ - - - - - -Repository - - - - -

Luke Ross

+

Repository

@@ -37,5 +27,4 @@ Brief introduction to the repo.
- - +
--- a/src/colorado/templates/repo-trees.xml +++ b/src/colorado/templates/repo-trees.xml @@ -1,15 +1,5 @@ - - - - - -Repository - - - - -

Luke Ross

+

Repository

@@ -33,5 +23,4 @@ Brief introduction to the repo. - - +
--- a/src/colorado/views.py +++ b/src/colorado/views.py @@ -1,6 +1,6 @@ import arrow import chardet -from flask import abort, Blueprint, make_response, send_file, url_for +from flask import abort, Blueprint, current_app, make_response, send_file, url_for from io import BytesIO from itertools import chain from lxmlmeld import parse_xml @@ -55,7 +55,7 @@ def configure_template(tpl, repo=None): ".static", filename="colorado.js" ))) run_on_meld(tpl, "html-title", lambda n: n.content( - repo.name if repo else "LukeRoss.name" + repo.name if repo else current_app.config.get("SITE_NAME", "Git Viewer") )) if repo: git = repo.repo @@ -87,7 +87,7 @@ def configure_template(tpl, repo=None): run_on_meld(tpl, "repo-tags", lambda n: n.deparent()) -def parse_xml_for_template(template_name, using=bp): +def parse_xml_file(template_name, using): """ Method: parse_xml_for_template @@ -110,6 +110,13 @@ def parse_xml_for_template(template_name, using=bp): )) +def parse_xml_for_template(template_name, using=bp): + base = parse_xml_file("base", using) + inner = parse_xml_file(template_name, using) + base.findmeld("container").replace(inner[:]) + return base + + def write_template(doc): """ Method: write_template