From bd7dc4395e9ed901225fedad348b3bc08bc44962 Mon Sep 17 00:00:00 2001 From: Dave Kelsey Date: Tue, 18 Dec 2018 14:35:17 -0800 Subject: [PATCH] Batch of Fixes (#677) * Resolved error loading page and tidied up display of page * Added new values to vocabulary, as such vocabularies will need to be updated * Updated vocabulary, vocabs will have to be updated as such * Added missing js library so error doesn't occur calling function * Added "Purpose" to table with other values so they are all equal headings * Replaced 'fa-remove' with the proper font awesome alias 'fa-times' * Updated spelling * Added JS to force popover to activate in modal, also override of default bootstrap css so popover shows correctly in modal * Hijacked add data button when dataset is geographic and instead of moving the form forward, save the dataset and move to the edit resources page * Updated defaults for selecting dev_secure_call to be False rather than True since the feature should not be considered unless it's turned on in dev * Updated hardcoded storage location from 'BCGW DataStore' to 'BC Geographic Warehouse' on both creating OFI resource and the data import script * make api_url an ini property * fix tab issue on input screens * fix issue with chrome auto populate * better checking for chrome * changed the langauge on the error for a bad browser * shows the same unauthorized page as the datasets show for consistency * added modal dialog for permalink * changed the branch link in the package view to link to the organization page instead of a search page * add check for environment to activate snowplow --- ckanext/bcgov/controllers/organization.py | 37 ++++++++++-------- ckanext/bcgov/controllers/package.py | 8 ++-- ckanext/bcgov/controllers/user.py | 4 ++ ckanext/bcgov/fanstatic/edc_dataset.js | 31 +++++++++------ ckanext/bcgov/fanstatic/edc_dataset_view.css | 23 +++++++++++ ckanext/bcgov/fanstatic/edc_dataset_view.js | 17 ++++++++ ckanext/bcgov/fanstatic/edc_gov.js | 2 +- .../bcgov/fanstatic/edc_restrict_browser.js | 37 +++++++++++++++++- ckanext/bcgov/fanstatic/responsive.css | 6 +++ ckanext/bcgov/logic/ofi/call_action.py | 2 +- ckanext/bcgov/plugin.py | 2 + ckanext/bcgov/scripts/data/edc-vocabs.json | 5 ++- ckanext/bcgov/scripts/data_import.py | 4 +- ckanext/bcgov/templates/base.html | 39 +++++++++++++++++++ ckanext/bcgov/templates/ofi/ofi_modal.html | 4 +- .../ofi/snippets/geo_resource_form.html | 3 ++ .../bcgov/templates/organization/members.html | 2 +- .../templates/organization/read_base.html | 2 +- ckanext/bcgov/templates/package/read.html | 24 +++++++++++- .../package/snippets/additional_info.html | 34 ++++++++-------- .../templates/package/snippets/org_view.html | 2 +- .../package/snippets/package_form.html | 8 +++- .../snippets/package_metadata_fields.html | 4 +- .../package/snippets/resource_form.html | 1 + .../templates/snippets/organization.html | 2 + ckanext/bcgov/templates/user/dashboard.html | 4 +- ckanext/bcgov/util/helpers.py | 8 ++++ 27 files changed, 249 insertions(+), 66 deletions(-) create mode 100644 ckanext/bcgov/fanstatic/edc_dataset_view.css diff --git a/ckanext/bcgov/controllers/organization.py b/ckanext/bcgov/controllers/organization.py index e250e7dc..b9ba2b1a 100644 --- a/ckanext/bcgov/controllers/organization.py +++ b/ckanext/bcgov/controllers/organization.py @@ -86,6 +86,7 @@ def _read(self, id, limit, group_type='organization'): # Get the subgorgs of this org org_id = c.group_dict.get('id') + hide_desc = False q = c.q = request.params.get('q', '') @@ -97,7 +98,6 @@ def _read(self, id, limit, group_type='organization'): else: sort_by = request.params.get('sort', None) - suborgs = ['"' + org + '"' for org in get_suborgs(org_id)] if suborgs != []: q += ' owner_org:("' + org_id + '" OR ' + ' OR '.join(suborgs) + ')' @@ -303,31 +303,34 @@ def member_new(self, id): h.flash_error(e.error_summary) return render('organization/member_new.html', extra_vars={'errors': errors}) - def about(self, id): c.group_dict = self._get_group_dict(id) group_type = c.group_dict['type'] - - + context = {'model': model, 'session': model.Session, 'user': c.user or c.author, 'for_view': True, 'with_private': False} - + if c.userobj: context['user_id'] = c.userobj.id context['user_is_admin'] = c.userobj.sysadmin - - #Search_result list contains all orgs matched with search criteria including orgs and suborgs. - data_dict = {'all_fields': True} - search_result = self._action('organization_list')(context, data_dict) - - org_pkg_count_dict = {} - for org in search_result : - org_pkg_count_dict[org['id']] = org['packages'] - - c.org_pkg_count = org_pkg_count_dict - - c.group_dict['package_count'] = len(c.group_dict.get('packages', [])) + + org_id = c.group_dict.get('id') + q = c.q = request.params.get('q', '') + suborgs = ['"' + org + '"' for org in get_suborgs(org_id)] + if suborgs != []: + q += ' owner_org:("' + org_id + '" OR ' + ' OR '.join(suborgs) + ')' + else: + q += ' owner_org:"%s"' % org_id + + data_dict = { + 'q': q + } + + query = get_action('package_search')(context, data_dict) + + c.group_dict['package_count'] = query['count'] + self._setup_template_variables(context, {'id': id}, group_type=group_type) return render(self._about_template(group_type)) diff --git a/ckanext/bcgov/controllers/package.py b/ckanext/bcgov/controllers/package.py index 5ffecd28..c6690288 100644 --- a/ckanext/bcgov/controllers/package.py +++ b/ckanext/bcgov/controllers/package.py @@ -274,10 +274,12 @@ def new(self, data=None, errors=None, error_summary=None): if save_action == 'finish' and not is_an_update and package_type == 'Geographic': return self._new_dataset_only(package_type, data_dict, errors, error_summary) + elif save_action == 'add_data' and not is_an_update and package_type == 'Geographic': + return self._new_dataset_only(package_type, data_dict, errors, error_summary, 'resources') else: return super(EDCPackageController, self).new(data, errors, error_summary) - def _new_dataset_only(self, package_type, data_dict=None, errors=None, error_summary=None): + def _new_dataset_only(self, package_type, data_dict=None, errors=None, error_summary=None, redirect_link='dataset_read'): """ This method is for creating the actual dataset and redirecting to the read dataset without adding any resources @@ -317,7 +319,7 @@ def _new_dataset_only(self, package_type, data_dict=None, errors=None, error_sum log.info('`finish` save param included, skipping add data view, going to dataset read view.') - toolkit.redirect_to('dataset_read', id=pkg_dict['name']) + toolkit.redirect_to(redirect_link, id=pkg_dict['name']) except NotAuthorized: toolkit.abort(401, _('Unauthorized to read package %s') % '') @@ -723,7 +725,7 @@ def _setup_ofi(id, context=None, pkg_dict=None, open_modal=True): if 'type' in pkg_dict and pkg_dict[u'type'] == 'Geographic': ofi_config = edc_h.get_ofi_config() # dev_secure_call is for working around missing siteminer session, for vagrant use only - secure_call = toolkit.asbool(ofi_config.get('dev_secure_call', True)) + secure_call = toolkit.asbool(ofi_config.get('dev_secure_call', False)) ofi_resources = [] for resource in pkg_dict[u'resources']: diff --git a/ckanext/bcgov/controllers/user.py b/ckanext/bcgov/controllers/user.py index 5ad5cb02..bbe16bb0 100644 --- a/ckanext/bcgov/controllers/user.py +++ b/ckanext/bcgov/controllers/user.py @@ -62,6 +62,10 @@ def dashboard_datasets(self): def read(self, id=None): + + if c.userobj == None: + return render('package/auth_error.html') + if c.userobj and c.userobj.sysadmin == True: fq = '' else: diff --git a/ckanext/bcgov/fanstatic/edc_dataset.js b/ckanext/bcgov/fanstatic/edc_dataset.js index 741dcb85..24ed04b4 100644 --- a/ckanext/bcgov/fanstatic/edc_dataset.js +++ b/ckanext/bcgov/fanstatic/edc_dataset.js @@ -344,26 +344,33 @@ $(document).on('change', '.contact-org', function() { var org_id = $(this).val(); var branches = []; + var replace = false; for (var i = 0; i < contacts_org_branches.length; i++) { if (contacts_org_branches[i].id == org_id) { branches = contacts_org_branches[i].branches; + replace = true; break; } } - var options = ""; - for (var i = 0; i < branches.length; i++) { - options += ''; - } + console.log("hi"); - var container = $(this).closest('.control-group.contact'); - var id = container.attr('id').replace('contact_', ''); + if (replace) { + var container = $(this).closest('.control-group.contact'); + var id = container.attr('id').replace('contact_', ''); - $("#field-contacts-" + id + "-branch").find('option').remove().end().append(options); - $("#field-contacts-" + id + "-branch").select2({ - placeholder : "Select a sub-organization", - width : "220px" - }); + var options = ""; + for (var i = 0; i < branches.length; i++) { + options += ''; + } + + + $("#field-contacts-" + id + "-branch").find('option').remove().end().append(options); + $("#field-contacts-" + id + "-branch").select2({ + placeholder: "Select a sub-organization", + width: "220px" + }); + } }); @@ -394,7 +401,7 @@ $("#form-edc_dataset").submit(function( event ) { var previous_state; $("#field-edc_state").change(function() { - var selected_state = $("#field-edc_state").val() + var selected_state = $("#field-edc_state").val(); if (selected_state == "PENDING PUBLISH") { $("#state_confirm_dialog").dialog({ diff --git a/ckanext/bcgov/fanstatic/edc_dataset_view.css b/ckanext/bcgov/fanstatic/edc_dataset_view.css new file mode 100644 index 00000000..9836e883 --- /dev/null +++ b/ckanext/bcgov/fanstatic/edc_dataset_view.css @@ -0,0 +1,23 @@ +#permalinkModal div.modal-content{ + +} + +#permalinkLinkInput{ + width: 90%; + float: left; +} + +#permalinkDivContainer{ + height: 150px; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + + -ms-flex-align: center; + -webkit-align-items: center; + -webkit-box-align: center; + + align-items: center; + padding-left: 30px; +} + diff --git a/ckanext/bcgov/fanstatic/edc_dataset_view.js b/ckanext/bcgov/fanstatic/edc_dataset_view.js index 902861ef..1447511f 100644 --- a/ckanext/bcgov/fanstatic/edc_dataset_view.js +++ b/ckanext/bcgov/fanstatic/edc_dataset_view.js @@ -9,6 +9,23 @@ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); }); + + $('#permalinkLink').click(function(e){ + $('#permalinkModal').modal(); + $('#permalinkModal').show(); + e.preventDefault(); + e.stopPropagation(); + }); + + $('#permalinkModal span.close').click(function(e){ + $('#permalinkModal').hide(); + }); + + $('#copyPermalink').click(function(e) { + $('#permalinkLinkInput').select(); + document.execCommand("copy"); + $('#permalinkCopiedStatus').innerHTML = "Copied"; + }); }); /* $("#comment-submit").click(function() { diff --git a/ckanext/bcgov/fanstatic/edc_gov.js b/ckanext/bcgov/fanstatic/edc_gov.js index 42672438..142e9a25 100644 --- a/ckanext/bcgov/fanstatic/edc_gov.js +++ b/ckanext/bcgov/fanstatic/edc_gov.js @@ -193,7 +193,7 @@ $(document).ready(function(event) { }) //navigate menu with keyboard $(document).keydown(function(e) { - if($("#govNavMenu").is(":visible") && !$("#govNavMenu input").is(":focus")) { + if($("#header .navbar-toggle").is(":visible") && !$("#govNavMenu input").is(":focus")) { var currentItem= $("#govNavMenu :focus").closest("li"); switch(e.which) { case 9: //tab - close menu diff --git a/ckanext/bcgov/fanstatic/edc_restrict_browser.js b/ckanext/bcgov/fanstatic/edc_restrict_browser.js index 9813fe11..490b5e95 100644 --- a/ckanext/bcgov/fanstatic/edc_restrict_browser.js +++ b/ckanext/bcgov/fanstatic/edc_restrict_browser.js @@ -25,7 +25,40 @@ function isUsingSupportedBrowser() { var isFirefox = typeof InstallTrigger !== 'undefined'; // A global object inserted by Chrome - var isChrome = !!window.chrome && !!window.chrome.webstore; + var isChrome = false; + + + // please note, + // that IE11 now returns undefined again for window.chrome + // and new Opera 30 outputs true for window.chrome + // but needs to check if window.opr is not undefined + // and new IE Edge outputs to true now for window.chrome + // and if not iOS Chrome check + // so use the below updated condition + //as of Chrome 71 chrome no longer has the window.chrome.webstore that used to be the way this checked + //https://stackoverflow.com/a/13348618/9627526 has a continuously updated check + + var isChromium = window.chrome; + var winNav = window.navigator; + var vendorName = winNav.vendor; + var isOpera = typeof window.opr !== "undefined"; + var isIEedge = winNav.userAgent.indexOf("Edge") > -1; + var isIOSChrome = winNav.userAgent.match("CriOS"); + + if (isIOSChrome) { + // is Google Chrome on IOS + isChrome = false; + } else if( + isChromium !== null && + typeof isChromium !== "undefined" && + vendorName === "Google Inc." && + isOpera === false && + isIEedge === false + ) { + isChrome = true; + } else { + isChrome = false; + } if(isFirefox || isChrome) { return true; @@ -44,7 +77,7 @@ $(function() { $primaryDiv.html(''); // Insert a warning - var warningText = "You are attempting to update or edit Data Catalogue content with a non-supported web browser. Catalogue Editors must use either Google Chrome or Firefox when editing catalogue content. OCIO provides copies of these web browsers that can be downloaded and installed by all end users on government workstations in its Self-Serve Centre – or they may be obtained directly from https://www.google.com/chrome/ or https://www.mozilla.org/en-US/firefox/new/."; + var warningText = "You are attempting to update or edit BC Data Catalogue content using a non-supported web browser or version. Supported browsers are Google Chrome (downloadable from https://www.google.com/chrome/) and Firefox (downloadable from https://www.mozilla.org/en_US/firefox/new/). Not all version of these browsers are supported. If you are seeing this message and you are using Firefox or Chrome, then please report this problem to DataBC Catalogue Services."; var $warningDiv = $('
' + warningText + "
").addClass('alert alert-danger'); $primaryDiv.prepend($warningDiv); diff --git a/ckanext/bcgov/fanstatic/responsive.css b/ckanext/bcgov/fanstatic/responsive.css index c4f4c0fe..73dd068c 100644 --- a/ckanext/bcgov/fanstatic/responsive.css +++ b/ckanext/bcgov/fanstatic/responsive.css @@ -525,3 +525,9 @@ a:visited { display: none!important; } } + +/* This is a bit unrelated but it needed to be on a css file that's always loaded, overrides bootstrap defaults so popover works in modal */ +.popover { + position: fixed !important; + z-index: 1060 !important; +} \ No newline at end of file diff --git a/ckanext/bcgov/logic/ofi/call_action.py b/ckanext/bcgov/logic/ofi/call_action.py index 64a74764..17d1ca82 100644 --- a/ckanext/bcgov/logic/ofi/call_action.py +++ b/ckanext/bcgov/logic/ofi/call_action.py @@ -122,7 +122,7 @@ def populate_dataset_with_ofi(context, ofi_vars, ofi_resp): resource_meta = { u'package_id': pkg_dict['id'], u'resource_storage_access_method': u'Indirect Access', - u'resource_storage_location': u'BCGW DataStore', + u'resource_storage_location': u'BC Geographic Warehouse', u'projection_name': u'EPSG_3005 - NAD83 BC Albers', u'edc_resource_type': u'Data', u'ofi': True, diff --git a/ckanext/bcgov/plugin.py b/ckanext/bcgov/plugin.py index 63f6307b..2e271234 100644 --- a/ckanext/bcgov/plugin.py +++ b/ckanext/bcgov/plugin.py @@ -57,6 +57,7 @@ sort_vocab_list, debug_full_info_as_list, remove_user_link, + get_dashboard_config, get_ofi_config, get_ofi_resources, get_non_ofi_resources, @@ -128,6 +129,7 @@ def get_helpers(self): "sort_vocab_list": sort_vocab_list, "debug_full_info_as_list": debug_full_info_as_list, "remove_user_link": remove_user_link, + "get_dashboard_config": get_dashboard_config, "get_ofi_config": get_ofi_config, "get_ofi_resources": get_ofi_resources, "get_non_ofi_resources": get_non_ofi_resources, diff --git a/ckanext/bcgov/scripts/data/edc-vocabs.json b/ckanext/bcgov/scripts/data/edc-vocabs.json index f8fa7160..963e16a3 100755 --- a/ckanext/bcgov/scripts/data/edc-vocabs.json +++ b/ckanext/bcgov/scripts/data/edc-vocabs.json @@ -101,6 +101,7 @@ "tags" : [ "Public", "Government", + "Government and Business BCeID", "Named users" ] }, @@ -109,7 +110,9 @@ "tags" : [ "Public", "Government", - "Named users" + "Government and Business BCeID", + "Named users", + "Not downloadable" ] }, { diff --git a/ckanext/bcgov/scripts/data_import.py b/ckanext/bcgov/scripts/data_import.py index 10ab4eb8..91561edf 100644 --- a/ckanext/bcgov/scripts/data_import.py +++ b/ckanext/bcgov/scripts/data_import.py @@ -683,7 +683,7 @@ def import_odsi_records(con): if resource_url.startswith('http://pub.data.gov.bc.ca/datasets') : resource_rec['resource_storage_location'] = 'pub.data.gov.bc.ca' elif resource_url.startswith('https://apps.gov.bc.ca/pub/dwds') : - resource_rec['resource_storage_location'] = 'BCGW Data Store' + resource_rec['resource_storage_location'] = 'BC Geographic Warehouse' #----------------------------------------------------------< Resource Projection Name >-------------------------------------------------------------------- if edc_record.get('type') == 'Geographic': @@ -1180,7 +1180,7 @@ def save_discovery_records(con, discovery_data_filename): is_bcgw_record = False if storage_location and 'LRDW' in storage_location : - storage_location = "BCGW Data Store" + storage_location = "BC Geographic Warehouse" resource_rec['resource_storage_location'] = storage_location is_bcgw_record = True else : diff --git a/ckanext/bcgov/templates/base.html b/ckanext/bcgov/templates/base.html index 92d97513..5021726a 100644 --- a/ckanext/bcgov/templates/base.html +++ b/ckanext/bcgov/templates/base.html @@ -157,6 +157,45 @@ + {% if h.get_environment_name() != 'DLV' and h.get_environment_name() != 'TST' %} + + + + {% endif %} + {{ h.googleanalytics_header() }} diff --git a/ckanext/bcgov/templates/ofi/ofi_modal.html b/ckanext/bcgov/templates/ofi/ofi_modal.html index 4012ca62..f132f5e7 100644 --- a/ckanext/bcgov/templates/ofi/ofi_modal.html +++ b/ckanext/bcgov/templates/ofi/ofi_modal.html @@ -45,7 +45,7 @@

Object is available, would you like to add the resource link?

{% else %}
Object is not available, please contact your administrator.
@@ -66,7 +66,7 @@

Object is available, would you like to add the re {% elif pkg_obj_name != '' %} {% set content = ofi['content'] or false %} {# dev_secure_call is for vagrant use only, to workaround missing siteminer session #} - {% if content['allowed'] or h.asbool(ofi_config.get('dev_secure_call', true)) %} + {% if content['allowed'] or h.asbool(ofi_config.get('dev_secure_call', False)) %} {% endif %} {% endif %} diff --git a/ckanext/bcgov/templates/ofi/snippets/geo_resource_form.html b/ckanext/bcgov/templates/ofi/snippets/geo_resource_form.html index e47c7b0e..857ef808 100644 --- a/ckanext/bcgov/templates/ofi/snippets/geo_resource_form.html +++ b/ckanext/bcgov/templates/ofi/snippets/geo_resource_form.html @@ -73,4 +73,7 @@

Temporal Extent

classes=['control-medium']) }} + + + diff --git a/ckanext/bcgov/templates/organization/members.html b/ckanext/bcgov/templates/organization/members.html index a20f7f7d..38bebc2f 100644 --- a/ckanext/bcgov/templates/organization/members.html +++ b/ckanext/bcgov/templates/organization/members.html @@ -44,7 +44,7 @@

