diff --git a/Makefile b/Makefile index 2815fe4..1bd3def 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ server: build: dist @cd '$(PROJDIR)' && \ - lektor build --output-path ../bin --buildstate-path ../build-state -f ENABLE_PDF_EXPORT # -f ENABLE_APPCACHE + lektor build --output-path ../bin --buildstate-path ../build-state -f ENABLE_PDF_EXPORT @echo @echo 'Checking dead links ...' @python3 extras/find-dead-links.py diff --git a/README.md b/README.md index 5566b8a..dd95886 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ Features ------- - Responsive design (desktop, mobile, print) -- Mobile application (AppCache & app manifest) -- Offline cache (local storage [150 recipes ~ 3mb]) +- Mobile Web-Application - Multi-language (DE & EN, more can be added) -- Blazing fast (due to cache and minimal data usage) +- Blazing fast due to minimal data usage - Indexed (group by time, ingredients, or tags) +- PDF export (if LuaLaTex is installed) - ~~static search~~ (**not yet**, but coming soon…) @@ -27,7 +27,7 @@ Install 3. Run `make dev server` to run a local server and preview the page. -4. For distribution run `make dist build` and add an [official deploy](https://www.getlektor.com/docs/deployment/). +4. For distribution run `make build pdf deploy` and add an [official deploy](https://www.getlektor.com/docs/deployment/). ### Modify @@ -41,7 +41,6 @@ A few things to note: 3. The preferred __image size__ is `800x600`. Please scale all images down to save bandwidth. Try to keep an aspect ratio of 4:3 for the first image, or it will be cropped on the recipe overview page! All other images will be shown unmodified in whatever aspect ratio is provided (individual recipe page) -4. __AppCache__ is disabled during development. However, you can pass `-f ENABLE_APPCACHE` to any `lektor` command to enable it. The makefile does this by default for the `build` target. Also, see [Lektor docs](https://www.getlektor.com/docs/) and [jinja2 template](https://jinja.palletsprojects.com/en/2.10.x/templates/) documentation. diff --git a/src/assets/static/script.js b/src/assets/static/script.js index e3f5ec0..f91e3a8 100644 --- a/src/assets/static/script.js +++ b/src/assets/static/script.js @@ -1,5 +1,4 @@ (function(){// main entry - handleAppCache(); updateViewport(); })(); function updateViewport() {// show at least 2 columns on mobile devices @@ -12,22 +11,6 @@ function updateViewport() {// show at least 2 columns on mobile devices document.head.appendChild(x); } } -function handleAppCache() {// update cache status icon - var cache = window.applicationCache; - if (cache) { - cache.addEventListener('updateready', update); - cache.addEventListener('cached', ready); // initial - cache.addEventListener('noupdate', ready); // consecutive - cache.addEventListener('downloading', busy); - cache.addEventListener('obsolete', failed); - if(cache.status===cache.UPDATEREADY){update()} - if(cache.status===cache.IDLE){window.onload=(event)=>{ready()};} - function update(){ready(); cache.swapCache(); window.location.reload()} - function busy(){document.getElementById('cache-status').style='background:darkorange'} - function ready(){document.getElementById('cache-status').style='background:forestgreen'} - function failed(){document.getElementById('cache-status').style='background:red'} - } -} /*! lozad.js - v1.9.0 - 2019-02-09 * https://github.com/ApoorvSaxena/lozad.js * Copyright (c) 2019 Apoorv Saxena; Licensed MIT */ diff --git a/src/assets/static/style.css b/src/assets/static/style.css index 66c0069..6100d93 100644 --- a/src/assets/static/style.css +++ b/src/assets/static/style.css @@ -47,10 +47,6 @@ body { background: var(--cBg3); color: var(--cTxt); } #logo { font-size: 42px; display: block; margin-bottom: 15px } -#cache-status { - position: absolute; right: 10px; top: 10px; - border-radius: 50%; width: 10px; height: 10px; -} header { position: relative } header a { color: var(--cTxt) } header, h1 { text-align: center } diff --git a/src/configs/force-update.ini b/src/configs/force-update.ini deleted file mode 100644 index 4f70c63..0000000 --- a/src/configs/force-update.ini +++ /dev/null @@ -1,2 +0,0 @@ -enabled = yes -endswith = .appcache \ No newline at end of file diff --git a/src/content/app.appcache/contents.lr b/src/content/app.appcache/contents.lr deleted file mode 100644 index 443cbcb..0000000 --- a/src/content/app.appcache/contents.lr +++ /dev/null @@ -1,3 +0,0 @@ -_template: cache.manifest ---- -_model: none \ No newline at end of file diff --git a/src/packages/force-update b/src/packages/force-update deleted file mode 160000 index 2b9ef7b..0000000 --- a/src/packages/force-update +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2b9ef7b17bd43955f6ba7e4d6f67bf97bd0ac6f8 diff --git a/src/packages/helper/lektor_helper.py b/src/packages/helper/lektor_helper.py index 694f3bf..023fafa 100644 --- a/src/packages/helper/lektor_helper.py +++ b/src/packages/helper/lektor_helper.py @@ -166,15 +166,8 @@ class HelperPlugin(Plugin): # Event hooks # ----------- - def processCLI(self, extra_flags): - useCache = bool(extra_flags.get('ENABLE_APPCACHE')) - plugin = get_plugin('force-update', self.env) - if plugin.enabled and not useCache: - plugin.enabled = False - print('AppCache: ' + ('ENABLED' if useCache else 'DISABLED')) - self.env.jinja_env.globals['ENABLE_APPCACHE'] = useCache - - def processSettings(self): + def on_before_build_all(self, builder, **extra): + # update project settings once per build bag = Databags(self.env) pad = self.env.new_pad() for alt in self.env.load_config().iter_alternatives(): @@ -185,14 +178,6 @@ class HelperPlugin(Plugin): 'replFrac': set['replace_frac'] } - def on_before_build_all(self, builder, **extra): - build_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') - print('Build time: ' + build_time) - self.env.jinja_env.globals['DATE_NOW'] = build_time - # update project settings once per build - self.processCLI(getattr(builder, 'extra_flags')) - self.processSettings() - # def on_process_template_context(self, context, **extra): # pass diff --git a/src/templates/cache.manifest b/src/templates/cache.manifest deleted file mode 100644 index 8e9b93b..0000000 --- a/src/templates/cache.manifest +++ /dev/null @@ -1,54 +0,0 @@ -CACHE MANIFEST -# Date build: {{ DATE_NOW }} - -{%- macro _print_(items) -%} -{%- for item in items if not item.endswith('tex') -%} - {{ item }} -{% endfor -%} -{%- endmacro -%} - -{%- macro _add_(list, item) -%} -{{- list.append(item|url) or pass -}} -{%- endmacro -%} - -{%- set root = site.get('/', this.alt) -%} - -{%- set assetList = [] -%} -{%- for asset in root.pad.asset_root.children recursive -%} - {%- if asset.__class__.__name__ != 'Directory' -%} - {{- _add_(assetList, asset) -}} - {%- endif -%} - {{- loop(asset.children) -}} -{%- endfor -%} - -{%- set cacheList = [] -%} -{{- _add_(cacheList, root) -}} -{%- for x in root.children if x != this recursive -%} - {{- _add_(cacheList, x) -}} - - {%- set pg = x.datamodel.pagination_config -%} - {%- if pg.enabled -%} - {%- for page in range(2, pg.count_pages(x) + 1) -%} - {{- _add_(cacheList, pg.get_record_for_page(x, page)) -}} - {%- endfor -%} - {%- endif -%} - - {#{% set img = x | title_image(small=True) -%} - {%- if img -%} - {{- _add_(cacheList, img) -}} - {%- endif -%}#} - - {%- if x.datamodel.has_own_children -%} - {{- loop(x.children) -}} - {%- endif -%} -{%- endfor -%} - -{#- Generate cache file index #} -# static -{{ _print_(assetList) -}} -# index -{{ _print_(cacheList) -}} - -{#- All other requests are forwarded #} -NETWORK: -* \ No newline at end of file diff --git a/src/templates/layout.html b/src/templates/layout.html index e97719c..7d69e14 100644 --- a/src/templates/layout.html +++ b/src/templates/layout.html @@ -1,7 +1,4 @@ -{%- if ENABLE_APPCACHE %} - -{% endif -%}
@@ -16,9 +13,6 @@ {#- ontouchstart="" #}