diff --git a/ckanext/cfpb_extrafields/fanstatic/ckan_overrides.css b/ckanext/cfpb_extrafields/fanstatic/ckan_overrides.css index a4529ae..814622a 100644 --- a/ckanext/cfpb_extrafields/fanstatic/ckan_overrides.css +++ b/ckanext/cfpb_extrafields/fanstatic/ckan_overrides.css @@ -361,6 +361,10 @@ input[type="button"].btn-block { } /* Footer */ +a.image, a.image:hover { + border: 0; + text-decoration: none; +} #creeper { width: 50px; @@ -425,6 +429,14 @@ a.add-new-snippet { width: auto; margin: 0; } +}/* IDEA: */ +@media (min-width: 768px) { + /* Home Page */ + .hero { + background: url("/home_backdrop.png"); + background-repeat: no-repeat; + background-size: 100% 100%; + } } .expandable__padded:hover, diff --git a/ckanext/cfpb_extrafields/fanstatic/datadict_stash.js b/ckanext/cfpb_extrafields/fanstatic/datadict_stash.js index f6915ba..6a3693f 100644 --- a/ckanext/cfpb_extrafields/fanstatic/datadict_stash.js +++ b/ckanext/cfpb_extrafields/fanstatic/datadict_stash.js @@ -5,6 +5,9 @@ $(function() { $('#resource_save').click( function() { $( "#datadict_stash" ).trigger( "click" ); }); + $('#resource_save_add').click( function() { + $( "#datadict_stash" ).trigger( "click" ); + }); $('#resource_create').click( function() { $( "#datadict_stash" ).trigger( "click" ); }); @@ -12,42 +15,44 @@ $(function() { /* stashes a hidden datadict that python processes during plugin's update */ ckan.module('datadict_stash', function ($, _) { - // A few jQuery helpers for exporting only + // A few jQuery helpers for exporting only jQuery.fn.pop = [].pop; jQuery.fn.shift = [].shift; + return { - initialize: function () { - $.proxyAll(this, /_on/); - this.el.on('click', this._onClick); + initialize: function () { + $.proxyAll(this, /_on/); + this.el.on('click', this._onClick); }, _onClick: function(event) { var $rows = $TABLE.find('tr:not(:hidden)'); var header_keys = []; var header_names=[]; //head var record = []; - + // Get the headers (add special header logic here) $($rows.shift()).find('th:not(:empty)').each(function () { header_keys.push($(this).text().toLowerCase()); header_names.push($(this).text()); }); - //header_names are the first element (and remain in an ordered array) + // header_names are the first element (and remain in an ordered array) record.push(header_names); record.push(header_keys); + // Turn all existing rows into a loopable array $rows.each(function () { var $td = $(this).find('td'); var h = {}; - + // Use the header_keys from earlier to name our hash keys header_keys.forEach(function (header_key, i) { - h[header_key] = $td.eq(i).text(); + h[header_key] = $td.eq(i).text(); }); - + record.push(h); }); - + // Output the result record = JSON.stringify(record); // python picks this up on submit diff --git a/ckanext/cfpb_extrafields/plugin.py b/ckanext/cfpb_extrafields/plugin.py index dc486be..6cbf61c 100644 --- a/ckanext/cfpb_extrafields/plugin.py +++ b/ckanext/cfpb_extrafields/plugin.py @@ -1,3 +1,4 @@ +from ckan.lib.helpers import flash_error import ckan.plugins as p import ckan.plugins.toolkit as tk import validators as v @@ -15,7 +16,7 @@ def create_relevant_governing_documents(): except tk.ObjectNotFound: data = {'name': 'relevant_governing_documents'} vocab = tk.get_action('vocabulary_create')(context, data) - for tag in opts.relevant_governing_documents(): + for tag in opts.relevant_governing_documents(): data = {'name': tag, 'vocabulary_id': vocab['id']} tk.get_action('tag_create')(context, data) @@ -60,7 +61,6 @@ def parse_resource_related_gist(data_related_items, resource_id): class ExampleIDatasetFormPlugin(p.SingletonPlugin, tk.DefaultDatasetForm): - # modify ckan behavior on changes/(saves/updates/deletes) to resources p.implements(p.IResourceController) def _which_check_keys_changed(self, old, new): @@ -75,30 +75,49 @@ def _redirect_to_edit_on_change(self, resource, field): def _delete_and_rebuild_datadict(self, resource): import json + import unicodedata + if 'datadict' in resource and 'id' in resource: - record = resource['datadict'] - resource.pop('datadict') - json_record = json.loads(record) + record = resource.pop('datadict') + + if record: + # Cleanse of errant unicode characters + record = unicodedata.normalize('NFKD', record).encode('ascii', 'ignore') + + try: + json_record = json.loads(record) + except ValueError as err: + # Invalid JSON, so don't remove old data + error_message = "Error saving data dictionary: {0}. Data was: {1}".format(err, record) + flash_error(error_message) + return + + try: + ds.delete_datastore_json(resource['id'], 'datadict') + # don't fail if the filter is bad! (e.g., title_colname doesn't exist) + except (tk.ObjectNotFound, tk.ValidationError), err: + # code review: write tests for this. + error_message = "Error saving data dictionary: {0}. Data was: {1}".format(e, record) + flash_error(error_message) + pass + try: - ds.delete_datastore_json(resource['id'], 'datadict') - # don't fail if the filter is bad! (e.g., title_colname doesn't exist) - except (tk.ObjectNotFound, tk.ValidationError), err: - # code review: write tests for this. - pass - ds.create_datastore(resource['id'], json_title='datadict', json_record=json_record) - return + ds.create_datastore(resource['id'], json_title='datadict', json_record=json_record) + except UnicodeEncodeError as err: + error_message = "Error saving data dictionary: {0}. Data was: {1}".format(e, record) + flash_error(error_message) # This function is a template/starter for a more fine-grained email-on-change functionality # than the default notification that CKAN provides. It is not currently used. def _email_on_change(self, context, resource, field): # if specified fields have changed notify the relevant people if self.changed[field]: - # print 'trigger email on change to '+field - # filter by dataset name? + # print 'trigger email on change to '+field + # filter by dataset name? followers = tk.get_action('dataset_follower_list')(context,{'id': resource['package_id']}) for f in followers: # filter by group? - # get email addresses + # get email addresses print tk.get_action('user_show')(context,{'id': f['id']})['email'] # send a notification of change by email @@ -111,24 +130,23 @@ def after_create(self, context, resource): # (so that users aren't forced to enter a confusing link). # some of that could be moved here if desired. return - + def before_update(self, context, current, resource): # note keys that have changed (current is old, resource is new) self._which_check_keys_changed(current, resource) if current.get('resource_type', '') == 'Data Dictionary' \ and resource.get('resource_type', '') == 'Data Dictionary': self._delete_and_rebuild_datadict(resource) - + def after_update(self, context, resource): ''' do things on field changes ''' # unfinished email trigger: # self._email_on_change(context,resource,'privacy_contains_pii') self._redirect_to_edit_on_change(resource, 'resource_type') - # reset monitored keys + # reset monitored keys for key in self.changed: self.changed[key] = False - return - + def before_delete(self, context, resource, resources): return def after_delete(self, context, resources): @@ -146,7 +164,7 @@ def get_helpers(self): 'options_legal_authority_for_collection': opts.legal_authority_for_collection, 'options_privacy_pia_title': opts.privacy_pia_title, 'options_privacy_sorn_number': opts.privacy_sorn_number, - 'tag_relevant_governing_documents': tag_relevant_governing_documents, + 'tag_relevant_governing_documents': tag_relevant_governing_documents, 'options_relevant_governing_documents': opts.relevant_governing_documents, 'options_content_periodicity': opts.content_periodicity, 'options_update_frequency': opts.update_frequency, @@ -165,12 +183,12 @@ def get_helpers(self): 'create_datastore':ds.create_datastore, 'get_unique_datastore_json':ds.get_unique_datastore_json, 'delete_datastore_json':ds.delete_datastore_json, - + 'parse_resource_related_gist': parse_resource_related_gist, 'github_api_url': github_api_url, } - + # the main extra fields update/show functionality p.implements(p.IDatasetForm) def _modify_package_schema(self, schema): @@ -225,7 +243,7 @@ def _modify_package_schema(self, schema): tk.get_converter('convert_to_extras')], 'content_temporal_range_end' : [v.end_after_start_validator, v.reasonable_date_validator, tk.get_validator('ignore_missing'), - tk.get_converter('convert_to_extras')], + tk.get_converter('convert_to_extras')], 'content_temporal_range_start' : [v.end_after_start_validator, v.reasonable_date_validator, tk.get_validator('ignore_missing'), tk.get_converter('convert_to_extras')], @@ -278,8 +296,8 @@ def _modify_package_schema(self, schema): 'resource_type' : [tk.get_validator('ignore_missing'),], 'storage_location' : [tk.get_validator('ignore_missing'),], 'storage_location_path' : [tk.get_validator('ignore_missing'),], - 'database_server' : [ tk.get_validator('ignore_missing'),], - 'database_name' : [ tk.get_validator('ignore_missing'),], + 'database_server' : [ tk.get_validator('ignore_missing'),], + 'database_name' : [ tk.get_validator('ignore_missing'),], 'database_schema' : [ tk.get_validator('ignore_missing'),], 'db_role_level_1' : [ tk.get_validator('ignore_missing'),], 'db_role_level_2' : [ tk.get_validator('ignore_missing'),], @@ -292,17 +310,17 @@ def _modify_package_schema(self, schema): 'db_role_level_9' : [ tk.get_validator('ignore_missing'),], }) return schema - + def create_package_schema(self): schema = super(ExampleIDatasetFormPlugin, self).create_package_schema() schema = self._modify_package_schema(schema) return schema - + def update_package_schema(self): schema = super(ExampleIDatasetFormPlugin, self).update_package_schema() schema = self._modify_package_schema(schema) return schema - + def show_package_schema(self): schema = super(ExampleIDatasetFormPlugin, self).show_package_schema() schema.update({ @@ -392,9 +410,9 @@ def show_package_schema(self): 'intake_date' : [tk.get_validator('ignore_missing'),], 'resource_type' : [ tk.get_validator('ignore_missing'),], 'storage_location' : [ tk.get_validator('ignore_missing'),], - 'storage_location_path' : [ tk.get_validator('ignore_missing'),], - 'database_server' : [ tk.get_validator('ignore_missing'),], - 'database_name' : [ tk.get_validator('ignore_missing'),], + 'storage_location_path' : [ tk.get_validator('ignore_missing'),], + 'database_server' : [ tk.get_validator('ignore_missing'),], + 'database_name' : [ tk.get_validator('ignore_missing'),], 'database_schema' : [ tk.get_validator('ignore_missing'),], 'db_role_level_1' : [ tk.get_validator('ignore_missing'),], 'db_role_level_2' : [ tk.get_validator('ignore_missing'),], @@ -415,18 +433,18 @@ def show_package_schema(self): tk.get_validator('ignore_missing')] }) return schema - + def is_fallback(self): # Return True to register this plugin as the default handler for # package types not handled by any other IDatasetForm plugin. return True - + def package_types(self): # This plugin doesn't handle any special package types, it just # registers itself as the default (above). return [] - + p.implements(p.IConfigurer) def update_config(self, config): # Add this plugin's templates dir to CKAN's extra_template_paths, so @@ -460,7 +478,7 @@ def _change_facets(self, facets_dict): facets_dict['res_type'] = p.toolkit._('Resource Types') facets_dict['res_format'] = p.toolkit._('Formats') return facets_dict - + # now return the same altered search facets for the dataset, group and organization page def dataset_facets(self, facets_dict, package_type): return self._change_facets(facets_dict) diff --git a/ckanext/cfpb_extrafields/public/home_backdrop.png b/ckanext/cfpb_extrafields/public/home_backdrop.png new file mode 100644 index 0000000..fc3597c Binary files /dev/null and b/ckanext/cfpb_extrafields/public/home_backdrop.png differ diff --git a/ckanext/cfpb_extrafields/templates/footer.html b/ckanext/cfpb_extrafields/templates/footer.html index 793096d..20a11c6 100644 --- a/ckanext/cfpb_extrafields/templates/footer.html +++ b/ckanext/cfpb_extrafields/templates/footer.html @@ -2,7 +2,7 @@ {% block footer_links_ckan %} {% set api_url = 'http://docs.ckan.org/en/{0}/api/'.format(g.ckan_doc_version) %} -
  • {{ _('CKAN API') }}
  • -
  • Data Team
  • +
  • {{ _('CKAN API') }}
  • +
  • Questions? Ask the Data Team
  • +
  • {% endblock %} - diff --git a/ckanext/cfpb_extrafields/templates/home/snippets/search.html b/ckanext/cfpb_extrafields/templates/home/snippets/search.html new file mode 100644 index 0000000..1633279 --- /dev/null +++ b/ckanext/cfpb_extrafields/templates/home/snippets/search.html @@ -0,0 +1,21 @@ +{% set tags = h.get_facet_items_dict('tags', limit=3) %} +{% set placeholder = _('E.g. mortgage') %} + + diff --git a/ckanext/cfpb_extrafields/templates/package/resource_read.html b/ckanext/cfpb_extrafields/templates/package/resource_read.html index a31a3bd..d036df7 100644 --- a/ckanext/cfpb_extrafields/templates/package/resource_read.html +++ b/ckanext/cfpb_extrafields/templates/package/resource_read.html @@ -31,7 +31,7 @@

    {{ h.resource_display_name(res) | truncate(50) }}

    {% if res.resource_type == 'Data Dictionary' %} {% snippet 'package/snippets/resource_type-specific/cfpb_extrafields_datadictionary.html',data=res,errors=errors,pkg_name=res.name,editable="false",location="description" %} {% endif %} - + {% endblock %} {% block data_preview %} @@ -94,25 +94,25 @@

    {{ h.resource_display_name(res) | truncate(50) }}

    - {% if res.resource_type %} + {% if res.resource_type %} {{ _("resource type") }} {{ res.resource_type }} {% endif %} - {% if res.database_server %} + {% if res.database_server %} - {{ _("resource type") }} + {{ _("database server") }} {{ res.database_server }} {% endif %} - {% if res.database_name %} + {% if res.database_name %} - {{ _("resource type") }} + {{ _("database name") }} {{ res.database_name }} {% endif %} - {% if res.database_schema %} + {% if res.database_schema %} {{ _("database schema") }} {{ res.database_schema }} @@ -133,13 +133,13 @@

    {{ h.resource_display_name(res) | truncate(50) }}

    {% endif %} - {% if res.approximate_total_size %} + {% if res.approximate_total_size %} {{ _("approximate total Size") }} {{ res.approximate_total_size }} {% endif %} - {% if res.intake_date %} + {% if res.intake_date %} {{ _("intake date") }} {{ res.intake_date }} @@ -159,8 +159,8 @@

    {{ h.resource_display_name(res) | truncate(50) }}

    - - {% if res.db_role_level_1 %} + + {% if res.db_role_level_1 %} @@ -169,46 +169,46 @@

    {{ h.resource_display_name(res) | truncate(50) }}

    - {% if res.db_role_level_1 %} + {% if res.db_role_level_1 %} {% endif %} - {% if res.db_role_level_2 %} + {% if res.db_role_level_2 %} {% endif %} - {% if res.db_role_level_3 %} + {% if res.db_role_level_3 %} {% endif %} - {% if res.db_role_level_4 %} + {% if res.db_role_level_4 %} {% endif %} - {% if res.db_role_level_5 %} + {% if res.db_role_level_5 %} {% endif %} - {% if res.db_role_level_6 %} + {% if res.db_role_level_6 %} {% endif %} - {% if res.db_role_level_7 %} + {% if res.db_role_level_7 %} {% endif %} - {% if res.db_role_level_8 %} + {% if res.db_role_level_8 %} {% endif %} - {% if res.db_role_level_9 %} + {% if res.db_role_level_9 %} {% endif %}
    {{ _("level 1") }} {{ res.db_role_level_1 }}
    {{ _("level 2") }} {{ res.db_role_level_2 }}
    {{ _("level 3") }} {{ res.db_role_level_3 }}
    {{ _("level 4") }} {{ res.db_role_level_4 }}
    {{ _("level 5") }} {{ res.db_role_level_5 }}
    {{ _("level 6") }} {{ res.db_role_level_6 }}
    {{ _("level 7") }} {{ res.db_role_level_7 }}
    {{ _("level 8") }} {{ res.db_role_level_8 }}
    {{ _("level 9") }} {{ res.db_role_level_9 }}
    {% endif %} - + @@ -223,11 +223,11 @@

    {% resource 'cfpb_extrafields/ace_setup.css' %} {% resource 'cfpb_extrafields/ace_setup.js' %} - - + + - + {% resource 'cfpb_extrafields/listrelated.js' %} - - - - - - + + + + + + - + {% endif %} {% block resource_view_content %} {% resource 'cfpb_extrafields/dataset-status.js' %} diff --git a/ckanext/cfpb_extrafields/templates/package/snippets/additional_info.html b/ckanext/cfpb_extrafields/templates/package/snippets/additional_info.html index b5867ff..513b8f5 100644 --- a/ckanext/cfpb_extrafields/templates/package/snippets/additional_info.html +++ b/ckanext/cfpb_extrafields/templates/package/snippets/additional_info.html @@ -22,14 +22,14 @@
    - {% if pkg_dict.also_known_as %} + {% if pkg_dict.also_known_as %} {% endif %} - {% if pkg_dict.source_names %} - + {% if pkg_dict.data_source_names %} + @@ -46,31 +46,31 @@ {% endif %} - {% if pkg_dict.content_periodicity %} + {% if pkg_dict.content_periodicity %} {% endif %} - {% if pkg_dict.content_spatial %} + {% if pkg_dict.content_spatial %} {% endif %} - {% if pkg_dict.update_frequency %} + {% if pkg_dict.update_frequency %} {% endif %} - {% if pkg_dict.wiki_link %} + {% if pkg_dict.wiki_link %} {% endif %} - {% if pkg_dict.website_url %} + {% if pkg_dict.website_url %} @@ -101,18 +101,18 @@
    {{ _("also known as") }} {{ h.render_markdown(pkg_dict.also_known_as) }}
    {{ _("data source(s)") }} {{ pkg_dict.data_source_names }}
    {{ pkg_dict.content_temporal_range_end }}
    {{ _("content: periodicity") }} {{ pkg_dict.content_periodicity }}
    {{ _("content: spatial coverage") }} {% for i in h.clean_select_multi(pkg_dict.content_spatial) %} {{i}}; {% endfor %}
    {{ _("update frequency") }} {{ pkg_dict.update_frequency }}
    {{ _("wiki link") }} CFPB wiki article
    {{ _("reference website URL") }} {{ pkg_dict.website_name}}
    {% if pkg_dict.contact_primary_name %} - + {% endif %} {% if pkg_dict.contact_secondary_name %} - + {% endif %} - {% if pkg_dict.access_notes %} + {% if pkg_dict.access_notes %} @@ -155,48 +155,48 @@
    {{ _("contact: primary") }} {{pkg_dict.contact_primary_name}}
    {{ _("contact: secondary") }} {{pkg_dict.contact_secondary_name}}
    {{ _("how to get access") }} {{ h.render_markdown(pkg_dict.access_notes) }}
    {% if pkg_dict.id %} - + {% endif %} - {% if pkg_dict.dataset_notes %} + {% if pkg_dict.dataset_notes %} {% endif %} - {% if pkg_dict.dataset_last_modified_date %} + {% if pkg_dict.dataset_last_modified_date %} {% endif %} - {% if pkg_dict.obfuscated_title %} + {% if pkg_dict.obfuscated_title %} {% endif %} - {% if pkg_dict.transfer_details %} + {% if pkg_dict.transfer_details %} {% endif %} - {% if pkg_dict.transfer_initial_size %} + {% if pkg_dict.transfer_initial_size %} {% endif %} - {% if pkg_dict.transfer_method %} + {% if pkg_dict.transfer_method %} {% endif %} - +
    {{ _("dataset ID") }} {{ pkg_dict.id }}
    {{ _("dataset notes") }} {{ h.render_markdown(pkg_dict.dataset_notes) }}
    {{ _("dataset last modified date") }} {{ pkg_dict.dataset_last_modified_date }}
    {{ _("obfuscated title") }} {{ pkg_dict.obfuscated_title }}
    {{ _("transfer details") }} {{ h.render_markdown(pkg_dict.transfer_details) }}
    {{ _("transfer: initial size") }} {{ pkg_dict.transfer_initial_size }}
    {{ _("transfer: method") }} {{ h.render_markdown(pkg_dict.transfer_method) }}
    @@ -228,42 +228,42 @@ {% endif %} {% if pkg_dict.legal_authority_for_collection %} - + {{ _("legal authority for collection") }} {% for i in h.clean_select_multi(pkg_dict.legal_authority_for_collection) %} {{i}}; {% endfor %} {% endif %} {% if pkg_dict.relevant_governing_documents %} - + {{ _("relevant governing documents") }} {% for i in pkg_dict.relevant_governing_documents %} {{i}}; {% endfor %} {% endif %} {% if pkg_dict.dig_id %} - + {{ _("DIG ID") }} {{ pkg_dict.dig_id }} {% endif %} {% if pkg_dict.initial_purpose_for_intake %} - + {{ _("initial purpose for intake") }} {{ h.render_markdown(pkg_dict.initial_purpose_for_intake) }} {% endif %} - {% if pkg_dict.pra_exclusion %} + {% if pkg_dict.pra_exclusion %} {{ _("PRA exclusion") }} {{ pkg_dict.pra_exclusion }} {% endif %} {% if pkg_dict.pra_omb_control_number %} - + {{ _("PRA OMB control number") }} {{ pkg_dict.pra_omb_control_number }} {% endif %} - {% if pkg_dict.pra_omb_expiration_date %} + {% if pkg_dict.pra_omb_expiration_date %} {{ _("PRA: OMB expiration date") }} {{ pkg_dict.pra_omb_expiration_date }} @@ -275,55 +275,55 @@ {{ pkg_dict.privacy_contains_pii}} {% endif %} - {% if pkg_dict.privacy_has_direct_identifiers %} + {% if pkg_dict.privacy_has_direct_identifiers %} {{ _("privacy: has direct identifiers") }} {{ pkg_dict.privacy_has_direct_identifiers }} {% endif %} - {% if pkg_dict.privacy_has_privacy_act_statement %} + {% if pkg_dict.privacy_has_privacy_act_statement %} {{ _("privacy: has Privacy Act statement") }} {{ pkg_dict.privacy_has_privacy_act_statement }} {% endif %} {% if pkg_dict.privacy_pia_title %} - + {{ _("privacy: PIA title") }} {% for i in h.clean_select_multi(pkg_dict.privacy_pia_title) %} {{i}}; {% endfor %} {% endif %} - {% if pkg_dict.privacy_pia_notes %} + {% if pkg_dict.privacy_pia_notes %} {{ _("privacy: PIA notes") }} {{ pkg_dict.privacy_pia_notes }} {% endif %} {% if pkg_dict.privacy_sorn_number %} - + {{ _("privacy: SORN number") }} {% for i in h.clean_select_multi(pkg_dict.privacy_sorn_number) %} {{i}}; {% endfor %} {% endif %} - {% if pkg_dict.records_retention_schedule %} + {% if pkg_dict.records_retention_schedule %} {{ _("records retention schedule") }} {{ h.render_markdown(pkg_dict.records_retention_schedule) }} {% endif %} - {% if pkg_dict.procurement_document_id %} + {% if pkg_dict.procurement_document_id %} {{ _("procurement document ID") }} {{ pkg_dict.procurement_document_id }} {% endif %} - {% if pkg_dict.cleansing_rules_used %} + {% if pkg_dict.cleansing_rules_used and false %} {{ _("cleansing rules used") }} {{ h.render_markdown(pkg_dict.cleansing_rules_used) }} {% endif %} - + diff --git a/ckanext/cfpb_extrafields/templates/package/snippets/package_metadata_fields.html b/ckanext/cfpb_extrafields/templates/package/snippets/package_metadata_fields.html index 29da62c..b0b61b2 100644 --- a/ckanext/cfpb_extrafields/templates/package/snippets/package_metadata_fields.html +++ b/ckanext/cfpb_extrafields/templates/package/snippets/package_metadata_fields.html @@ -11,7 +11,7 @@

    I. Content

    -{{ form.markdown('also_known_as', id='field-also_known_as', +{{ form.markdown('also_known_as', id='field-also_known_as', label=_('also known as'), placeholder=_(''), value=data.also_known_as, error=errors.also_known_as) }}
    @@ -29,10 +29,10 @@

    I. Content

    {{ form.select('content_periodicity', label=_('content periodicity'), id='field-content_periodicity', options=h.options_content_periodicity(), selected=data.content_periodicity, error=errors.content_periodicity, classes=['control-medium']) }} {{ form.input('content_spatial', label=_("content: spatial coverage"), placeholder="e.g., continental USA", value=data.content_spatial, error=errors.content_spatial) }} -{#{ form_custom.select_multi_with_other('content_spatial', -label=_('content: spatial coverage'), -current_values=h.clean_select_multi(data.get('content_spatial', '')), -options_defaults=h.options_content_spatial(), +{#{ form_custom.select_multi_with_other('content_spatial', +label=_('content: spatial coverage'), +current_values=h.clean_select_multi(data.get('content_spatial', '')), +options_defaults=h.options_content_spatial(), error=errors.content_spatial, ) }#} @@ -49,7 +49,7 @@

    I. Content


    II. Access

    - +
    {% call form.input_block("field-contact_primary_name",_("primary contact"), error="", is_required=true) %} {# this is just for clicking #} @@ -71,7 +71,7 @@

    II. Access

    -{{ form.markdown('usage_restrictions', id='field-usage_restrictions', +{{ form.markdown('usage_restrictions', id='field-usage_restrictions', label=_('usage restrictions'), placeholder=_(''), value=data.usage_restrictions, error=errors.usage_restrictions) }}
    @@ -81,11 +81,13 @@

    III. Administrative

    {{ form.markdown('dataset_notes', id='field-dataset_notes', label=_('dataset notes'), placeholder=_(''), value=data.dataset_notes, error=errors.dataset_notes) }} -{{ form_custom.radio('obfuscated_title', +{{ form.input('dataset_last_modified_date', type='date', label=_("dataset last modified date"), placeholder="eg 2012-12-21", value=data.dataset_last_modified_date, error=errors.dataset_last_modified_date) }} + +{{ form_custom.radio('obfuscated_title', label=_('obfuscated title'), current_value=data.obfuscated_title)}} -{{ form.markdown('transfer_details', id='field-transfer_details', +{{ form.markdown('transfer_details', id='field-transfer_details', label=_('transfer details'), placeholder=_('enter text'), value=data.transfer_details, error=errors.transfer_details) }} {{ form.input('transfer_initial_size', label=_("transfer initial size (mb)"), placeholder="eg 1.2", value=data.transfer_initial_size, error=errors.transfer_initial_size) }} @@ -107,12 +109,12 @@

    IV. Compliance

    document.getElementById('field-sensitivity_level').parentNode.insertAdjacentHTML("beforeend",b); - +
    -{{ form_custom.select_multi_with_other('legal_authority_for_collection', -label=_('legal authority for collection'), -current_values=h.clean_select_multi(data.get('legal_authority_for_collection', '')), -options_defaults=h.options_legal_authority_for_collection(), +{{ form_custom.select_multi_with_other('legal_authority_for_collection', +label=_('legal authority for collection'), +current_values=h.clean_select_multi(data.get('legal_authority_for_collection', '')), +options_defaults=h.options_legal_authority_for_collection(), error=errors.legal_authority_for_collection, ) }}
    @@ -139,10 +141,10 @@

    IV. Compliance

    {{ form.markdown('initial_purpose_for_intake', id='field-initial_purpose_for_intake', label=_('initial purpose for intake'), placeholder=_(''), value=data.initial_purpose_for_intake, error=errors.initial_purpose_for_intake) }}
    -{{ form_custom.select_one_with_other('pra_exclusion', -label=_('PRA exclusion'), -current_value=data.get('pra_exclusion', ''), -options_defaults=h.options_pra_exclusion(), +{{ form_custom.select_one_with_other('pra_exclusion', +label=_('PRA exclusion'), +current_value=data.get('pra_exclusion', ''), +options_defaults=h.options_pra_exclusion(), error=errors.pra_exclusion,) }}
    @@ -162,44 +164,43 @@

    IV. Compliance

    label=_('privacy: has direct identifiers?'), current_value=data.privacy_has_direct_identifiers)}} -{{ form_custom.radio('privacy_has_privacy_act_statement', +{{ form_custom.radio('privacy_has_privacy_act_statement', label=_('privacy: has Privacy Act statement'), current_value=data.privacy_has_privacy_act_statement)}}
    -{{ form_custom.select_multi_with_other('privacy_pia_title', -label=_('privacy: PIA title'), -current_values=h.clean_select_multi(data.get('privacy_pia_title', '')), -options_defaults=h.options_privacy_pia_title(), +{{ form_custom.select_multi_with_other('privacy_pia_title', +label=_('privacy: PIA title'), +current_values=h.clean_select_multi(data.get('privacy_pia_title', '')), +options_defaults=h.options_privacy_pia_title(), error=errors.privacy_pia_title, size="550", ) }}
    -{{ form_custom.select_one_with_other('privacy_pia_notes', -label=_('privacy: PIA notes'), -current_value=data.get('privacy_pia_notes', ''), -options_defaults=h.options_privacy_pia_notes(), +{{ form_custom.select_one_with_other('privacy_pia_notes', +label=_('privacy: PIA notes'), +current_value=data.get('privacy_pia_notes', ''), +options_defaults=h.options_privacy_pia_notes(), error=errors.privacy_pia_notes,) }}
    -{{ form_custom.select_multi_with_other('privacy_sorn_number', -label=_('privacy: SORN number'), -current_values=h.clean_select_multi(data.get('privacy_sorn_number', '')), -options_defaults=h.options_privacy_sorn_number(), +{{ form_custom.select_multi_with_other('privacy_sorn_number', +label=_('privacy: SORN number'), +current_values=h.clean_select_multi(data.get('privacy_sorn_number', '')), +options_defaults=h.options_privacy_sorn_number(), error=errors.privacy_sorn_number, size="550", ) }}
    -{{ form.input('dataset_last_modified_date', type='date', label=_("dataset last modified date"), placeholder="eg 2012-12-21", value=data.dataset_last_modified_date, error=errors.dataset_last_modified_date) }} - {{ form.markdown('records_retention_schedule', id='field-records_retention_schedule', label=_('records retention schedule'), placeholder=_(''), value=data.records_retention_schedule, error=errors.records_retention_schedule) }} {{ form.input('procurement_document_id', label=_("procurement document ID"), placeholder="CFPB-12-Z-00015-0011", value=data.procurement_document_id, error=errors.procurement_document_id) }} +{% if false %} {{ form.markdown('cleansing_rules_used', id='field-cleansing_rules_used', label=_('cleansing rules used'), placeholder=_(''), value=data.cleansing_rules_used, error=errors.cleansing_rules_used) }} - +{% endif %} {% endblock %} @@ -213,5 +214,3 @@

    IV. Compliance

    {% endblock %} {% block package_metadata_fields_custom %} {% endblock %} - - diff --git a/ckanext/cfpb_extrafields/templates/package/snippets/resource_form.html b/ckanext/cfpb_extrafields/templates/package/snippets/resource_form.html index 0551a42..b9d05af 100644 --- a/ckanext/cfpb_extrafields/templates/package/snippets/resource_form.html +++ b/ckanext/cfpb_extrafields/templates/package/snippets/resource_form.html @@ -3,7 +3,7 @@ {% resource 'cfpb_extrafields/resource_type_select.js' %} - {% resource 'cfpb_extrafields/new_resource_redirect.js' %} - + {% endblock %} {% block basic_fields_description %} @@ -63,7 +63,7 @@ {% endblock %} {% endblock basic_fields %} - + {% block metadata_fields %} {% resource 'cfpb_extrafields/otherspecify.js' %} {% resource 'cfpb_extrafields/popover.js' %} @@ -83,7 +83,7 @@ {% elif data.resource_type == 'Data File' -%} {% snippet 'package/snippets/resource_type-specific/cfpb_extrafields_datafile.html',data=data,errors=errors,pkg_name=pkg_name,location="form" %} - + {% elif data.resource_type == 'Documentation' or data.resource_type == 'Report' -%} {% snippet 'package/snippets/resource_type-specific/cfpb_extrafields_documentation.html',data=data,errors=errors,pkg_name=pkg_name,location="form" %} @@ -92,10 +92,10 @@

    Error: Undefined Resource Type

    {% endif %}{# specific resource_type #} {% endif %}{# resource_type selected? #} {% endblock %} - +
    - + {% block delete_button %} {% if data.id %} {% if h.check_access('resource_delete', {'id': data.id}) %} @@ -109,10 +109,10 @@

    Error: Undefined Resource Type

    {% endblock %} {% block again_button %} - + {% endblock %} {% block save_button %} - + {% endblock %} {% else %} {% block add_button %} diff --git a/ckanext/cfpb_extrafields/templates/package/snippets/resource_type-specific/cfpb_extrafields_datadictionary.html b/ckanext/cfpb_extrafields/templates/package/snippets/resource_type-specific/cfpb_extrafields_datadictionary.html index a3684c5..7a8ead8 100644 --- a/ckanext/cfpb_extrafields/templates/package/snippets/resource_type-specific/cfpb_extrafields_datadictionary.html +++ b/ckanext/cfpb_extrafields/templates/package/snippets/resource_type-specific/cfpb_extrafields_datadictionary.html @@ -14,23 +14,23 @@ {% else %} {{ form.hidden('url', value=" optional URL or click (X) to upload a file")}} {% endif %} - +
    - {{ form.markdown('description', id='field-description', label=_('description'), + {{ form.markdown('description', id='field-description', label=_('description'), placeholder=_('URL to a related resource or other notes about the data dictionary'), value=data.description, error=errors.description) }}
    - + {% endif %} - + {% if location=="form" or location=="description" %} - + {% resource 'cfpb_extrafields/datadict_setup.css' %} {% resource 'cfpb_extrafields/datadict_setup.js' %} {% resource 'cfpb_extrafields/datadict_stash.js' %} @@ -48,14 +48,14 @@ {% set nkeys = range(dd[1]|length) %} {% set nrows = dd|length-2 %} -
    +
    {% if editable == "true" %} {% endif %} {% for item in header_names %} - + {% endfor %} {% if editable == "true" %} @@ -65,8 +65,8 @@ {% for irow in range(2,nrows+2) %} {% for i in nkeys %} - {% set key = header_keys[i]%} - + {% set key = header_keys[i] %} + {% endfor %} {% if editable == "true" %}
    {{ item }}
    {{ item }}
    {{ dd[irow][key] }}
    {{ dd[irow][key] }}
    @@ -97,7 +97,7 @@