|
| 1 | +{% extends "package/resource_read.html" %} |
| 2 | + |
| 3 | +{%- set exclude_fields = [ |
| 4 | + 'name', |
| 5 | + 'description', |
| 6 | + 'url', |
| 7 | + 'format', |
| 8 | + ] -%} |
| 9 | +{%- set schema = h.scheming_get_dataset_schema(dataset_type) -%} |
| 10 | + |
| 11 | +{% block resource_additional_information_inner %} |
| 12 | + {% if res.attributes %} |
| 13 | + {% set res_attrs = h.resource_attributes(res.attributes) %} |
| 14 | + {% if res_attrs %} |
| 15 | + <div class="module-content"> |
| 16 | + <h2>{{ _('Data Dictionary') }}</h2> |
| 17 | + <table class="table table-bordered table-condensed data-dictionary-table" data-module="table-toggle-more"> |
| 18 | + <thead> |
| 19 | + {% block resouce_data_dictionary_headers %} |
| 20 | + <tr> |
| 21 | + <th scope="col">{{ _('Column') }}</th> |
| 22 | + <th scope="col">{{ _('Name') }}</th> |
| 23 | + <th scope="col">{{ _('Type') }}</th> |
| 24 | + <th scope="col">{{ _('Description') }}</th> |
| 25 | + <th scope="col">{{ _('Fixed Values') }}</th> |
| 26 | + </tr> |
| 27 | + {% endblock %} |
| 28 | + </thead> |
| 29 | + {% for attr in res_attrs %} |
| 30 | + <tr> |
| 31 | + <td>{{ attr.db_name }}</td> |
| 32 | + <td>{{ attr.name }}</td> |
| 33 | + <td>{{ attr.db_format }}</td> |
| 34 | + <td>{{ attr.definition }}</td> |
| 35 | + <td>{{ attr.fixed_values }}</td> |
| 36 | + </tr> |
| 37 | + {% endfor %} |
| 38 | + </table> |
| 39 | + </div> |
| 40 | + {% endif %} |
| 41 | + {% else %} |
| 42 | + {% if res.datastore_active %} |
| 43 | + {% block resource_data_dictionary %} |
| 44 | + {{ super() }} |
| 45 | + {% endblock %} |
| 46 | + {% endif %} |
| 47 | + {% endif %} |
| 48 | + |
| 49 | + <div class="module-content"> |
| 50 | + {%- block additional_info_heading -%}<h2>{{ _('Additional Information') }}</h2>{%- endblock -%} |
| 51 | + <table class="table table-striped table-bordered table-condensed" data-module="table-toggle-more"> |
| 52 | + {%- block additional_info_table_head -%} |
| 53 | + <thead> |
| 54 | + <tr> |
| 55 | + <th scope="col">{{ _('Field') }}</th> |
| 56 | + <th scope="col">{{ _('Value') }}</th> |
| 57 | + </tr> |
| 58 | + </thead> |
| 59 | + {%- endblock -%} |
| 60 | + <tbody> |
| 61 | + {%- block resource_last_updated -%} |
| 62 | + <tr> |
| 63 | + <th scope="row">{{ _('Data last updated') }}</th> |
| 64 | + <td>{{ h.render_datetime(res.last_modified) or h.render_datetime(res.created) or _('unknown') }}</td> |
| 65 | + </tr> |
| 66 | + {%- endblock -%} |
| 67 | + {%- block resource_metadata_last_updated -%} |
| 68 | + <tr> |
| 69 | + <th scope="row">{{ _('Metadata last updated') }}</th> |
| 70 | + <td>{{ h.render_datetime(res.metadata_modified) or h.render_datetime(res.created) or _('unknown') }}</td> |
| 71 | + </tr> |
| 72 | + {%- endblock -%} |
| 73 | + {%- block resource_created -%} |
| 74 | + <tr> |
| 75 | + <th scope="row">{{ _('Created') }}</th> |
| 76 | + <td>{{ h.render_datetime(res.created) or _('unknown') }}</td> |
| 77 | + </tr> |
| 78 | + {%- endblock -%} |
| 79 | + {%- block resource_format -%} |
| 80 | + <tr> |
| 81 | + <th scope="row">{{ _('Format') }}</th> |
| 82 | + <td>{{ res.format or res.mimetype_inner or res.mimetype or _('unknown') }}</td> |
| 83 | + </tr> |
| 84 | + {%- endblock -%} |
| 85 | + {%- block resource_license -%} |
| 86 | + <tr> |
| 87 | + <th scope="row">{{ _('License') }}</th> |
| 88 | + <td>{% snippet "snippets/license.html", pkg_dict=pkg, text_only=True %}</td> |
| 89 | + </tr> |
| 90 | + {%- endblock -%} |
| 91 | + {%- block resource_more_items -%} |
| 92 | + {% for key, value in h.format_resource_items(res.items()) %} |
| 93 | + {% if key not in ('created', 'metadata modified', 'last modified', 'format') %} |
| 94 | + <tr class="toggle-more"><th scope="row">{{ key | capitalize }}</th><td>{{ value }}</td></tr> |
| 95 | + {% endif %} |
| 96 | + {% endfor %} |
| 97 | + {%- endblock -%} |
| 98 | + {%- block resource_fields -%} |
| 99 | + {%- for field in schema.resource_fields -%} |
| 100 | + {%- if field.field_name not in exclude_fields |
| 101 | + and field.display_snippet is not none -%} |
| 102 | + <tr> |
| 103 | + <th scope="row"> |
| 104 | + {{- h.scheming_language_text(field.label) -}} |
| 105 | + </th> |
| 106 | + <td> |
| 107 | + {%- snippet 'scheming/snippets/display_field.html', |
| 108 | + field=field, data=res, entity_type='dataset', |
| 109 | + object_type=dataset_type -%} |
| 110 | + </td> |
| 111 | + </tr> |
| 112 | + {%- endif -%} |
| 113 | + {%- endfor -%} |
| 114 | + {%- endblock -%} |
| 115 | + </tbody> |
| 116 | + </table> |
| 117 | + |
| 118 | + |
| 119 | + </div> |
| 120 | +{% endblock %} |
0 commit comments