BerkeleyAutomation / malasakit

Malasakit is a customizable participatory assessment platform that collects and integrates quantitative assessment, qualitative feedback, and peer-to-peer collaborative filtering on ways local communities can become better prepared for typhoons and floods.
2 stars 8 forks source link

Serviceworker: caching assets for offline functionality #68

Closed liboan closed 7 years ago

liboan commented 7 years ago

I'm now caching each view three times; e.g. /pcari/landing/, /pcari/landing/?lang=en, /pcari/landing/?lang=tl because it occurred to me that a user may navigate to a page by a url and not put in the get params (or, navigate to /pcari/landing/ at the very beginning, then hit back). Thoughts?

JustinMi commented 7 years ago

Is there a way to prevent users from accessing /pcari/landing "default" view? e.g have the default URL be /pcari/landing/?lang=en, and they can switch to /pcari/landing/?lang=tl if they want.

A suggestion: https://docs.djangoproject.com/en/1.11/topics/i18n/translation/#language-prefix-in-url-patterns

Basically, with this version, the views.py URL endpoints will be prepended with the language code, so like /en/pcari/landing

JustinMi commented 7 years ago

That way you only need to cache the english and filipino versions, and not a redundant third one

liboan commented 7 years ago

Yes, I agree- I want to branch it off from master separately tomorrow