diff --git a/ckanext-hdx_package/ckanext/hdx_package/views/dataset.py b/ckanext-hdx_package/ckanext/hdx_package/views/dataset.py index e244a3724c..5f22b142d0 100644 --- a/ckanext-hdx_package/ckanext/hdx_package/views/dataset.py +++ b/ckanext-hdx_package/ckanext/hdx_package/views/dataset.py @@ -208,7 +208,7 @@ def read(id): dataset_preview_disabled_list = [] if _dataset_preview == vd._DATASET_PREVIEW_RESOURCE_ID: for r in view_enabled_resources: - if r.get('dataset_preview_enabled'): + if r.get('dataset_preview_enabled') in ['True', 'true', True]: dataset_preview_enabled_list.append(r) else: dataset_preview_disabled_list.append(r) diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/contribute_flow/contribute_flow_main.js b/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/contribute_flow/contribute_flow_main.js index 0bbc830f23..8344ec6921 100644 --- a/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/contribute_flow/contribute_flow_main.js +++ b/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/contribute_flow/contribute_flow_main.js @@ -427,19 +427,17 @@ var selectOptions = $('#field_dataset_preview_value').prop('options'); selectOptions[0] = new Option('Default (first resource with preview)', 'first_resource'); var i = 'first_resource'; - $.each(newOptions, function(index, value) { - var resName = value.get('name') ? value.get('name') : 'Resource '+(index+1); - if (value.get('dataset_preview_enabled') === true){ - selectOptions[selectOptions.length] = new Option(resName, index+'', true, true); - i = index+''; - } - else { - selectOptions[selectOptions.length] = new Option(resName, index+''); - } - }); + $.each(newOptions, function (index, value) { + var resName = value.get('name') ? value.get('name') : 'Resource ' + (index + 1); + if (value.get('dataset_preview_enabled') === true || value.get('dataset_preview_enabled') === 'True' || value.get('dataset_preview_enabled') === 'true') { + selectOptions[selectOptions.length] = new Option(resName, index + '', true, true); + i = index + ''; + } else { + selectOptions[selectOptions.length] = new Option(resName, index + ''); + } + }); $("#field_dataset_preview_value").val(i).trigger('change'); - }, 'generateResourcePostData': function() { var resourceModelList = this.resourceModelList.models;