Skip to content

Commit

Permalink
[ckan#1251] Update ckanext.imageview
Browse files Browse the repository at this point in the history
  • Loading branch information
johnglover committed Oct 31, 2013
1 parent e6ba1e9 commit 5737dcd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
16 changes: 4 additions & 12 deletions ckanext/imageview/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,15 @@
import ckan.plugins as p
from ckan.lib.navl.validators import ignore_empty

from ckan.common import json

log = logging.getLogger(__name__)

try:
import ckanext.resourceproxy.plugin as proxy
except ImportError:
pass

DEFAULT_IMAGE_FORMATS = ['png', 'jpeg', 'jpg', 'gif']


class ImageView(p.SingletonPlugin):
'''This extenstion makes views of images'''

p.implements(p.IConfigurable, inherit=True)
p.implements(p.IConfigurer, inherit=True)
p.implements(p.IResourceView, inherit=True)

def update_config(self, config):
Expand All @@ -27,14 +20,13 @@ def update_config(self, config):
def info(self):
return {'name': 'image',
'schema': {'image_url': [ignore_empty, unicode]},
'form_template': 'image_form.html'
}
'form_template': 'image_form.html'}

def can_preview(self, data_dict):
return True

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

def preview_template(self, context, data_dict):
return 'image.html'
return 'image_view.html'
1 change: 1 addition & 0 deletions ckanext/imageview/theme/templates/image_view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img src="{{image_url}}"></img>

0 comments on commit 5737dcd

Please sign in to comment.