Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
recline datapreview moved to extension
- Loading branch information
Showing
61 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from logging import getLogger | ||
|
||
import ckan.plugins as p | ||
import ckan.plugins.toolkit as toolkit | ||
|
||
log = getLogger(__name__) | ||
|
||
|
||
class ReclinePreview(p.SingletonPlugin): | ||
"""This extension previews resources using recline | ||
This extension implements two interfaces | ||
- ``IConfigurer`` allows to modify the configuration | ||
- ``IResourcePreview`` allows to add previews | ||
""" | ||
p.implements(p.IConfigurer, inherit=True) | ||
p.implements(p.IResourcePreview, inherit=True) | ||
|
||
def update_config(self, config): | ||
''' Set up the resource library, public directory and | ||
template directory for the preview | ||
''' | ||
toolkit.add_public_directory(config, 'theme/public') | ||
toolkit.add_template_directory(config, 'theme/templates') | ||
toolkit.add_resource('theme/public', 'ckanext-reclinepreview') | ||
|
||
def requires_same_orign(self, resource): | ||
return False | ||
|
||
def can_preview(self, resource): | ||
format_lower = resource['format'].lower() | ||
return format_lower in ['csv', 'xls', 'tsv'] | ||
|
||
def preview_template(self, context): | ||
return 'recline.html' |
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters