ckanext-gallery

CKAN extension for a dataset gallery view.

https://github.com/naturalhistorymuseum/ckanext-gallery

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 7 committers (28.6%) from academic institutions
  • Institutional organization owner
    Organization naturalhistorymuseum has institutional domain (www.nhm.ac.uk)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.6%) to scientific vocabulary

Keywords

ckan ckan-extension

Keywords from Contributors

sketchfab gbif
Last synced: 6 months ago · JSON representation ·

Repository

CKAN extension for a dataset gallery view.

Basic Info
  • Host: GitHub
  • Owner: NaturalHistoryMuseum
  • License: gpl-3.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 5 MB
Statistics
  • Stars: 4
  • Watchers: 10
  • Forks: 4
  • Open Issues: 1
  • Releases: 22
Topics
ckan ckan-extension
Created over 11 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Support

README.md

The Natural History Museum logo.

ckanext-gallery

Tests Coveralls CKAN Python Docs

A CKAN extension for a dataset gallery view.

Overview

Adds a gallery view for resources on a CKAN instance. Three plugins are included in this extension: the main plugin (gallery) and two view plugins for specific image/data types (gallery_image and gallery_iiif).

Based on blueimp Gallery.

Installation

Path variables used below: - $INSTALL_FOLDER (i.e. where CKAN is installed), e.g. /usr/lib/ckan/default - $CONFIG_FILE, e.g. /etc/ckan/default/development.ini

Installing from PyPI

shell pip install ckanext-gallery

Installing from source

  1. Clone the repository into the src folder: shell cd $INSTALL_FOLDER/src git clone https://github.com/NaturalHistoryMuseum/ckanext-gallery.git

  2. Activate the virtual env: shell . $INSTALL_FOLDER/bin/activate

  3. Install via pip: shell pip install $INSTALL_FOLDER/src/ckanext-gallery

Installing in editable mode

Installing from a pyproject.toml in editable mode (i.e. pip install -e) requires setuptools>=64; however, CKAN 2.9 requires setuptools==44.1.0. See our CKAN fork for a version of v2.9 that uses an updated setuptools if this functionality is something you need.

Post-install setup

  1. Add 'gallery' to the list of plugins in your $CONFIG_FILE: ini ckan.plugins = ... gallery

  2. Install lessc globally: shell npm install -g "less@~4.1"

Configuration

There's only one option that can be specified in the .ini file:

| Name | Description | Default | |------------------------------------|---------------------------------------|---------| | ckanext.gallery.records_per_page | Number of images to display on a page | 32 |

Usage

To use as a view, no further setup is needed; the 'Gallery' type should be available for resources after installing the plugin.

Interfaces

The IGalleryImage interface allows plugins to override settings.

```python from ckan.plugins import SingletonPlugin, implements from ckanext.gallery.plugins.interfaces import IGalleryImage

class YourPlugin(SingletonPlugin): implements(IGalleryImage)

def imageinfo(self): ''' Return info for this plugin. If resource type is set, only datasets of that type will be available. ''' return {u'title': u'Text', u'resourcetype': [u'csv', u'tsv'], u'field_type': [u'text']}

def getimages(self, fieldvalue, record, datadict): ''' Process images from a single record to return custom metadata. The fieldvalue depends on the image field you choose. ''' images = [{ u'href': fieldvalue[u'url'], u'thumbnail': fieldvalue[u'url'].replace(u'preview', u'thumbnail'), u'recordid': record[u'id'] } for img in field_value] return image ```

Templates

Gallery block snippet

html+jinja {% snippet 'gallery/snippets/gallery.html', images=g.images, resource_id=res.id %}

Testing

There is a Docker compose configuration available in this repository to make it easier to run tests. The ckan image uses the Dockerfile in the docker/ folder.

To run the tests against ckan 2.9.x on Python3:

  1. Build the required images: shell docker compose build

  2. Then run the tests. The root of the repository is mounted into the ckan container as a volume by the Docker compose configuration, so you should only need to rebuild the ckan image if you change the extension's dependencies. shell docker compose run ckan

