Skip to content

Commit

Permalink
[#1470] add full page view edit form option for use with dashboards etc
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Feb 6, 2014
1 parent 4c98742 commit 4e071a9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
10 changes: 9 additions & 1 deletion ckan/lib/helpers.py
Expand Up @@ -1685,11 +1685,18 @@ def resource_view_icon(resource_view):

def resource_view_display_preview(resource_view):
'''
Returns the icon for a particular view type.
Returns if the view should display a preview.
'''
view_plugin = datapreview.get_view_plugin(resource_view['view_type'])
return view_plugin.info().get('preview_enabled', True)

def resource_view_full_page(resource_view):
'''
Returns if the endit view page should be full page.
'''
view_plugin = datapreview.get_view_plugin(resource_view['view_type'])
return view_plugin.info().get('full_page_edit', False)

def resource_view_dimensions(resource_view):
'''
Returns the icon for a particular view type.
Expand Down Expand Up @@ -1913,6 +1920,7 @@ def check_config_permission(permission):
'resource_view_icon',
'resource_view_dimensions',
'resource_view_display_preview',
'resource_view_full_page',
'SI_number_span',
'localised_number',
'localised_SI_number',
Expand Down
1 change: 1 addition & 0 deletions ckan/logic/action/get.py
Expand Up @@ -922,6 +922,7 @@ def resource_view_show(context, data_dict):

resource_view = model.ResourceView.get(id)
if not resource_view:
_check_access('resource_view_show', context, data_dict)
raise NotFound

context['resource_view'] = resource_view
Expand Down
17 changes: 16 additions & 1 deletion ckan/templates/package/view_edit_base.html
Expand Up @@ -20,7 +20,16 @@
{% endblock %}

{% block main_content %}
{{ super() }}
{% if h.resource_view_full_page(resource_view) %}
{{ self.flash() }}
{{ self.toolbar() }}
<div class="wrapper no-nav">
{{ self.primary_content() }}
</div>
{% else %}
{{ super() }}
{% endif %}

{% if to_preview and h.resource_view_display_preview(resource_view) %}
<div class="wrapper no-nav">
<section class="module module-narrow module-shallow">
Expand All @@ -35,6 +44,12 @@ <h2 class="module-heading">
{% endif %}
{% endblock %}

{% block secondary %}
{% if not h.resource_view_full_page(resource_view) %}
{{ super() }}
{% endif %}
{% endblock %}

{% block secondary_content %}
{% snippet 'package/snippets/view_help.html' %}
{% endblock %}
4 changes: 1 addition & 3 deletions ckanext/imageview/plugin.py
Expand Up @@ -23,9 +23,7 @@ def info(self):
'title': 'Image',
'icon': 'picture',
'schema': {'image_url': [ignore_empty, unicode]},
'iframed': False,
'sizex': 3,
'sizey': 3}
'iframed': False}

def can_view(self, data_dict):
return True
Expand Down

0 comments on commit 4e071a9

Please sign in to comment.