Skip to content

Commit

Permalink
[#1251] Update ckanext.imageview to work with new
Browse files Browse the repository at this point in the history
IResourceView changes.

Use 'view' instead of 'preview'.

Move 'form_template' to top level method.

If no image_url specified, try to view the resource url.
  • Loading branch information
johnglover committed Nov 4, 2013
1 parent 1db8d70 commit 0b930d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions ckanext/imageview/plugin.py
Expand Up @@ -20,14 +20,13 @@ def update_config(self, config):
def info(self):
return {'name': 'image',
'title': 'Image',
'schema': {'image_url': [ignore_empty, unicode]},
'form_template': 'image_form.html'}
'schema': {'image_url': [ignore_empty, unicode]}}

def can_preview(self, data_dict):
def can_view(self, data_dict):
return True

def setup_template_variables(self, context, data_dict):
return {'image_url': data_dict['resource_view']['image_url']}

def preview_template(self, context, data_dict):
def view_template(self, context, data_dict):
return 'image_view.html'

def form_template(self, context, data_dict):
return 'image_form.html'
2 changes: 1 addition & 1 deletion ckanext/imageview/theme/templates/image_view.html
@@ -1 +1 @@
<img src="{{image_url}}"></img>
<img src="{{resource_view.get('image_url') or resource.get('url')}}" />

0 comments on commit 0b930d1

Please sign in to comment.