A Django app to build and test a collection of front-end components for myDALITE
Project description
SALTISE-components is a simple Django app to build and test a collection of front-end components for myDALITE built with preact and Material UI.
Quick start
Add the Components app to your requirements, then pip install:
pip install SALTISE-components
Add “components” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'components', ... ]
Import minified script to access component library (you can override default styles using global css names):
<script src="{% static 'component/js/app.min.js' %}" defer="true"></script>
Inject components into the DOM, customizing props as needed. Assuming django-csp is installed, the Navigation components is injected via:
<script nonce="{{ request.csp_nonce }}"> window.addEventListener("load", function () { const nav = () => { return components.h(components.Navigation, { nonce: "{{ request.csp_nonce }}", }); }; components.render( nav(), document.getElementById("navigation-app") ); }); </script>
Quick start dev
Install node modules:
npm install
Create python 3.8+ virtualenv and nstall pip-tools:
python -m pip install --upgrade pip pip install pip-tools
Install requirements:
pip-sync requirements/requirements.txt
Install pre-commit:
pre-commit install
Start the server:
python components.py runserver
Navigate to ‘localhost:8000/’, to see components in action.
Build when you make edits to app.js:
npx gulp scripts
To create translations:
npx gulp scripts python components.py makemessages -d djangojs -l fr -i=node_modules/* -i=venv* python components.py compilemessages -l fr -i=venv*
If you wish, remake the package:
tox --recreate
To publish, e.g.:
twine upload .tox/dist/SALTISE_components-0.1.zip --verbose
To do in myDALITE
Align question difficulty serializer
Define assignment difficulty in serializer
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for SALTISE_components-0.2.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca42b6c528972b33cd5bcd5967a787a950e19ca7a8f426e872bde3159837216a |
|
MD5 | e9c5ce5e792dd6f5fd5b1e4b7e1b3fe1 |
|
BLAKE2b-256 | f83ec37d088846f306b82ea06222918c3c7a194a603d637a2f6e7f88d9804a68 |