Skip to content

Commit

Permalink
Merge pull request #1 from datopian/setup/scss-styling-setup
Browse files Browse the repository at this point in the history
Home page styling  implemented as per Figma design
  • Loading branch information
sagargg committed Dec 14, 2022
2 parents da99878 + 71a9169 commit d512866
Show file tree
Hide file tree
Showing 167 changed files with 35,992 additions and 46 deletions.
11,466 changes: 11,466 additions & 0 deletions ckanext/ubdc/assets/css/style.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions ckanext/ubdc/assets/js/ubdc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$('.site-search button').click(function(event) {
$('#field-sitewide-search').addClass('');
});
26 changes: 13 additions & 13 deletions ckanext/ubdc/assets/webassets.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# ubdc-js:
# filter: rjsmin
# output: ckanext-ubdc/%(version)s-ubdc.js
# contents:
# - js/ubdc.js
# extra:
# preload:
# - base/main
ubdc-js:
filter: rjsmin
output: ckanext-ubdc/%(version)s-ubdc.js
contents:
- js/ubdc.js
extra:
preload:
- base/main

# ubdc-css:
# filter: cssrewrite
# output: ckanext-ubdc/%(version)s-ubdc.css
# contents:
# - css/ubdc.css
ubdc-css:
filter: cssrewrite
output: ckanext-ubdc/%(version)s-ubdc.css
contents:
- css/style.css
177 changes: 147 additions & 30 deletions ckanext/ubdc/dataset_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ dataset_fields:
preset: title
form_placeholder: eg. A descriptive title

- field_name: alternative_title
label: Alternative title
form_placeholder: eg. An alternative dataset title

- field_name: name
label: URL
preset: dataset_slug
Expand All @@ -21,60 +25,173 @@ dataset_fields:
form_snippet: markdown.html
form_placeholder: eg. Some useful notes about the data

- field_name: content
label: Content
form_snippet: markdown.html
form_placeholder: eg. Some useful content about what does the dataset consists of (more tables, some specifics etc…)

- field_name: subject
label: Subject
form_snippet: markdown.html
form_placeholder: eg. Subject of the dataset ie housing/transport

- field_name: tag_string
label: Tags
label: Topics
preset: tag_string_autocomplete
form_placeholder: eg. economy, mental health, government

- field_name: dataset_citation
label: Dataset Citation

- field_name: time_period_coverage
label: Time Period Coverage

- field_name: geographical_coverage
label: Geographical Coverage

- field_name: spatial_units
label: Subject

- field_name: observation_units
label: Observation Units

- field_name: resource_type
label: Resource Type

- field_name: data_format
label: Data Format

- field_name: weighting
label: Weighting

- field_name: method_of_collection
label: Method of Collection

- field_name: collection_status
label: Collection Status

- field_name: dataset_fields
label: Dataset Fields

- field_name: dataset_aggregation
label: Dataset Aggregation

- field_name: data_owner
label: Data Owner

- field_name: data_owner_url
label: Data Owner Url

- field_name: license_id
label: License
form_snippet: license.html
help_text: License definitions and additional information can be found at http://opendefinition.org/
label: Licence Name

- field_name: license_specifics
label: Licence Specifics
form_snippet: markdown.html
form_placeholder: eg. Some useful notes about the licence

- field_name: owner_org
label: Organization
preset: dataset_organization

- field_name: url
label: Source
form_placeholder: http://example.com/dataset.json
display_property: foaf:homepage
display_snippet: link.html

- field_name: version
label: Version
validators: ignore_missing unicode_safe package_version_validator
form_placeholder: '1.0'

- field_name: author
label: Author
form_placeholder: Joe Bloggs
display_property: dc:creator
- field_name: dataset_available
label: Dataset Available
reset: date
form_placeholder: eg. 2011-01-01

- field_name: dataset_closed
label: Dataset Closed
preset: date
form_placeholder: eg. 2011-01-01

