diff --git a/ckanext/odsh/helpers.py b/ckanext/odsh/helpers.py index ab4ac4000e001f24f49f34b96d4aa00b71b32812..8ca47d1db0fd4a8d7dd00975a003c47a3fa23539 100644 --- a/ckanext/odsh/helpers.py +++ b/ckanext/odsh/helpers.py @@ -9,6 +9,7 @@ from ckan.common import c import datetime from dateutil import parser from ckan.common import config +import urllib get_action = logic.get_action log = logging.getLogger(__name__) @@ -103,4 +104,7 @@ def odsh_render_datetime(datetime_, date_format='{0.day:02d}.{0.month:02d}.{0.ye def odsh_upload_known_formats(): value = config.get('ckanext.odsh.upload_formats', []) value = toolkit.aslist(value) - return value \ No newline at end of file + return value + +def odsh_encodeurl(url): + return urllib.quote(url, safe='') \ No newline at end of file diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo index 952393e23e4bfc2b8588c20b80efe76d2ca4437b..8b66a573466c81adb2247471132a04ec56b836ca 100644 Binary files a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo and b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo differ diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po index 072665bdfcd181964eb1fb5507006c1ae65e0c48..94d41ba1893490eb3a7cfe07eacc63ed2392a421 100644 --- a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po +++ b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po @@ -272,4 +272,7 @@ msgid "submit date search" msgstr "Zeitbezug anwenden" msgid "daterange" -msgstr "Zeitbezug" \ No newline at end of file +msgstr "Zeitbezug" + +msgid "share this dataset" +msgstr "Datensatz teilen" \ No newline at end of file diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index 4d2e165a9b571ebdaeee9552ea394955d1fff6f8..93eed79ccab37b34a4dcaf725cc8f961b55555ff 100644 --- a/ckanext/odsh/plugin.py +++ b/ckanext/odsh/plugin.py @@ -170,7 +170,8 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm 'odsh_get_bounding_box': odsh_helpers.odsh_get_bounding_box, 'odsh_get_spatial_text': odsh_helpers.odsh_get_spatial_text, 'odsh_render_datetime': odsh_helpers.odsh_render_datetime, - 'odsh_upload_known_formats': odsh_helpers.odsh_upload_known_formats + 'odsh_upload_known_formats': odsh_helpers.odsh_upload_known_formats, + 'odsh_encodeurl': odsh_helpers.odsh_encodeurl } def before_map(self, map): diff --git a/ckanext/odsh/public/odsh.css b/ckanext/odsh/public/odsh.css index c9a2418c526512f6993953016088150a255ea043..e54db9fcc19c0e2a30fbcf0e83961ff713b948a4 100644 --- a/ckanext/odsh/public/odsh.css +++ b/ckanext/odsh/public/odsh.css @@ -1241,3 +1241,14 @@ display: none; margin-top: 40px; margin-left: 400px; } + +.share-links { + display: flex; + justify-content: space-between; +} + +.share-links a{ + font-size: 22px; + margin-top: 5px; + color:#003064; +} diff --git a/ckanext/odsh/templates/package/snippets/info.html b/ckanext/odsh/templates/package/snippets/info.html index d1d52432974a7729118777a98aeb54d0620c0954..f5f8331438a506dce69c53a3661819cd6f4ffe6b 100644 --- a/ckanext/odsh/templates/package/snippets/info.html +++ b/ckanext/odsh/templates/package/snippets/info.html @@ -60,7 +60,8 @@ Example: {% block last_change %} <div class="last-change-detail info-detail"> - {%set issued=h.odsh_render_datetime(pkg.issued) if pkg.issued else h.odsh_render_datetime(pkg.metadata_created)%} + {%set issued=h.odsh_render_datetime(pkg.issued) if pkg.issued else + h.odsh_render_datetime(pkg.metadata_created)%} <div>{{ _('issued') }}:</div> {{issued}} </div> @@ -92,7 +93,19 @@ Example: {% endif %} </div> {% endblock %} - </div> + {% block social_nav %} + <div class="info-detail"> + {% set current_url = h.odsh_encodeurl(h.full_current_url()) %} + <p>{{ _('share this dataset')}}:</p> + <div class="share-links"> + <a href="https://www.linkedin.com/shareArticle?mini=true&url={{current_url}}" target="_blank"><i class="fa fa-linkedin"></i></a> + <a href="https://www.xing.com/app/user?op=share&url={{ current_url }}" target="_blank"><i class="fa fa-xing-square"></i></a> + <a href="https://www.facebook.com/sharer.php?href={{ current_url }}" target="_blank"><i class="fa fa-facebook-square"></i></a> + <a href="https://twitter.com/share?url={{ current_url }}" target="_blank"><i class="fa fa-twitter-square"></i></a> + <a href="mailto:?body={{ current_url }}" target="_blank"><i class="fa fa-envelope"></i></a> + </div> + </div> + {% endblock %} </section> {% endif %} -{% endblock %} +{% endblock %} \ No newline at end of file