Helpers¶
build_pages_nav_main ¶
Reimplementation of ckanext-pages build_pages_nav_main()
This function reimplements the original ckanext-pages in order to overcome a bug whereby the groups menu is not removable because of a typo in its route name.
Source code in ckanext/saeoss/helpers.py
get_all_datasets_count ¶
fixes a bug when applying solr active search
Source code in ckanext/saeoss/helpers.py
get_current_release ¶
get releases to website footer, the release depends on the environment, if it's staging it uses v..-rc, rather if it's production v...
Source code in ckanext/saeoss/helpers.py
get_datasets_thumbnail ¶
Generate thumbnails based on metadataset
Source code in ckanext/saeoss/helpers.py
get_default_bounding_box ¶
Return the default bounding box in the form upper left, lower right
This function calculates the default bounding box from the
ckan.saeoss.default_spatial_search_extent
configuration value. Note that
this configuration value is expected to be in GeoJSON format and in GeoJSON,
coordinate pairs take the form lon, lat
.
This function outputs a list with upper left latitude, upper left latitude, lower right latitude, lower right longitude.
Source code in ckanext/saeoss/helpers.py
get_default_spatial_search_extent ¶
Return GeoJSON polygon with bbox to use for default view of spatial search map widget.
Source code in ckanext/saeoss/helpers.py
get_featured_datasets_count ¶
used with facets count
get_maintenance_custom_other_field_data ¶
The custom field "maintenance" stores other options in an __extra structure in the database, in package_extra table, this structure doesn't show up with regular ckan actions like package_show, package_search ..etc., we need to grab it from the database, if other alternatives can be used (e.g. when using the pkg coming with /package/read.html, the whole data shows up) it would be preferable
Source code in ckanext/saeoss/helpers.py
get_org_memberships ¶
Return a list of organizations and roles where the input user is a member
Source code in ckanext/saeoss/helpers.py
get_org_public_records_count ¶
the default behavior is showing fixed number of recoreds for orgs if the user is not a part of them in org list page, we are adjusting
Source code in ckanext/saeoss/helpers.py
get_recent_news ¶
Get the five recent news.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number |
int
|
Number of new want to get |
5
|
Source code in ckanext/saeoss/helpers.py
get_saved_searches ¶
Returns saved searches
based on a user id.
Source code in ckanext/saeoss/helpers.py
get_seo_metatags ¶
Get metatags value for SEO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
site_key |
str
|
Site's key |
required |
Source code in ckanext/saeoss/helpers.py
get_user_dashboard_packages ¶
The current behavior displays all the available datasets to the user, we need only the datasets created by the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id |
int
|
User's id |
required |
Source code in ckanext/saeoss/helpers.py
get_user_id ¶
Gets user id from its username (the username is also unique)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_name |
str
|
User's username |
required |
Source code in ckanext/saeoss/helpers.py
get_user_name ¶
Get a user's username by its id
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id |
int
|
User's id |
required |
get_user_name_from_url ¶
get_year ¶
mod_scheming_flatten_subfield ¶
this is specifically for testing site and might not be useful after a while, we are mimicking and modifying https://github.com/ckan/ckanext-scheming/blob/master/ckanext/scheming/helpers.py#L414 to avoid few errors
Source code in ckanext/saeoss/helpers.py
org_member_list ¶
Return list of organization members with the specified role
Source code in ckanext/saeoss/helpers.py
user_is_org_member ¶
Check if user has editor role in the input organization.
Source code in ckanext/saeoss/helpers.py
user_is_staff_member ¶
Check if user is a member of the staff org