- field_name: dataset_valid
label: Dataset Valid
preset: date
form_placeholder: eg. 2011-01-01

- field_name: dataset_updating_frequency
label: Dataset Updating Frequency
form_placeholder: eg. Every monthy

- field_name: dataset_next_version_due
label: Dataset Next Version Due
preset: date
form_placeholder: eg. 2011-01-01

- field_name: date_published
label: Date Published
preset: date
form_placeholder: eg. 2022-01-01

- field_name: date_of_fieldwork
label: Date of Fieldwork
form_placeholder: eg. 2022-01-01 to 2022-02-29

- field_name: dataset_file_type
label: Dataset File Type
form_placeholder: eg. CSV

- field_name: dataset_file_size
label: Dataset File Size
form_placeholder: eg. 1.5MB

- field_name: dataset_creation_date
label: Dataset Creation Date
preset: date
form_placeholder: eg. 2011-01-01

- field_name: dataset_access_restrictions
label: Dataset Access Restrictions
form_placeholder: eg. Open, Safeguarded or Controlled Dataset

- field_name: metadata_created_date
label: Metadata Created Date
preset: date
form_placeholder: eg. 2022-01-01

- field_name: metadata_created_institution
label: Metadata Created Institution
form_placeholder: eg. Urban Big Data Centre

# - field_name: dataset_fields
# label: Dataset Fields
# repeating_label: Dataset Field
# repeating_subfields:

# - field_name: name
# label: Field Name

# - field_name: description
# label: Description

# - field_name: type
# label: Type
# preset: select
# choices:
# - value: text
# label: Text
# - value: number
# label: Number
# - value: date
# label: Date
# - value: boolean
# label: Boolean
# - value: other
# label: Other

- field_name: author_email
label: Author Email
form_placeholder: [email protected]
display_property: dc:creator
display_snippet: email.html
display_email_name_field: author

- field_name: publishing_status
label: Publishing Status
form_snippet: null
display_snippet: null
validators: ignore_missing publishing_status_validator

- field_name: maintainer
label: Maintainer
form_placeholder: Joe Bloggs
display_property: dc:contributor

- field_name: maintainer_email
label: Maintainer Email
form_placeholder: [email protected]
display_property: dc:contributor
display_snippet: email.html
display_email_name_field: maintainer


resource_fields:
Expand Down
22 changes: 22 additions & 0 deletions ckanext/ubdc/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

from ckan import model
from ckan.logic import get_action


def popular_datasets(limit=3):
"""Return a list of the most popular datasets."""
context = {'model': model, 'session': model.Session}
data_dict = {'sort': 'views_recent desc', 'rows': limit}
return get_action('package_search')(context, data_dict)['results']


def resources_count():
"""Return the total number of resources."""
context = {'model': model, 'session': model.Session}
data_dict = {'query': 'name:'}
return get_action('resource_search')(context, data_dict)['count']

def tags_count():
"""Return the total number of tags."""
context = {'model': model, 'session': model.Session}
return {'count': len(get_action('tag_list')(context, {})) }
14 changes: 11 additions & 3 deletions ckanext/ubdc/plugin.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit

import ckanext.ubdc.helpers as helpers

class UbdcPlugin(plugins.SingletonPlugin):
plugins.implements(plugins.IConfigurer)
plugins.implements(plugins.ITemplateHelpers)

# IConfigurer
def update_config(self, config_):
toolkit.add_template_directory(config_, 'templates')
toolkit.add_public_directory(config_, 'public')
toolkit.add_resource('fanstatic',
'ubdc')
toolkit.add_resource('assets', 'ubdc')

# ITemplateHelpers
def get_helpers(self):
return {
'popular_datasets': helpers.popular_datasets,
'resources_count': helpers.resources_count,
'tags_count': helpers.tags_count,
}
3 changes: 3 additions & 0 deletions ckanext/ubdc/public/base/images/csv-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ckanext/ubdc/public/base/images/fav.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d512866

Please sign in to comment.