From dcb042671c2056e547b9e30ac013143f3e8ac779 Mon Sep 17 00:00:00 2001 From: psbothra Date: Wed, 25 Apr 2018 17:09:23 +0530 Subject: [PATCH 1/3] Added the text for private datasets resource and hide the preview --- ckanext/officedocs/plugin.py | 4 +++- ckanext/officedocs/templates/officedocs/preview.html | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ckanext/officedocs/plugin.py b/ckanext/officedocs/plugin.py index e29dfab..685b3bb 100644 --- a/ckanext/officedocs/plugin.py +++ b/ckanext/officedocs/plugin.py @@ -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_visibility = data_dict["package"]["private"] return { - "resource_url": url + "resource_url": url, + "visibility": private_visibility } def can_view(self, data_dict): diff --git a/ckanext/officedocs/templates/officedocs/preview.html b/ckanext/officedocs/templates/officedocs/preview.html index b0ec6a7..e5ef481 100644 --- a/ckanext/officedocs/templates/officedocs/preview.html +++ b/ckanext/officedocs/templates/officedocs/preview.html @@ -1,3 +1,6 @@ +{% if visibility %} +
This resource view will render once the dataset is made public. Microsoft Office preview is unable to access and display private resources.
+{% else %} +{% endif %} \ No newline at end of file From cacb1a0020c0e13b9b7ff509db3859de3441ef70 Mon Sep 17 00:00:00 2001 From: psbothra Date: Wed, 2 May 2018 12:15:38 +0530 Subject: [PATCH 2/3] Renaming the variable --- ckanext/officedocs/plugin.py | 4 ++-- ckanext/officedocs/templates/officedocs/preview.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ckanext/officedocs/plugin.py b/ckanext/officedocs/plugin.py index 685b3bb..b61c2fb 100644 --- a/ckanext/officedocs/plugin.py +++ b/ckanext/officedocs/plugin.py @@ -24,10 +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_visibility = data_dict["package"]["private"] + private_package = data_dict["package"]["private"] return { "resource_url": url, - "visibility": private_visibility + "private_package": private_package } def can_view(self, data_dict): diff --git a/ckanext/officedocs/templates/officedocs/preview.html b/ckanext/officedocs/templates/officedocs/preview.html index e5ef481..599bd8e 100644 --- a/ckanext/officedocs/templates/officedocs/preview.html +++ b/ckanext/officedocs/templates/officedocs/preview.html @@ -1,4 +1,4 @@ -{% if visibility %} +{% if private_package %}
This resource view will render once the dataset is made public. Microsoft Office preview is unable to access and display private resources.
{% else %} From 56baa016e9b49679a8eb545b2b5ee9809cad5cbc Mon Sep 17 00:00:00 2001 From: psbothra Date: Thu, 3 May 2018 11:22:17 +0530 Subject: [PATCH 3/3] aligned the message in center --- ckanext/officedocs/templates/officedocs/preview.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/officedocs/templates/officedocs/preview.html b/ckanext/officedocs/templates/officedocs/preview.html index 599bd8e..c422bc1 100644 --- a/ckanext/officedocs/templates/officedocs/preview.html +++ b/ckanext/officedocs/templates/officedocs/preview.html @@ -1,5 +1,5 @@ {% if private_package %} -
This resource view will render once the dataset is made public. Microsoft Office preview is unable to access and display private resources.
+
This resource view will render once the dataset is made public. Microsoft Office preview is unable to access and display private resources.
{% else %}