From 9fce16ff68357c6b41bed94c5be2ed985dccb9d7 Mon Sep 17 00:00:00 2001 From: David Roda Date: Mon, 13 Sep 2010 21:09:13 -0400 Subject: [PATCH] Enable static resources. Move css to external file. 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 --- Makefile | 9 +++-- cmd/web-cmd.py | 1 + lib/web/list-directory.html | 76 +++++++++++++++++-------------------- lib/web/static/styles.css | 7 ++++ 4 files changed, 49 insertions(+), 44 deletions(-) create mode 100644 lib/web/static/styles.css diff --git a/Makefile b/Makefile index 65a8e3d..0faf8a6 100644 --- 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 diff --git a/cmd/web-cmd.py b/cmd/web-cmd.py index d0ca730..4bcc548 100755 --- a/cmd/web-cmd.py +++ b/cmd/web-cmd.py @@ -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 diff --git a/lib/web/list-directory.html b/lib/web/list-directory.html index b5b68ae..0e9aa23 100644 --- a/lib/web/list-directory.html +++ b/lib/web/list-directory.html @@ -1,43 +1,37 @@ - - - Directory listing for {{ escape(path) }} - - - - - {% if files_hidden %} -
- {% if hidden_shown %} - Hide hidden files - {% else %} - Show hidden files - {% end %} -
- {% end %} - - - - - - {% for (display, link, size) in dir_contents %} - - - - - {% end %} -
NameSize
{{ escape(display) }}{% if size != None %}{{ size }}{% else %} {% end %}
- - - + + + Directory listing for {{ escape(path) }} + + + + + {% if files_hidden %} +
+ {% if hidden_shown %} + Hide hidden files + {% else %} + Show hidden files + {% end %} +
+ {% end %} + + + + + + {% for (display, link, size) in dir_contents %} + + + + + {% end %} +
NameSize
{{ display }}{% if size != None %}{{ size }}{% else %} {% end %}
+ + \ No newline at end of file diff --git a/lib/web/static/styles.css b/lib/web/static/styles.css new file mode 100644 index 0000000..11ce360 --- /dev/null +++ b/lib/web/static/styles.css @@ -0,0 +1,7 @@ +body { + font-family: sans-serif +} + +#breadcrumb { + margin: 10px 0; +} \ No newline at end of file -- 2.39.2