{{ _('{0} members'.format(c.members|length)) }}

- {% block delete_button_text %}{% endblock %} + {% block delete_button_text %}{% endblock %} {% endif %} diff --git a/ckanext/bcgov/templates/organization/read_base.html b/ckanext/bcgov/templates/organization/read_base.html index 0452152c..33c25d69 100644 --- a/ckanext/bcgov/templates/organization/read_base.html +++ b/ckanext/bcgov/templates/organization/read_base.html @@ -21,7 +21,7 @@ {% endblock %} {% block secondary_content %} - {% snippet 'snippets/organization.html', organization=c.group_dict, show_nums=true %} + {% snippet 'snippets/organization.html', organization=c.group_dict, show_nums=True, hide_desc=hide_desc %} {% block organization_facets %}{% endblock %} {% endblock %} diff --git a/ckanext/bcgov/templates/package/read.html b/ckanext/bcgov/templates/package/read.html index edb175cd..a6366c53 100644 --- a/ckanext/bcgov/templates/package/read.html +++ b/ckanext/bcgov/templates/package/read.html @@ -16,16 +16,36 @@ {% block content_primary_nav %} {{ super() }} + {% resource 'edc_resource/edc_dataset_view.css' %}
  • - Permalink
  • {#
  • RSS
  • #} + + + {% endblock %} @@ -160,4 +180,4 @@

    {% snippet 'snippets/edc_mow.html', pkg_obj_name=pkg.object_name, pkg_id=pkg.id, projections=c.ofi.projections %} {% endif %} {% endif %} -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/ckanext/bcgov/templates/package/snippets/additional_info.html b/ckanext/bcgov/templates/package/snippets/additional_info.html index 1c78244c..2a0461c6 100644 --- a/ckanext/bcgov/templates/package/snippets/additional_info.html +++ b/ckanext/bcgov/templates/package/snippets/additional_info.html @@ -1,24 +1,26 @@

    Additional Information

    {% block pakage_purpose %} - {% if pkg.purpose %} -

    Purpose

    -
    - {{ h.render_markdown(pkg.purpose) }} -
    - {% endif %} - - {% if pkg.type == "Geographic" or pkg.type == "Dataset" %} + {% if pkg.purpose or pkg.type == "Geographic" or pkg.type == "Dataset" %} - - - - + {% if pkg.purpose %} + + + + + {% endif %} + + {% if pkg.type == "Geographic" or pkg.type == "Dataset" %} + + + + - - - - + + + + + {% endif %}
    Data Quality{{ h.render_markdown(pkg.data_quality) }}
    Purpose{{ h.render_markdown(pkg.purpose) }}
    Data Quality{{ h.render_markdown(pkg.data_quality) }}
    Lineage Statement{{ h.render_markdown(pkg.lineage_statement) }}
    Lineage Statement{{ h.render_markdown(pkg.lineage_statement) }}
    {% endif %} {% endblock %} diff --git a/ckanext/bcgov/templates/package/snippets/org_view.html b/ckanext/bcgov/templates/package/snippets/org_view.html index 6929f735..bcc7c45c 100644 --- a/ckanext/bcgov/templates/package/snippets/org_view.html +++ b/ckanext/bcgov/templates/package/snippets/org_view.html @@ -16,4 +16,4 @@ {% set branch_title = branch.title %} {% set branch_name = branch.name %} {% endif %} -{{ org_title }}{% if branch_title and branch_name %} - {{ branch_title }} {% endif %} +{{ org_title }}{% if branch_title and branch_name %} - {{ branch_title }} {% endif %} diff --git a/ckanext/bcgov/templates/package/snippets/package_form.html b/ckanext/bcgov/templates/package/snippets/package_form.html index 5d9cf10f..506ac5cf 100644 --- a/ckanext/bcgov/templates/package/snippets/package_form.html +++ b/ckanext/bcgov/templates/package/snippets/package_form.html @@ -91,7 +91,11 @@ {% block form_actions_header %}
    + {% if dataset_type == 'Geographic' %} + + {% else %} + {% endif %}
    {% endblock %} @@ -143,8 +147,10 @@ {% endblock %} {% if dataset_type == 'Geographic' %} - {% endif %} + + {% else %} + {% endif %}
    {% endblock %} diff --git a/ckanext/bcgov/templates/package/snippets/package_metadata_fields.html b/ckanext/bcgov/templates/package/snippets/package_metadata_fields.html index 92b98e78..4b329820 100644 --- a/ckanext/bcgov/templates/package/snippets/package_metadata_fields.html +++ b/ckanext/bcgov/templates/package/snippets/package_metadata_fields.html @@ -28,7 +28,7 @@

    Preview Information

    {{ form.input('preview_latitude', label=_('Preview latitude'), id='field-preview_latitude', - placeholder=_('Map preview centriod latitude'), + placeholder=_('Map preview centroid latitude'), value=data.preview_latitude, error=errors.preview_latitude, classes=['control-medium']) }} @@ -36,7 +36,7 @@

    Preview Information

    {{ form.input('preview_longitude', label=_('Preview longitude'), id='field-preview_longitude', - placeholder=_('Map preview centriod longitude'), + placeholder=_('Map preview centroid longitude'), value=data.preview_longitude, error=errors.preview_longitude, classes=['control-medium']) }} diff --git a/ckanext/bcgov/templates/package/snippets/resource_form.html b/ckanext/bcgov/templates/package/snippets/resource_form.html index b57ef78b..95a8d9e9 100644 --- a/ckanext/bcgov/templates/package/snippets/resource_form.html +++ b/ckanext/bcgov/templates/package/snippets/resource_form.html @@ -7,6 +7,7 @@ {% resource 'edc_resource/edc_schema.css' %} {% resource 'edc_resource/edc-file-upload.js' %} +{% resource 'edc_resource/edc_dataset.js' %} {% set archived = (state == 'ARCHIVED') %}
    {% block stages %} diff --git a/ckanext/bcgov/templates/snippets/organization.html b/ckanext/bcgov/templates/snippets/organization.html index cc30a01a..76499704 100644 --- a/ckanext/bcgov/templates/snippets/organization.html +++ b/ckanext/bcgov/templates/snippets/organization.html @@ -28,6 +28,7 @@

    {{ _('Or {% endblock %}

    {{ organization.title or organization.name }}

    + {% if not hide_desc %} {% if organization.description %}

    {{ h.markdown_extract(organization.description, 180) }} @@ -36,6 +37,7 @@

    {{ organization.title or organization.name }}

    {% else %}

    {{ _('There is no description for this organization') }}

    {% endif %} + {% endif %} {% if organization.url %} Organization URL diff --git a/ckanext/bcgov/templates/user/dashboard.html b/ckanext/bcgov/templates/user/dashboard.html index d0cab064..c70e77b6 100644 --- a/ckanext/bcgov/templates/user/dashboard.html +++ b/ckanext/bcgov/templates/user/dashboard.html @@ -1,5 +1,7 @@ {% ckan_extends %} +{%- set dashboard_config = h.get_dashboard_config() -%} + {% block primary %}
    {% block page_header %} @@ -26,7 +28,7 @@ {% block primary_content_inner %}
    {# snippet 'user/snippets/followee_dropdown.html', context=c.dashboard_activity_stream_context, followees=c.followee_list #} - diff --git a/ckanext/bcgov/util/helpers.py b/ckanext/bcgov/util/helpers.py index 5dcedd4d..8440b88e 100644 --- a/ckanext/bcgov/util/helpers.py +++ b/ckanext/bcgov/util/helpers.py @@ -529,6 +529,14 @@ def get_namespace_config(namespace): if k.startswith(namespace)]) +def get_dashboard_config(): + ''' + Returns a dict with all configuration options related to the + Dashboard (ie those starting with 'bcgov.dashboard.') + ''' + return get_namespace_config('bcgov.dashboard.') + + def get_ofi_config(): ''' Returns a dict with all configuration options related to the