Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from OpenDataGIS/fix/ckanext-facet_scheming
Browse files Browse the repository at this point in the history
Fix/ckanext facet scheming
  • Loading branch information
mjanez authored May 6, 2023
2 parents 177b356 + 97a2043 commit 0aa9ddb
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 21 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ coverage.xml
docs/_build/
/.project
/.pydevproject

# Icons
ckanext/facet_scheming/public/images
!ckanext/facet_scheming/public/images/icons/spatial_uri
!ckanext/facet_scheming/public/images/icons/theme
!ckanext/facet_scheming/public/images/icons/theme_es
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ckanext-facet_scheming</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
5 changes: 5 additions & 0 deletions .pydevproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ckanext-facet-scheming
# ckanext-facet_scheming


`ckanext-facet-scheming` provides functions and templates that have been specially developed to extend the search functionality in CKAN for custom schemas. It uses the fields defined in a scheming file to provide a set of tools to use these fields for scheming, and a way to include icons in their labels when displaying them.
`ckanext-facet_scheming` provides functions and templates that have been specially developed to extend the search functionality in CKAN for custom schemas. It uses the fields defined in a scheming file to provide a set of tools to use these fields for scheming, and a way to include icons in their labels when displaying them.

![image](https://user-images.githubusercontent.com/96422458/235639244-4c2fc026-efec-460c-9800-62d2b5668b4a.png)

Expand All @@ -12,7 +12,7 @@
>**Warning**<br>
> This extension needs [custom GeoDCAT-AP ckanext-scheming](https://github.com/mjanez/ckanext-scheming) extension to work.
`facet-scheming` is designed to provide templates and functions to be used by other extensions over it. It uses the fields defined in a scheming file to provide
`facet_scheming` is designed to provide templates and functions to be used by other extensions over it. It uses the fields defined in a scheming file to provide
a set of tools to use those fields for scheming, and a way to include icons in its labels when displaying them.

Compatibility with core CKAN versions:
Expand All @@ -33,7 +33,7 @@ Suggested values:

## Installation

To install ckanext-facet-scheming:
To install ckanext-facet_scheming:

1. Activate your CKAN virtual environment, for example:

Expand All @@ -42,13 +42,13 @@ To install ckanext-facet-scheming:
2. Clone the source and install it on the virtualenv

```bash
git clone https://github.com/dsanjurj/ckanext-facet-scheming.git
cd ckanext-facet-scheming
git clone https://github.com/dsanjurj/ckanext-facet_scheming.git
cd ckanext-facet_scheming
pip install -e .
pip install -r requirements.txt
```

3. Add `facet-scheming` to the `ckan.plugins` setting in your CKAN
3. Add `facet_scheming` to the `ckan.plugins` setting in your CKAN
config file (by default the config file is located at
`/etc/ckan/default/ckan.ini`).

Expand Down Expand Up @@ -100,7 +100,7 @@ To install ckanext-facet-scheming:
## Helpers
`facet-scheming` provides a set of useful helpers to be used in templates
`facet_scheming` provides a set of useful helpers to be used in templates
- **fscheming\_default\_facet\_search\_operator**(): Returns the default
facet search operator: AND/OR (string)
Expand Down Expand Up @@ -269,11 +269,11 @@ Url for this option will be _images/icons/strange\_field/level2/strange\_value.[

## Developer installation

To install ckanext-facet-scheming for development, activate your CKAN virtualenv and
To install ckanext-facet_scheming for development, activate your CKAN virtualenv and
do:

git clone https://github.com/dsanjurj/ckanext-facet-scheming.git
cd ckanext-facet-scheming
git clone https://github.com/dsanjurj/ckanext-facet_scheming.git
cd ckanext-facet_scheming
python setup.py develop
pip install -r dev-requirements.txt

Expand All @@ -285,9 +285,9 @@ To run the tests, do:
pytest --ckan-ini=test.ini


## Releasing a new version of ckanext-facet-scheming
## Releasing a new version of ckanext-facet_scheming

If ckanext-facet-scheming should be available on PyPI you can follow these steps to publish a new version:
If ckanext-facet_scheming should be available on PyPI you can follow these steps to publish a new version:

1. Update the version number in the `setup.py` file. See [PEP 440](http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers) for how to choose version numbers.

Expand Down
Empty file.
Empty file.
4 changes: 0 additions & 4 deletions ckanext/facet_scheming/public/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion ckanext/facet_scheming/templates/.gitignore

This file was deleted.

18 changes: 18 additions & 0 deletions ckanext/facet_scheming/templates/package/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% ckan_extends %}
{% block secondary_content %}
{% snippet "spatial/snippets/spatial_query.html", default_extent="[[26.78,-19.21], [44.08, 5.66]]" %}
<div class="filters">
<div>
{{ h.snippet('snippets/fscheming_facet_search_operator.html', title= _('Search configuration')) }}
{% for facet in facet_titles %}
{% if facet =='owner_org' %}
{% set label_function = h.fscheming_organization_name %}
{% else %}
{% set label_function = None %}
{% endif %}
{{ h.snippet('snippets/fscheming_facet_list.html', title=facet_titles[facet], name=facet, search_facets=search_facets, scheming_choices=h.scheming_field_by_name(h.scheming_get_dataset_schema('dataset').dataset_fields,facet).choices, label_function = label_function) }}
{% endfor %}
</div>
<a class="close no-text hide-filters"><i class="fa fa-times-circle"></i><span class="text">close</span></a>
</div>
{% endblock %}
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
long_description = f.read()

setup(
name='''ckanext-facet-scheming''',
name='''ckanext-facet_scheming''',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
Expand All @@ -23,7 +23,7 @@
long_description_content_type="text/markdown",

# The project's main homepage.
url='https://github.com/dsanjurj/ckanext-facet-scheming',
url='https://github.com/dsanjurj/ckanext-facet_scheming',

# Author details
author='''Daniel Sanjurjo''',
Expand Down
2 changes: 1 addition & 1 deletion test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use = config:../../src/ckan/test-core.ini

# Insert any custom config settings to be used when running your extension's
# tests here. These will override the one defined in CKAN core's test-core.ini
ckan.plugins = facet-scheming
ckan.plugins = facet_scheming


# Logging configuration
Expand Down

0 comments on commit 0aa9ddb

Please sign in to comment.