Skip to content

Commit

Permalink
Merge pull request #79 from AuScope/dev
Browse files Browse the repository at this point in the history
Merge Dev to Master (Format metadata display)
  • Loading branch information
stuartwoodman authored Mar 20, 2024
2 parents bf52d29 + f275bae commit 83a9a67
Show file tree
Hide file tree
Showing 16 changed files with 247 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dataset_fields:

# field_name conflicts with documentation (identifier)
- field_name: doi
label: Identifier
label: DataCite DOI Identifier
form_placeholder: A DOI will be automatically minted when the dataset is published
form_attrs:
disabled: true
Expand Down Expand Up @@ -62,7 +62,8 @@ dataset_fields:
- field_name: author_affiliation_identifier
label: Author Affiliation Identifier
required: true
help_text: The persistent identifier of the affiliated entity
display_snippet: None
help_text: The persistent identifier of the affiliated entity. Please specify the absolute URL, e.g. https://ror.org/03qn8fb07

- field_name: author_affiliation_identifier_type
label: Author Affiliation Identifier Type
Expand All @@ -74,7 +75,8 @@ dataset_fields:
- value: Other
label: Other
default: ROR
form_include_blank_choice: false
form_include_blank_choice: false
display_snippet: None
help_text: The persistent identifier type of the affiliated entity

- field_name: author_identifier_type
Expand Down Expand Up @@ -104,7 +106,8 @@ dataset_fields:

- field_name: author_identifier
label: Author Identifier
help_text: Uniquely identifies an individual or legal entity, according to identifier schemes
display_snippet: URL
help_text: Uniquely identifies an individual or legal entity, according to identifier schemes. Please specify the absolute URL, e.g. https://orcid.org/0000-0003-0870-3192

- field_name: author_email
label: Author Email
Expand Down Expand Up @@ -144,14 +147,15 @@ dataset_fields:
label: GCMD Science Keywords
required: true
form_snippet: gcmd_field.html
display_snippet: null
display_snippet: gcmd_field.html
help_text: Global Change Master Directory (GCMD) science keywords
groupBy: About Dataset

- field_name: gcmd_keywords
label: GCMD Science Keywords
form_snippet: hidden_field.html
help_text: Global Change Master Directory (GCMD) science keywords
display_snippet: null
groupBy: About Dataset

- field_name: fields_of_research_code
Expand All @@ -166,6 +170,7 @@ dataset_fields:
label: Fields of Research
form_snippet: hidden_field.html
help_text: The area(s) of study relevant to the dataset based on the ANZSRC Fields of Research (FoR) 2020
display_snippet: fields_of_research_field.html
groupBy: About Dataset

- field_name: deposit_date
Expand Down Expand Up @@ -238,6 +243,7 @@ dataset_fields:
label: Elevation (m)
help_text: The measurement of height above or below mean sea level in meters
form_snippet: null
display_snippet: null
groupBy: Spatial & Temporal

# - field_name: vertical_datum
Expand Down Expand Up @@ -269,6 +275,7 @@ dataset_fields:
label: Geographic Coordinate System
form_snippet: hidden_field.html
help_text: The measurement of height above mean sea level in meters
display_snippet: null
groupBy: Spatial & Temporal

- field_name: funder
Expand All @@ -286,7 +293,8 @@ dataset_fields:

- field_name: funder_identifier
label: Funder Identifier
help_text: Unique identifier of the funding entity
display_snippet: URL
help_text: Unique identifier of the funding entity. Please specify the absolute URL, e.g. http://dx.doi.org/10.13039/501100000923

- field_name: funder_identifier_type
label: Funder Identifier Scheme
Expand All @@ -312,7 +320,8 @@ dataset_fields:

- field_name: project_grant_identifier
label: Project Grant Identifier
help_text: The code assigned by the funder to a sponsored grant or project of the dataset
display_snippet: URL
help_text: The code assigned by the funder to a sponsored grant or project of the dataset. Please specify the absolute URL, e.g. https://dataportal.arc.gov.au/NCGP/Web/Grant/Grant/IM240100006

- field_name: project_grant_name
label: Project Grant Name
Expand Down Expand Up @@ -403,6 +412,7 @@ dataset_fields:
- field_name: related_resource_url
label: Related Resource URL
required: true
display_snippet: URL
help_text: Associated resources (e.g. report, article, data) related to the dataset. Enter the complete URL address of the related link. Permanent links are preferred

