diff --git a/ckanext/reclineview/plugin.py b/ckanext/reclineview/plugin.py index d17ec967a35..6e3866647be 100644 --- a/ckanext/reclineview/plugin.py +++ b/ckanext/reclineview/plugin.py @@ -21,6 +21,12 @@ def get_mapview_config(): if k.startswith(namespace)]) +def get_dataproxy_url(): + ''' + Returns the value of the ckan.recline.dataproxy_url config option + ''' + return config.get('ckan.recline.dataproxy_url', '//jsonpdataproxy.appspot.com') + def in_list(list_possible_values): ''' Validator that checks that the input value is one of the given @@ -83,7 +89,8 @@ def view_template(self, context, data_dict): def get_helpers(self): return { - 'get_map_config': get_mapview_config + 'get_map_config': get_mapview_config, + 'get_dataproxy_url': get_dataproxy_url, } diff --git a/ckanext/reclineview/theme/public/recline_view.js b/ckanext/reclineview/theme/public/recline_view.js index 0aa873d0737..65a539d2b82 100644 --- a/ckanext/reclineview/theme/public/recline_view.js +++ b/ckanext/reclineview/theme/public/recline_view.js @@ -2,7 +2,8 @@ this.ckan.module('recline_view', function (jQuery) { return { options: { site_url: "", - controlsClassName: "controls" + controlsClassName: "controls", + dataproxyUrl: "//jsonpdataproxy.appspot.com" }, initialize: function () { @@ -44,6 +45,9 @@ this.ckan.module('recline_view', function (jQuery) { if (!resourceData.datastore_active) { recline.Backend.DataProxy.timeout = 10000; + + recline.Backend.DataProxy.dataproxy_url = this.options.dataproxyUrl; + resourceData.backend = 'dataproxy'; } else { resourceData.backend = 'ckan'; diff --git a/ckanext/reclineview/theme/templates/recline_view.html b/ckanext/reclineview/theme/templates/recline_view.html index 213a8382af6..1b9fe8f2f00 100644 --- a/ckanext/reclineview/theme/templates/recline_view.html +++ b/ckanext/reclineview/theme/templates/recline_view.html @@ -8,6 +8,7 @@ data-module-resource = "{{ h.dump_json(resource_json) }}"; data-module-resource-view = "{{ h.dump_json(resource_view_json) }}"; data-module-map_config= "{{ h.dump_json(map_config) }}"; + data-module-dataproxy-url= "{{ h.get_dataproxy_url() }}" >