Owner

  • Name: Natural History Museum
  • Login: NaturalHistoryMuseum
  • Kind: organization
  • Location: London

Citation (CITATION.cff)

cff-version: 1.2.0
title: CKAN Gallery extension
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - name: Natural History Museum
    city: London
    country: GB
    alias: NHM
    email: data@nhm.ac.uk
repository-code: 'https://github.com/NaturalHistoryMuseum/ckanext-gallery'
abstract: A CKAN extension for a dataset gallery view.
keywords:
  - ckan
  - ckanext
  - gallery
license: GPL-3.0-or-later
version: 3.0.5

GitHub Events

Total
  • Create event: 5
  • Issues event: 2
  • Release event: 3
  • Delete event: 5
  • Member event: 1
  • Issue comment event: 4
  • Push event: 24
  • Pull request event: 16
Last Year
  • Create event: 5
  • Issues event: 2
  • Release event: 3
  • Delete event: 5
  • Member event: 1
  • Issue comment event: 4
  • Push event: 24
  • Pull request event: 16

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 139
  • Total Committers: 7
  • Avg Commits per committer: 19.857
  • Development Distribution Score (DDS): 0.619
Top Committers
Name Email Commits
benscott b****n@b****k 53
Alice Butcher a****i@g****m 48
Josh Humphries j****s@n****k 23
github-actions[bot] g****]@u****m 7
dependabot[bot] 4****]@u****m 4
Alice Heaton a****n@n****k 3
vagrant v****t@c****r 1
Committer Domains (Top 20 + Academic)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 197 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 17
  • Total maintainers: 1
pypi.org: ckanext-gallery

A CKAN extension for a dataset gallery view.

  • Versions: 17
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 197 Last month
Rankings
Dependent packages count: 2.9%
Downloads: 10.4%
Forks count: 15.7%
Average: 16.6%
Stargazers count: 23.3%
Dependent repos count: 30.6%
Maintainers (1)
Last synced: 7 months ago

Dependencies

ckanext/gallery/theme/assets/vendor/blueimp-gallery/bower.json bower
  • less 1.4.2 development
  • uglify-js 2.4.0 development
ckanext/gallery/theme/assets/vendor/blueimp-gallery/package.json npm
  • less 1.5.0-b3 development
  • uglify-js 2.4.0 development
ckanext/gallery/theme/assets/vendor/jquery-ui-1.12.1.custom/package.json npm
  • commitplease 2.3.0 development
  • grunt 0.4.5 development
  • grunt-bowercopy 1.2.4 development
  • grunt-cli 0.1.13 development
  • grunt-compare-size 0.4.0 development
  • grunt-contrib-concat 0.5.1 development
  • grunt-contrib-csslint 0.5.0 development
  • grunt-contrib-jshint 0.12.0 development
  • grunt-contrib-qunit 1.0.1 development
  • grunt-contrib-requirejs 0.4.4 development
  • grunt-contrib-uglify 0.11.1 development
  • grunt-git-authors 3.1.0 development
  • grunt-html 6.0.0 development
  • grunt-jscs 2.1.0 development
  • load-grunt-tasks 3.4.0 development
  • rimraf 2.5.1 development
  • testswarm 1.1.0 development
.github/workflows/bump.yml actions
  • actions/checkout v3 composite
  • commitizen-tools/commitizen-action master composite
  • softprops/action-gh-release v1 composite
.github/workflows/main.yml actions
  • actions/checkout v3 composite
.github/workflows/pypi-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
docker/Dockerfile docker
  • naturalhistorymuseum/ckantest 0.2 build
docker-compose.yml docker
  • ckan/ckan-solr 2.9
  • redis latest
docs/requirements.txt pypi
  • mkdocs *
  • mkdocs-gen-files *
  • mkdocs-include-markdown-plugin *
  • mkdocs-material *
  • mkdocs-section-index *
  • mkdocstrings *
pyproject.toml pypi
  • ckantools >=0.3.0