From eed6a102e7a75d00560b10dd8d7d60e7e3637dd7 Mon Sep 17 00:00:00 2001 From: dave Date: Sat, 1 Jun 2019 23:13:34 -0700 Subject: [PATCH] update layout --- assets/style/main.less | 30 +++++++++++++++++++------- assets/style/mixins.less | 10 +++++++++ dirview/__init__.py | 2 -- gruntfile.js | 39 ---------------------------------- templates/page.html | 46 +++++++++++++++++++--------------------- 5 files changed, 54 insertions(+), 73 deletions(-) create mode 100644 assets/style/mixins.less diff --git a/assets/style/main.less b/assets/style/main.less index d451c0d..7aef29b 100644 --- a/assets/style/main.less +++ b/assets/style/main.less @@ -1,3 +1,6 @@ +@import "mixins.less"; + + // general styles body { background-color: #333; @@ -19,18 +22,29 @@ a:visted { color: #6ff; } // Layout -div.children { - div { - padding: 0px 15px; - } +div#header { + .clearfix(); } -div.dirs { +div#key { float: left; - width: 50%; + width: 30%; } -div.files { +div#svg-container { float: right; - width: 50%; + width: 70%; +} +div#index { + .clearfix(); + div#dirs { + float: left; + width: 50%; + padding-right: 15px; + } + div#files { + float: right; + width: 50%; + padding-left: 15px; + } } // Details svg { diff --git a/assets/style/mixins.less b/assets/style/mixins.less new file mode 100644 index 0000000..41bcec2 --- /dev/null +++ b/assets/style/mixins.less @@ -0,0 +1,10 @@ +.clearfix() { + &:before, + &:after { + content: " "; + display: table; + } + &:after { + clear: both; + } +} \ No newline at end of file diff --git a/dirview/__init__.py b/dirview/__init__.py index 4bf8d7e..9e08a3a 100644 --- a/dirview/__init__.py +++ b/dirview/__init__.py @@ -1,7 +1,5 @@ import os import sys -# import locale -# locale.setlocale(locale.LC_ALL, 'en_US') import logging import cherrypy from threading import Thread diff --git a/gruntfile.js b/gruntfile.js index ffdd531..2fc84bd 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -1,24 +1,7 @@ const webpackConfig = require('./webpack.config.js'); - module.exports = function(grunt) { grunt.initConfig({ - /*less: { - website: { - files: { - 'styles/css/main.css': 'styles/less/main.less' - } - } - },*/ - /*cssmin: { - website: { - files: { - 'styles/mincss/pure.css': 'node_modules/purecss/build/pure.css', - 'styles/mincss/grids-responsive-min.css': 'node_modules/purecss/build/grids-responsive.css', - 'styles/mincss/main.css': 'styles/css/main.css' - } - } - },*/ webpack: { dev: webpackConfig, }, @@ -41,27 +24,10 @@ module.exports = function(grunt) { sourceMap: true } }, - /*concat: { - deps_js: { - src: [ - 'node_modules/d3-voronoi-treemap/build/d3-voronoi-treemap.js', - 'node_modules/d3-voronoi-map/build/d3-voronoi-map.js', - 'node_modules/d3-weighted-voronoi/build/d3-weighted-voronoi.js', - 'node_modules/d3-scale/dist/d3-scale.js', - 'node_modules/d3/dist/d3.js', - 'node_modules/randomcolor/randomColor.js', - 'assets/js/main.js' - ], - dest: 'static/scripts.js', - }, - },*/ watch: { jshits: { files: ['assets/js/*.js'], tasks: ['webpack:dev', 'babel'], - // options: { - // spawn: false - // } }, cshits: { files: ["assets/style/main.less"], @@ -70,15 +36,10 @@ module.exports = function(grunt) { } }); - // grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-watch'); - // grunt.loadNpmTasks('grunt-contrib-cssmin'); - // grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-webpack'); grunt.loadNpmTasks('grunt-babel'); grunt.loadNpmTasks('grunt-contrib-less'); - // grunt.registerTask('default', ['less:website', 'cssmin:website', 'concat:dist']); grunt.registerTask('default', ['webpack:dev', 'babel', 'less:styles']); - }; diff --git a/templates/page.html b/templates/page.html index 5eb6e7d..8afd570 100644 --- a/templates/page.html +++ b/templates/page.html @@ -11,11 +11,8 @@ -
-
- -
-
+ -
- {% if node.typ in (NodeType.ROOT, NodeType.DIR) %} -
-
-

Subdirs:

- {% for child in node.children|sort(attribute='total_children', reverse=True) %}{% if child.typ in NodeGroup.DIRLIKE %} -
- {{ child.name }}: {{ child.total_size|data }} - {{ child.total_children|commafy }} children - {% endif %}{% endfor %} -
-
-

Files:

- {% for child in node.children|sort(attribute='name') %}{% if child.typ in NodeGroup.FILELIKE %} -
- {{ child.name }}: {{ child.total_size|data }} - {% endif %}{% endfor %} -
+
+
- {% endif %}
+ {% if node.typ in (NodeType.ROOT, NodeType.DIR) %} +
+
+

Subdirs:

+ {% for child in node.children|sort(attribute='total_children', reverse=True) %}{% if child.typ in NodeGroup.DIRLIKE %} +
+ {{ child.name }}: {{ child.total_size|data }} - {{ child.total_children|commafy }} children + {% endif %}{% endfor %} +
+
+

Files:

+ {% for child in node.children|sort(attribute='name') %}{% if child.typ in NodeGroup.FILELIKE %} +
+ {{ child.name }}: {{ child.total_size|data }} + {% endif %}{% endfor %} +
+
+ {% endif %} \ No newline at end of file