Skip to content

Commit

Permalink
Updated recline view; Fixed a javascript error; Added code to support…
Browse files Browse the repository at this point in the history
… map configuration for both recline_view and recline_map_view
  • Loading branch information
Khalegh-H3 authored and jrods committed Aug 12, 2016
1 parent ce4c989 commit 0666e94
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ckanext/reclineview/plugin.py
Expand Up @@ -85,6 +85,8 @@ class ReclineView(ReclineViewBase):
This extension views resources using a Recline MultiView.
'''

p.implements(p.ITemplateHelpers, inherit=True)

def info(self):
return {'name': 'recline_view',
'title': 'Data Explorer',
Expand All @@ -106,6 +108,11 @@ def can_view(self, data_dict):
else:
return False

def get_helpers(self):
return {
'get_map_config': get_mapview_config
}


class ReclineGridView(ReclineViewBase):
'''
Expand Down
2 changes: 1 addition & 1 deletion ckanext/reclineview/theme/public/recline_view.js
Expand Up @@ -121,7 +121,7 @@ this.ckan.module('recline_view', function (jQuery, _) {
state.lonField = reclineView.longitude_field;
}

view = new ckan.MapView({model: dataset, state: state, mapConfig: map_config});
view = new ckan.MapView({model: dataset, state: state, mapConfig: this.options.map_config});
} else if(reclineView.view_type === "recline_view") {
view = this._newDataExplorer(dataset, this.options.map_config);
} else {
Expand Down
2 changes: 1 addition & 1 deletion ckanext/reclineview/theme/templates/recline_view.html
Expand Up @@ -2,7 +2,7 @@

{% block page %}

{% set map_config = h.get_mapview_config() %}
{% set map_config = h.get_map_config() or h.get_mapview_config() %}

This comment has been minimized.

Copy link
@miguelbgouveia

miguelbgouveia Sep 6, 2016

I get an error here. In my instance of ckan the h.get_mapview_config() is not recognized as a function. To resolve the problem I just deleted the "or h.get_mapview_config()" string and it work. I just not know if it is the best correction.

<div data-module="recline_view"
data-module-site_url="{{ h.dump_json(h.url('/', locale='default', qualified=true)) }}"
data-module-resource = "{{ h.dump_json(resource_json) }}";
Expand Down

1 comment on commit 0666e94

@miguelbgouveia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this commit add an error in viewing resources with csv format. This issue is register here: #3233

Please sign in to comment.