]> arthur.barton.de Git - bup.git/commitdiff
Enable static resources. Move css to external file.
authorDavid Roda <davidcroda@gmail.com>
Tue, 14 Sep 2010 01:09:13 +0000 (21:09 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 22 Sep 2010 01:57:59 +0000 (18:57 -0700)
Add to the settings variable in web-cmd.py to set
/web/static to be servced as static resources.  This is for
css, javascript, and images.

Move the current styles from the head to static/css/styles.css.
Remove a few unnecessary styles and change the tab stop
to 4 spaces to match the rest of the code.

Add to Makefile to copy new directory structure.

Signed-off-by: David Roda <davidcroda@gmail.com>
Makefile
cmd/web-cmd.py
lib/web/list-directory.html
lib/web/static/styles.css [new file with mode: 0644]

index 65a8e3d8c22ace200b2abe915a1b0ef48c07889c..0faf8a684ff7d4967878587bf0de56c18fa53617 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ LIBDIR=$(DESTDIR)/usr/lib/bup
 install: all
        $(INSTALL) -d $(MANDIR)/man1 $(DOCDIR) $(BINDIR) \
                $(LIBDIR)/bup $(LIBDIR)/cmd $(LIBDIR)/tornado \
-               $(LIBDIR)/web
+               $(LIBDIR)/web $(LIBDIR)/web/static
        [ ! -e Documentation/.docs-available ] || \
          $(INSTALL) -m 0644 \
                Documentation/*.1 \
@@ -57,8 +57,11 @@ install: all
                lib/tornado/*.py \
                $(LIBDIR)/tornado
        $(INSTALL) -m 0644 \
-               lib/web/* \
-               $(LIBDIR)/web
+               lib/web/static/* \
+               $(LIBDIR)/web/static/
+       $(INSTALL) -m 0644 \
+               lib/web/*.html \
+               $(LIBDIR)/web/
 %/all:
        $(MAKE) -C $* all
 
index d0ca73046f433f8fc274a5fab7b973c997c43a2a..4bcc5480dac13eecfed75bc5f6b4ff50c92f36c7 100755 (executable)
@@ -178,6 +178,7 @@ top = vfs.RefList(None)
 settings = dict(
     debug = 1,
     template_path = resource_path('web'),
+    static_path = resource_path('web/static')
 )
 
 # Disable buffering on stdout, for debug messages
index b5b68ae5b8457afe3bcd402f33390e1d582074c7..0e9aa234200701175e0c88d22854a7d2e4c6032c 100644 (file)
@@ -1,43 +1,37 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>Directory listing for {{ escape(path) }}</title>
-    <style type="text/css">
-      body, table { font-family: sans-serif }
-      #breadcrumb { margin: 10px 0; }
-      .dir-name { text-align: left }
-      .dir-size { text-align: right }
-    </style>
-  </head>
-  <body>
-    <div id="breadcrumb">
-      {% for (display, part_path) in breadcrumbs[:-1] %}
-        <a href="{{ url_escape(part_path) }}">{{ escape(display) }}</a> /
-      {% end %}
-      <strong>{{ escape(breadcrumbs[-1][0]) }}</strong>
-    </div>
-    {% if files_hidden %}
-    <div id="message">
-      {% if hidden_shown %}
-      <a href=".">Hide hidden files</a>
-      {% else %}
-      <a href="?hidden=1">Show hidden files</a>
-      {% end %}
-    </div>
-    {% end %}
-    <table>
-      <tr>
-        <th class="dir-name">Name</th>
-        <th class="dir-size">Size</th>
-      </tr>
-      {% for (display, link, size) in dir_contents %}
-        <tr>
-          <td class="dir-name"><a href="{{ url_escape(link) }}">{{ escape(display) }}</a></td>
-          <td class="dir-size">{% if size != None %}{{ size }}{% else %}&nbsp;{% end %}</td>
-        </tr>
-      {% end %}
-    </table>
-  </body>
-</html>
-
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+        <title>Directory listing for {{ escape(path) }}</title>
+        <link rel="stylesheet" href="/static/styles.css" />
+    </head>
+    <body>
+        <div id="breadcrumb">
+            {% for (display, part_path) in breadcrumbs[:-1] %}
+            <a href="{{ part_path }}">{{ display }}</a> /
+            {% end %}
+            <strong>{{ breadcrumbs[-1][0] }}</strong>
+        </div>
+        {% if files_hidden %}
+        <div id="message">
+            {% if hidden_shown %}
+                <a href=".">Hide hidden files</a>
+            {% else %}
+                <a href="?hidden=1">Show hidden files</a>
+            {% end %}
+        </div>
+        {% end %}
+        <table>
+            <tr>
+                <th class="dir-name">Name</th>
+                <th class="dir-size">Size</th>
+            </tr>
+            {% for (display, link, size) in dir_contents %}
+            <tr>
+                <td class="dir-name"><a href="{{ link }}">{{ display }}</a></td>
+                <td class="dir-size">{% if size != None %}{{ size }}{% else %}&nbsp;{% end %}</td>
+            </tr>
+            {% end %}
+        </table>
+    </body>
+</html>
\ No newline at end of file
diff --git a/lib/web/static/styles.css b/lib/web/static/styles.css
new file mode 100644 (file)
index 0000000..11ce360
--- /dev/null
@@ -0,0 +1,7 @@
+body {
+    font-family: sans-serif
+}
+
+#breadcrumb {
+    margin: 10px 0;
+}
\ No newline at end of file