- field_name: related_resource_title
Expand Down Expand Up @@ -506,6 +516,7 @@ dataset_fields:
form_include_blank_choice: false
help_text: The entity that publishes the dataset
form_snippet: hidden_field.html
display_snippet: publisher_field.html
groupBy: Supporting Metadata

- field_name: publisher_identifier
Expand All @@ -519,6 +530,7 @@ dataset_fields:
help_text: The persistent identifier of the data publisher
form_include_blank_choice: false
form_snippet: hidden_field.html
display_snippet: null
groupBy: Supporting Metadata

- field_name: publisher_identifier_type
Expand All @@ -532,6 +544,7 @@ dataset_fields:
form_include_blank_choice: false
help_text: The type of the persistent identifier represents the data publisher
form_snippet: hidden_field.html
display_snippet: null
groupBy: Supporting Metadata

- field_name: license
Expand Down Expand Up @@ -567,7 +580,7 @@ dataset_fields:
required: true
default: [email protected]
display_snippet: email.html
display_email_name_field: primary_contact_name
# display_email_name_field: primary_contact_name
help_text: Email of the primary contact
form_snippet: hidden_field.html
groupBy: Supporting Metadata
Expand All @@ -576,6 +589,7 @@ dataset_fields:
- field_name: citation
label: Citation
form_snippet: null
display_snippet: null
help_text: The full bibliographic citation of the dataset
groupBy: Supporting Metadata

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
def auscope_theme_hello():
return "Hello, auscope_theme!"


def is_creating_dataset():
"""Determine if the user is creating or managing a dataset."""
def is_creating_or_editing_dataset():
"""Determine if the user is creating or editing a dataset."""
current_path = toolkit.request.path
if current_path.startswith('/dataset/new'):
return True
elif "/dataset/edit/" in current_path:
return True
return False


