Skip to content

Commit

Permalink
set styles for data preview
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Sep 24, 2012
1 parent fd7a3cc commit 1c3666b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ckan/public/base/javascript/modules/data-viewer.js
Expand Up @@ -26,7 +26,7 @@ this.ckan.module('data-viewer', function (jQuery) {
_recalibrate: function() {
// save reference to this to use in timeout
var that = this;
MIN_HEIGHT = 300;
MIN_HEIGHT = 400;

resizeTimer = setTimeout(function() {
var height = that.el.contents().find('body').get(0).scrollHeight;
Expand Down
16 changes: 16 additions & 0 deletions ckan/public/base/less/module.less
Expand Up @@ -174,3 +174,19 @@
.group-listing {
margin-left: -20px; // Same as .row
}

// PREVIEW

.ckanext-datapreview {
position: relative;
overflow: auto;

& > iframe {
min-height: 400px;
}
& > img {
max-height: 500px;
max-width: 100%;
overflow: hidden;
}
}
3 changes: 2 additions & 1 deletion ckan/templates/dataviewer/pdf.html
Expand Up @@ -150,8 +150,9 @@

{% block scripts %}
{{ super() }}
{% resource 'datapreview/pdf' %}

<script>
var pdfjs_workerSrc = "{{ h.urls_for_resource('datapreview/vendor/pdfjs/pdf.js')[0] }}";
</script>
{% resource 'datapreview/pdf' %}
{% endblock %}
4 changes: 2 additions & 2 deletions ckan/templates/dataviewer/snippets/data_preview.html
@@ -1,7 +1,7 @@
<div class="module-content" class="ckanext-datapreview">
<div class="module-content ckanext-datapreview">
{% if embed %}
{# images can be embedded directly #}
<img class="ckanext-datapreview-direct-embed" src="{{ resource_url }}"></img>
<img src="{{ resource_url }}"></img>
{% else %}
<iframe src="{{ resource_url }}" frameborder="0" width="100%" data-module="data-viewer">
<p>{{ _('Your browser does not support iframes.') }}</p>
Expand Down

0 comments on commit 1c3666b

Please sign in to comment.