Skip to content

Commit

Permalink
Merge pull request #1 from psbothra/OD-441-Change-private-office-reso…
Browse files Browse the repository at this point in the history
…urce-view-message

OD-411 : Change private office resource view message
  • Loading branch information
jguo144 authored May 3, 2018
2 parents 23137ca + 56baa01 commit b017fc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ckanext/officedocs/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def info(self):
def setup_template_variables(self, context, data_dict):
from urllib import quote_plus
url = quote_plus(data_dict["resource"]["url"])
private_package = data_dict["package"]["private"]
return {
"resource_url": url
"resource_url": url,
"private_package": private_package
}

def can_view(self, data_dict):
Expand Down
4 changes: 4 additions & 0 deletions ckanext/officedocs/templates/officedocs/preview.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{% if private_package %}
<div style="text-align:center;">This resource view will render once the dataset is made public. Microsoft Office preview is unable to access and display private resources.</div>
{% else %}
<button id="fullscreeniframe" class="btn" style="position:absolute; right:5px; top:20px">Fullscreen</button>
<iframe id="cvframe" src="//view.officeapps.live.com/op/view.aspx?src={{resource_url}}" frameborder="0" allowfullscreen="" width="100%" height="400px"></iframe>
<script>
Expand Down Expand Up @@ -41,3 +44,4 @@
}, false);
})(this, this.document);
</script>
{% endif %}

0 comments on commit b017fc1

Please sign in to comment.