okfn / ckanext-tsbsatellites

repo for Satellites Catapult's CKAN
http://data.satapps.org/
GNU Affero General Public License v3.0
3 stars 3 forks source link

Categories links in the homepage #21

Closed adamamyl closed 10 years ago

adamamyl commented 10 years ago

Can we fix-up the links on the homepage to point to the categories: I'd prefer it if we can pull these from the API, rather than hard-code.

adamamyl commented 10 years ago

Probably populate via JSON file

amercader commented 10 years ago

These categories are defined in the ISO standard and are unlikely to be changed, I think it's safe to have them on a dict somewhere in the code.

As @mintcanary already correctly implemented, these match the field topic-category. I added a helper function that returns the number of datasets on each category. We could probably only create the link for the ones that actually have records on the catalogue (right now environment only) and show the rest a bit dimmed or without the pointer cursor. Or not show them at all, depending on what the client wants.

@adamamyl could you clarify with them please?

Also on the original list there are more categories (19). This is how it looks right now:

42mzii6

@mintcanary The code is pretty straight-forward for you to modify if needed. The categories titles are defined here [1] and the home template can be tweaked here [2] if necessary.

[1] https://github.com/okfn/ckanext-tsbsatellites/blob/1d64e78c84a138ff3557ba45a3584ac1ecf08d54/ckanext/tsbsatellites/helpers.py#L4 [2] https://github.com/okfn/ckanext-tsbsatellites/blob/1d64e78c84a138ff3557ba45a3584ac1ecf08d54/ckanext/tsbsatellites/theme/templates/home/index.html#L42

adamamyl commented 10 years ago

We could probably only create the link for the ones that actually have records on the catalogue (right now environment only) and show the rest a bit dimmed or without the pointer cursor. Or not show them at all, depending on what the client wants.

If zero entries, no linky please.

adamamyl commented 10 years ago

[bug report] when a dataset has multiple categories, it's only the first category that's detailed on the homepage (count). Can this be fixed to include all categories where multiple exist.

amercader commented 10 years ago

@adamamyl Fixed the issue with multiple categories