This repository has been archived by the owner on Jan 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e948cc
commit 030bc2f
Showing
7 changed files
with
18,261 additions
and
41,824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.17.0 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% extends "package/base_form_page.html" %} | ||
|
||
{% set logged_in = true if c.userobj else false %} | ||
|
||
{% block subtitle %}{{ _('Add data to the dataset') }}{% endblock %} | ||
|
||
{% block breadcrumb_content_selected %}{% endblock %} | ||
{% block breadcrumb_content %} | ||
{{ super() }} | ||
{% if pkg %} | ||
<li class="active"><a href="#">{{ _('Add New Resource') }}</a></li> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block form %}{% snippet resource_form_snippet, data=data, errors=errors, error_summary=error_summary, include_metadata=false, pkg_name=pkg_name, stage=stage, dataset_type=dataset_type %}{% endblock %} | ||
|
||
{% block secondary_content %} | ||
{% snippet 'package/snippets/resource_help.html' %} | ||
{% endblock %} | ||
|
||
{% block scripts %} | ||
{{ super() }} | ||
{% asset 'vendor/fileupload' %} | ||
{% endblock %} |
46 changes: 46 additions & 0 deletions
46
ckanext/zarr/templates/package/snippets/resource_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{% ckan_extends %} | ||
|
||
{% set dataset = h.get_dataset_from_id(pkg_name) %} | ||
|
||
{% block basic_fields_url %} | ||
{% asset 'zarr/FileInputComponentStyles' %} | ||
<div | ||
id="FileInputComponent" | ||
data-lfsServer="{{ h.blob_storage_server_url() }}" | ||
data-maxResourceSize="{{ h.max_resource_size() }}" | ||
data-orgId="{{ dataset.organization.name }}" | ||
data-datasetName="{{ dataset.name }}" | ||
data-existingUrlType="{{ data.url_type if data else '' }}" | ||
data-existingUrl="{{ data.url if data else '' }}" | ||
data-existingSha256="{{ data.sha256 if data else '' }}" | ||
data-existingFileName="{{ h.blob_storage_resource_filename(data) if data else '' }}" | ||
data-existingSize="{{ data.size if data else '' }}" | ||
> | ||
{% if data.url %} | ||
{% if data.url_type == 'upload' %} | ||
<h3 class="text-muted"> | ||
<span><i class="fa fa-spinner fa-spin"></i> {{ _('Loading') }}</span> | ||
</h3> | ||
{% else %} | ||
<div> | ||
<label class="control-label">{{ _('URL')}}</label> | ||
<div class="input-group field-url-input-group"> | ||
<input | ||
type="text" | ||
placeholder="{{ _('Loading') }}..." | ||
class="form-control" | ||
/> | ||
<span class="input-group-btn"> | ||
<button class="btn btn-danger" type="button">{{ _('Remove') }}</button> | ||
</span> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% else %} | ||
<div class="dropzone text-muted"> | ||
<h3><i class="fa fa-spinner fa-spin"></i> {{ _('Loading') }}</h3> | ||
</div> | ||
{% endif %} | ||
</div> | ||
{% asset 'zarr/FileInputComponentScripts' %} | ||
{% endblock %} |
81 changes: 81 additions & 0 deletions
81
ckanext/zarr/templates/scheming/package/snippets/resource_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{% ckan_extends %} | ||
|
||
{% block basic_fields %} | ||
|
||
{% asset 'zarr/FileInputComponentStyles' %} | ||
{% set dataset = h.get_dataset_from_id(pkg_name) %} | ||
<div | ||
id="FileInputComponent" | ||
data-lfsServer="{{ h.blob_storage_server_url() }}" | ||
data-maxResourceSize="{{ h.max_resource_size() }}" | ||
data-orgId="{{ dataset.organization.name }}" | ||
data-datasetName="{{ dataset.name }}" | ||
data-existingUrlType="{{ data.url_type if data else '' }}" | ||
data-existingUrl="{{ data.url if data else '' }}" | ||
data-existingSha256="{{ data.sha256 if data else '' }}" | ||
data-existingFileName="{{ h.blob_storage_resource_filename(data) if data else '' }}" | ||
data-existingSize="{{ data.size if data else '' }}" | ||
> | ||
{% if data.url %} | ||
{% if data.url_type == 'upload' %} | ||
<h3 class="text-muted"> | ||
<span><i class="fa fa-spinner fa-spin"></i> {{ _('Loading') }}</span> | ||
</h3> | ||
{% else %} | ||
<div> | ||
<label class="control-label">{{ _('URL')}}</label> | ||
<div class="input-group field-url-input-group"> | ||
<input | ||
type="text" | ||
placeholder="{{ _('Loading') }}..." | ||
class="form-control" | ||
/> | ||
<span class="input-group-btn"> | ||
<button class="btn btn-danger" type="button">{{ _('Remove') }}</button> | ||
</span> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% else %} | ||
<div class="dropzone text-muted"> | ||
<h3><i class="fa fa-spinner fa-spin"></i> {{ _('Loading') }}</h3> | ||
</div> | ||
{% endif %} | ||
</div> | ||
{% asset 'zarr/FileInputComponentScripts' %} | ||
|
||
{%- if not dataset_type -%} | ||
<p> | ||
dataset_type not passed to template. your version of CKAN | ||
might not be compatible with ckanext-scheming | ||
</p> | ||
{%- endif -%} | ||
{%- set dataset = h.get_dataset_from_id(pkg_name, validate=True) -%} | ||
{%- set schema = h.scheming_get_dataset_schema(dataset_type) -%} | ||
{%- for field in schema.resource_fields -%} | ||
{%- if field.form_snippet is not none -%} | ||
{%- if field.field_name not in data %} | ||
{# Set the field default value before rendering but only if | ||
it doesn't already exist in data which would mean the form | ||
has been submitted. #} | ||
{% if field.default_jinja2 %} | ||
{% do data.__setitem__( | ||
field.field_name, | ||
h.scheming_render_from_string(field.default_jinja2)) %} | ||
{% elif field.default %} | ||
{% do data.__setitem__(field.field_name, field.default) %} | ||
{% endif %} | ||
{% endif -%} | ||
{%- snippet 'scheming/snippets/form_field.html', | ||
field=field, | ||
data=data, | ||
errors=errors, | ||
licenses=c.licenses, | ||
entity_type='dataset', | ||
object_type=dataset_type, | ||
dataset=dataset | ||
-%} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
|
||
{% endblock %} |