Expand Down Expand Up @@ -50,7 +51,7 @@ def get_helpers():
def get_helpers():
return {
"auscope_theme_hello": auscope_theme_hello,
"is_creating_dataset" :is_creating_dataset,
"is_creating_or_editing_dataset" :is_creating_or_editing_dataset,
"get_search_facets" : get_search_facets,
'get_org_list': get_org_list,
'users_role_in_org': users_role_in_org,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def fetch_gcmd():
def fetch_epsg():
page = request.args.get('page', 0)
keywords = request.args.get('keywords', '')
external_url = f'https://apps.epsg.org/api/v1/CoordRefSystem/?includeDeprecated=false&pageSize=20&page={page}&keywords={keywords}'
external_url = f'https://apps.epsg.org/api/v1/CoordRefSystem/?includeDeprecated=false&pageSize=50&page={page}&keywords={keywords}'

response = requests.get(external_url)
if response.ok:
Expand Down
8 changes: 5 additions & 3 deletions ckan/src/ckanext-igsn-theme/ckanext/igsn_theme/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
def igsn_theme_hello():
return "Hello, igsn_theme!"

def is_creating_dataset():
"""Determine if the user is creating or managing a dataset."""
def is_creating_or_editing_dataset():
"""Determine if the user is creating or editing a dataset."""
current_path = toolkit.request.path
if current_path.startswith('/dataset/new'):
return True
elif "/dataset/edit/" in current_path:
return True
return False

def get_search_facets():
Expand All @@ -31,6 +33,6 @@ def get_search_facets():
def get_helpers():
return {
"igsn_theme_hello": igsn_theme_hello,
"is_creating_dataset" :is_creating_dataset,
"is_creating_or_editing_dataset" :is_creating_or_editing_dataset,
"get_search_facets" : get_search_facets
}
38 changes: 25 additions & 13 deletions ckan/src/shared/public/base/js/display-map-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,41 @@ ckan.module('display-map-module', function ($, _) {
},

setupMap: function () {
var pointLat = this.el.data('point-lat');
var pointLong = this.el.data('point-long');
var boundingBox = this.el.data('bounding-box');

if (pointLat && pointLong) {
this.initializeMapWithPoint(pointLat, pointLong);
} else if (boundingBox) {
var bboxValues = boundingBox.split(',').map(function (item) { return parseFloat(item.trim()); });
if (bboxValues.length === 4) {
this.initializeMapWithBoundingBox(bboxValues);
var allData = JSON.parse(this.el.attr('data-all-data'));
var locationChoice = allData['location_choice'];
var pointLat = allData['point_latitude'];
var pointLong = allData['point_longitude'];
var pointElevation = allData['elevation'];
var boundingBox = allData['bounding_box'];
console.log(allData)
if (locationChoice != null && locationChoice != "noLocation") {
$('#map-container').show();
$('#epsg-info').show();

if (locationChoice == "point") {
this.initializeMapWithPoint(pointLat, pointLong, pointElevation);
} else if (locationChoice == "area") {
var bboxValues = boundingBox.split(',').map(function (item) { return parseFloat(item.trim()); });
if (bboxValues.length === 4) {
this.initializeMapWithBoundingBox(bboxValues);
}
}
} else {
$('#location-info').text('Location not specified.');
}
},

initializeMapWithPoint: function (lat, lng) {
initializeMapWithPoint: function (lat, lng, elevation) {
var map = L.map('map-container').setView([lat, lng], 3);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>',
maxZoom: 19,
}).addTo(map);
L.marker([lat, lng]).addTo(map);

$('#location-info').text('Latitude: ' + lat + ', Longitude: ' + lng);
$('#location-info').text('Latitude: ' + lat + ', Longitude: ' + lng + ', Elevation: ' + elevation).attr('style', 'padding-top: 10px; font-size: small;');
$('#elevation-info').show();


},

Expand All @@ -51,7 +63,7 @@ ckan.module('display-map-module', function ($, _) {
var bounds = [[bbox[1], bbox[0]], [bbox[3], bbox[2]]];
L.rectangle(bounds).addTo(map);

$('#location-info').html('Bounding Box: ' + bbox.join(', '));
$('#location-info').html('Bounding Box: ' + bbox.join(', ')).attr('style', 'padding-top: 10px; font-size: small;');

}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ this.ckan.module('for-fields-handler-module', function ($, _) {
success: function (response) {
nextUrl = response.result.next;
var items = response.result.items.map(function (item) {
return { id: item._about, text: item.prefLabel._value };
return { id: item.notation, text: item.prefLabel._value };
});
nextPage = response.result.page + 1;

Expand Down
38 changes: 38 additions & 0 deletions ckan/src/shared/templates/package/read.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% ckan_extends %}
{% block package_description %}
{% if pkg.private %}
<span class="dataset-private badge badge-inverse pull-right">
<i class="fa fa-lock"></i>
{{ _('Private') }}
</span>
{% endif %}
<h1>
{% block page_heading %}
{{ h.dataset_display_name(pkg) }}
{% if pkg.state.startswith('draft') %}
[{{ _('Draft') }}]
{% endif %}
{% if pkg.state == 'deleted' %}
[{{ _('Deleted') }}]
{% endif %}
{% endblock %}
</h1>

{% block package_cite %}
{% if pkg.citation %}
<h2>{{ _('Cite this as') }}</h2>
<div class="citation embedded-content">
{{ h.render_markdown(h.get_translated(pkg, 'citation')) }}
</div>
{% endif %}
{% endblock %}

{% block package_notes %}
{% if pkg.notes %}
<div class="notes embedded-content">
{{ h.render_markdown(h.get_translated(pkg, 'notes')) }}
</div>
{% endif %}
{% endblock %}

{% endblock %}
4 changes: 4 additions & 0 deletions ckan/src/shared/templates/package/read_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% ckan_extends %}

{% block package_organization %}
{% endblock %}
6 changes: 3 additions & 3 deletions ckan/src/shared/templates/page.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% ckan_extends %}

{% set is_creating_dataset = h.is_creating_dataset() %}
{% set is_creating_or_editing_dataset = h.is_creating_or_editing_dataset() %}

{% block secondary %}
{% if not is_creating_dataset %}
{% if not is_creating_or_editing_dataset %}
<aside class="secondary col-md-3">
{#
The secondary_content block can be used to add content to the
Expand All @@ -23,7 +23,7 @@ <h2>A sidebar item</h2>
{% endblock %}

{% block primary %}
<div class="primary {% if is_creating_dataset %}col-md-12{% else %}col-md-9{% endif %} col-xs-12" role="main">
<div class="primary {% if is_creating_or_editing_dataset %}col-md-12{% else %}col-md-9{% endif %} col-xs-12" role="main">
{#
The primary_content block can be used to add content to the page.
This is the main block that is likely to be used within a template.
Expand Down
Loading

0 comments on commit 83a9a67

Please sign in to comment.