From c7fa6c8b5b250c4ca6777af045444c5ffd764863 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Fri, 7 Sep 2018 15:06:59 +0200 Subject: [PATCH] Fix serve images locally client side + some client optimizations --- .gitignore | 2 + flatisfy/web/app.py | 10 +++ flatisfy/web/js_src/components/flatstable.vue | 66 ++------------ .../web/js_src/components/flatstableline.vue | 88 +++++++++++++++++++ flatisfy/web/js_src/i18n/en/index.js | 3 +- flatisfy/web/js_src/views/home.vue | 7 +- 6 files changed, 116 insertions(+), 60 deletions(-) create mode 100644 flatisfy/web/js_src/components/flatstableline.vue diff --git a/.gitignore b/.gitignore index d3e2429..354b54c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ flatisfy/web/static/assets data/ package-lock.json doc/_build +yarn.lock +data_rework/ diff --git a/flatisfy/web/app.py b/flatisfy/web/app.py index fa25725..5d88752 100644 --- a/flatisfy/web/app.py +++ b/flatisfy/web/app.py @@ -121,5 +121,15 @@ def get_app(config): "/img/", "GET", lambda filename: _serve_static_file("/img/{}".format(filename)) ) + app.route( + "/data/img/", "GET", + lambda filename: bottle.static_file( + filename, + root=os.path.join( + config["data_directory"], + "images" + ) + ) + ) return app diff --git a/flatisfy/web/js_src/components/flatstable.vue b/flatisfy/web/js_src/components/flatstable.vue index 330c452..fe3284f 100644 --- a/flatisfy/web/js_src/components/flatstable.vue +++ b/flatisfy/web/js_src/components/flatstable.vue @@ -48,62 +48,7 @@ - - - - - - - - - [{{ flat.id.split("@")[1] }}] {{ flat.title }} - - - - - - - {{ flat.area }} m² - - {{ flat.rooms ? flat.rooms : '?'}} - - - {{ flat.cost }} {{ flat.currency }} - - - - - {{ flat.sqCost }} {{ flat.currency }} - - - - - - - - - - - - + @@ -111,9 +56,15 @@ diff --git a/flatisfy/web/js_src/components/flatstableline.vue b/flatisfy/web/js_src/components/flatstableline.vue new file mode 100644 index 0000000..8f5f404 --- /dev/null +++ b/flatisfy/web/js_src/components/flatstableline.vue @@ -0,0 +1,88 @@ + + + diff --git a/flatisfy/web/js_src/i18n/en/index.js b/flatisfy/web/js_src/i18n/en/index.js index d61d4c6..16f6ae2 100644 --- a/flatisfy/web/js_src/i18n/en/index.js +++ b/flatisfy/web/js_src/i18n/en/index.js @@ -13,7 +13,8 @@ export default { 'Close': 'Close', 'sortUp': 'Sort in ascending order', 'sortDown': 'Sort in descending order', - 'mins': 'min | mins' + 'mins': 'min | mins', + 'Unknown': 'Unknown' }, home: { 'new_available_flats': 'New available flats' diff --git a/flatisfy/web/js_src/views/home.vue b/flatisfy/web/js_src/views/home.vue index 9c32996..4bfc8be 100644 --- a/flatisfy/web/js_src/views/home.vue +++ b/flatisfy/web/js_src/views/home.vue @@ -6,7 +6,12 @@