CKAN geosolution-ui is a open-source template, to make easy the publish and development of Ckan frontend.
Built With:
-
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
-
Clone the source and install it on the virtualenv
git clone https://github.com/geosolutions-it/ckanext-geosolutions-ui.git cd ckanext-geosolutions-ui pip install -e . pip install -r requirements.txt
-
Add
geosolutions-ui
to theckan.plugins
setting in your CKANvim /etc/ckan/default/ckan.ini
-
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
- install a ckan instance locally with docker (steps from ckan documentation https://docs.ckan.org/en/2.9/maintaining/installing/install-from-docker-compose.html)
-
clone the geosolutions-ui extension repository
cd /path/to/my/projects git clone --recursive https://github.com/geosolutions-it/ckanext-geosolutions-ui.git
-
to link ckan extension to ckan, create a file docker-compose.override.yml in /ckan/contrib/docker with the following code
cd /path/to/my/projects/ckan/contrib/docker touch docker-compose.override.yml
-
copy this configuration in docker-compose.override.yml
version: '3' services: ckan: volumes: - '../../../ckanext-geosolutions-ui:/usr/lib/ckan/venv/src/ckanext-geosolutions-ui'
-
stop & start up the application
docker-compose stop docker-compose up -d
-
get the id of the docker_ckan container with docker ps
docker ps
-
attach the shell of the ckan docker container
docker exec -it {my_docker_ckan_id} bash
-
activate the venv and navigate to the src folder inside the docker container
#this command have to run inside docker source $CKAN_VENV/bin/activate && cd $CKAN_VENV/src/
-
install the extension
#this command have to run inside docker cd ckanext-geosolutions-ui pip install -e .
-
install ckan dev requirements
#this command have to run inside docker cd ../ckan pip install -r dev-requirements.txt
-
add the plugin to the production.ini config
#this command have to run inside docker vim /etc/ckan/production.ini
-
append the name of plugin in the list and set debug equal true (both are in the file)
debug = true .... ckan.plugins = stats text_view image_view recline_view geosolutions_ui
-
detach from docker container bash shell and restart ckan docker
docker-compose restart ckan
-
inside Frontend directory
cd ckanext-geosolutions-ui/ckanext/geosolutions_ui/
-
folder tree
├── __init__.py ├── __init__.pyc ├── i18n ├── less │ ├── custom.less │ ├── main.less │ └── variables.less ├── package-lock.json ├── package.json ├── plugin.py ├── plugin.pyc ├── public │ └── base │ ├── css │ │ └── main.css │ └── img │ ├── jumbotron_hp.jpg │ └── logo.png └── templates ├── base.html ├── footer.html ├── header.html └── home ├── index.html ├── layout.html └── snippets ├── item.html ├── search.html └── topics.html
-
install npm dependecies
npm install
-
run less compiler
npm run watch-less
Start to customize
- Style
In the less folder, is possibile change the less variables, to have a basic style customization.
-
less/variables.less
@brandDefaultColor: #fff; @brandPrimaryColor: #3A79AF; @brandSecondaryColor: #f3f3f3; @brandNotificationColor:#62AE4A; @bodyTextColor:#464646; @brandNotificationColorTransparency: rgba(58, 121, 175, 0.9); @jumbotronBg: '../../../base/img/jumbotron_hp.jpg'; @jumbotronBgSize: 1224px 613px; @jumbotronBgPosition: center -40px; @jumbotronMinHeight: 410px; @bgPath: e(""); @layoutFontFamily: "Helvetica Neue", Arial, sans-serif;
- Logo
To change the logo file, in header and footer override the file
- public/base/img/logo.png
or change the logo var in
-
templates/footer.html
-
templates/header.html
{% set logo = '/base/img/logo.png' %}
-
Change footer info
templates/footer.html change this var
{% set logo = '/base/img/logo.png' %} {% set domain = 'https://www.geosolutionsgroup.com/' %} {% set customer = 'About GeoSolutions' %} {% set landingPage = 'about' %} {% set powerdByDomain = 'https://www.geosolutionsgroup.com/' %} {% set powerdBy = 'GeoSolutions' %}
-
Minimize main.css file
npm run compile-css
To run the tests, do:
pytest --ckan-ini=test.ini
If ckanext-geosolutions-ui should be available on PyPI you can follow these steps to publish a new version:
-
Update the version number in the
setup.py
file. See PEP 440 for how to choose version numbers. -
Make sure you have the latest version of necessary packages:
pip install --upgrade setuptools wheel twine
-
Create a source and binary distributions of the new version:
python setup.py sdist bdist_wheel && twine check dist/*
Fix any errors you get.
-
Upload the source distribution to PyPI:
twine upload dist/*
-
Commit any outstanding changes:
git commit -a git push
-
Tag the new release of the project on GitHub with the version number from the
setup.py
file. For example if the version number insetup.py
is 0.0.1 then do:git tag 0.0.1 git push --tags