--- a/src/pyams_default_theme/resources/js/pyams-default.min.js Mon Jan 21 17:44:08 2019 +0100
+++ b/src/pyams_default_theme/resources/js/pyams-default.min.js Mon Jan 21 17:45:21 2019 +0100
@@ -1,1 +1,1 @@
-!function(o,a){"use strict";var l=a.MyAMS;a.PyAMS_default={search:{updateSort:function(){var a=o('form[id="search-results"]');if(a.exists()){var t=o(this).val();o('input[name="order_by"]',a).val(t),a.submit()}},updatePageLength:function(){var a=o('form[id="search-results"]');if(a.exists()){var t=o(this).val();o('input[name="start"]',a).val(0),o('input[name="length"]',a).val(t),a.submit()}},previousPage:function(){var a=o('form[id="search-results"]');if(a.exists()){var t=o(this).parents("ol.pagination").data("ams-current-page"),e=o('input[name="length"]',a).val();o('input[name="start"]',a).val(e*(t-2)),a.submit()}},nextPage:function(){var a=o('form[id="search-results"]');if(a.exists()){var t=o(this).parents("ol.pagination").data("ams-current-page"),e=o('input[name="length"]',a).val();o('input[name="start"]',a).val(e*t),a.submit()}},gotoPage:function(){var a=o('form[id="search-results"]');if(a.exists()){var t=parseInt(o(this).text()),e=o('input[name="length"]',a).val();o('input[name="start"]',a).val(e*(t-1)),a.submit()}}}},o(document).on("click",'[data-toggle="lightbox"]',function(a){a.preventDefault();var t=o(this);l.ajax.check(o.fn.ekkoLightbox,"/--static--/pyams_default_theme/js/ext/ekko-lightbox"+l.devext+".js",function(){t.ekkoLightbox({wrapping:!1,alwaysShowClose:!0,onContentLoaded:function(){var a=this.element().data("description"),t=this.modal(),e=o(".ekko-lightbox-container",t);o(".description",e).remove(),a&&o("<div></div>").addClass("description").text(a).appendTo(e)}})})}),o(document).on("click","[data-ams-click-handler]",function(a){var t=o(this),e=t.data("ams-disabled-handlers");if(!0!==e&&"click"!==e&&"all"!==e){var n=t.data();if(n.amsClickHandler){!0!==n.amsStopPropagation&&!0!==n.amsClickStopPropagation||a.stopPropagation(),!0!==n.amsClickKeepDefault&&a.preventDefault();for(var i=n.amsClickHandler.split(/\s+/),s=0;s<i.length;s++){var r=l.getFunctionByName(i[s]);void 0!==r&&r.call(t,a,n.amsClickHandlerOptions)}}}}),o(document).on("change","[data-ams-change-handler]",function(a){var t=o(this);if(!t.prop("readonly")){var e=t.data("ams-disabled-handlers");if(!0!==e&&"change"!==e&&"all"!==e){var n=t.data();if(n.amsChangeHandler){!0!==n.amsStopPropagation&&!0!==n.amsChangeStopPropagation||a.stopPropagation(),!0!==n.amsChangeKeepDefault&&a.preventDefault();for(var i=n.amsChangeHandler.split(/\s+/),s=0;s<i.length;s++){var r=l.getFunctionByName(i[s]);void 0!==r&&r.call(t,a,n.amsChangeHandlerOptions)}}}}});var e=function(){var a=o(".modal >div");a.exists()&&l.dialog.close(a);var t=o(this).data("term")||o(this).text();l.dialog.open("/get-glossary-term.html?term="+t,{},{shown:function(){o(".thesaurus-term").off("click").on("click",e)}})};l.require(["error","ajax","dialog"],function(){o(".thesaurus-term").off("click").on("click",e)})}(jQuery,this);
+!function(a,t){"use strict";var e=t.MyAMS;t.PyAMS_default={search:{updateSort:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).val();a('input[name="order_by"]',t).val(e),t.submit()}},updatePageLength:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).val();a('input[name="start"]',t).val(0),a('input[name="length"]',t).val(e),t.submit()}},previousPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).parents("ol.pagination").data("ams-current-page"),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*(e-2)),t.submit()}},nextPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).parents("ol.pagination").data("ams-current-page"),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*e),t.submit()}},gotoPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=parseInt(a(this).text()),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*(e-1)),t.submit()}}}},a(document).on("click",'[data-toggle="lightbox"]',function(t){t.preventDefault();var n=a(this);e.ajax.check(a.fn.ekkoLightbox,"/--static--/pyams_default_theme/js/ext/ekko-lightbox"+e.devext+".js",function(){n.ekkoLightbox({wrapping:!1,alwaysShowClose:!0,onContentLoaded:function(){var t=this.element().data("description"),e=this.modal(),n=a(".ekko-lightbox-container",e);a(".description",n).remove(),t&&a("<div></div>").addClass("description").text(t).appendTo(n)}})})}),a(document).on("click","[data-ams-click-handler]",function(t){var n=a(this),i=n.data("ams-disabled-handlers");if(!0!==i&&"click"!==i&&"all"!==i){var s=n.data();if(s.amsClickHandler){!0!==s.amsStopPropagation&&!0!==s.amsClickStopPropagation||t.stopPropagation(),!0!==s.amsClickKeepDefault&&t.preventDefault();for(var r=s.amsClickHandler.split(/\s+/),o=0;o<r.length;o++){var l=e.getFunctionByName(r[o]);void 0!==l&&l.call(n,t,s.amsClickHandlerOptions)}}}}),a(document).on("change","[data-ams-change-handler]",function(t){var n=a(this);if(!n.prop("readonly")){var i=n.data("ams-disabled-handlers");if(!0!==i&&"change"!==i&&"all"!==i){var s=n.data();if(s.amsChangeHandler){!0!==s.amsStopPropagation&&!0!==s.amsChangeStopPropagation||t.stopPropagation(),!0!==s.amsChangeKeepDefault&&t.preventDefault();for(var r=s.amsChangeHandler.split(/\s+/),o=0;o<r.length;o++){var l=e.getFunctionByName(r[o]);void 0!==l&&l.call(n,t,s.amsChangeHandlerOptions)}}}}});var n=function(){var t=a(".modal >div");t.exists()&&e.dialog.close(t);var i=a(this).data("term")||a(this).text();e.dialog.open("/get-glossary-term.html?term="+i,{},{shown:function(){a(".thesaurus-term").off("click").on("click",n)}})};e.require(["error","ajax","dialog"],function(){a(".thesaurus-term").off("click").on("click",n)})}(jQuery,this);
--- a/src/pyams_default_theme/root/opengraph.py Mon Jan 21 17:44:08 2019 +0100
+++ b/src/pyams_default_theme/root/opengraph.py Mon Jan 21 17:45:21 2019 +0100
@@ -37,7 +37,6 @@
def get_metas(self):
context = self.context
request = self.request
- i18n = II18n(context)
negotiator = get_utility(INegotiator)
lang = negotiator.server_language
@@ -87,9 +86,12 @@
# twitter properties
share_info = ISocialShareInfo(request.root, None)
- if (share_info is not None) and share_info.twitter_account:
- yield ContentMeta('twitter:site', share_info.twitter_account)
- yield ContentMeta('twitter:creator', share_info.twitter_creator_account or share_info.twitter_account)
+ if share_info is not None:
+ if share_info.fb_app_id:
+ yield PropertyMeta('fb:app_id', share_info.fb_app_id)
+ if share_info.twitter_account:
+ yield ContentMeta('twitter:site', share_info.twitter_account)
+ yield ContentMeta('twitter:creator', share_info.twitter_creator_account or share_info.twitter_account)
if title:
yield ContentMeta('twitter:title', title)
if description:
--- a/src/pyams_default_theme/shared/common/opengraph.py Mon Jan 21 17:44:08 2019 +0100
+++ b/src/pyams_default_theme/shared/common/opengraph.py Mon Jan 21 17:45:21 2019 +0100
@@ -27,6 +27,7 @@
from pyams_skin.metas import ContentMeta, PropertyMeta, SchemaMeta
from pyams_utils.adapter import ContextRequestViewAdapter, adapter_config
from pyams_utils.registry import get_utility
+from pyams_utils.timezone import tztime
from pyams_utils.traversing import get_parent
from pyams_utils.url import absolute_url, canonical_url
from pyams_workflow.interfaces import IWorkflowPublicationInfo
@@ -54,16 +55,26 @@
if description:
yield PropertyMeta('og:description', description)
- # workflow informations
+ # URL and site name
+ yield PropertyMeta('og:url', canonical_url(context, request))
+ configuration = IConfiguration(request.root)
+ yield PropertyMeta('og:site_name', configuration.title)
+
+ # author account
+ share_info = ISocialShareInfo(request.root, None)
+ if share_info.fb_account:
+ yield PropertyMeta('article:author', share_info.fb_account)
+
+ # workflow information
dc = IZopeDublinCore(context, None)
if (dc is not None) and dc.modified:
- yield PropertyMeta('article:modified_time', dc.modified.isoformat())
+ yield PropertyMeta('article:modified_time', tztime(dc.modified).isoformat())
pub_info = IWorkflowPublicationInfo(context, None)
if pub_info is not None:
if pub_info.first_publication_date:
- yield PropertyMeta('article:published_time', pub_info.first_publication_date.isoformat())
+ yield PropertyMeta('article:published_time', tztime(pub_info.first_publication_date).isoformat())
if pub_info.publication_expiration_date:
- yield PropertyMeta('article:expiration_time', pub_info.publication_expiration_date.isoformat())
+ yield PropertyMeta('article:expiration_time', tztime(pub_info.publication_expiration_date).isoformat())
# tags
tags = ITagsInfo(context, None)
@@ -71,11 +82,6 @@
for tag in tags.tags or ():
yield PropertyMeta('article:tag', tag.label)
- # URL and site name
- yield PropertyMeta('og:url', canonical_url(context, request))
- configuration = IConfiguration(request.root)
- yield PropertyMeta('og:site_name', configuration.title)
-
# illustration properties
registry = request.registry
illustration = None
@@ -112,10 +118,12 @@
yield PropertyMeta('og:locale:alternate', other_lang)
# twitter properties
- share_info = ISocialShareInfo(request.root, None)
- if (share_info is not None) and share_info.twitter_account:
- yield ContentMeta('twitter:site', share_info.twitter_account)
- yield ContentMeta('twitter:creator', share_info.twitter_creator_account or share_info.twitter_account)
+ if share_info is not None:
+ if share_info.fb_app_id:
+ yield PropertyMeta('fb:app_id', share_info.fb_app_id)
+ if share_info.twitter_account:
+ yield ContentMeta('twitter:site', share_info.twitter_account)
+ yield ContentMeta('twitter:creator', share_info.twitter_creator_account or share_info.twitter_account)
yield ContentMeta('twitter:title', i18n.query_attribute('title', lang=lang, request=request))
if description:
yield ContentMeta('twitter:description', description)
--- a/src/pyams_default_theme/shared/site/__init__.py Mon Jan 21 17:44:08 2019 +0100
+++ b/src/pyams_default_theme/shared/site/__init__.py Mon Jan 21 17:45:21 2019 +0100
@@ -16,6 +16,7 @@
from pyams_file.interfaces import IThumbnails
from pyams_skin.interfaces.configuration import IConfiguration
from pyams_utils.registry import get_utility
+from pyams_utils.timezone import tztime
from pyams_workflow.interfaces import IWorkflowPublicationInfo
@@ -88,13 +89,23 @@
if description:
yield PropertyMeta('og:description', description)
+ # URL and site name
+ yield PropertyMeta('og:url', canonical_url(context, request))
+ configuration = IConfiguration(request.root)
+ yield PropertyMeta('og:site_name', configuration.title)
+
+ # author account
+ share_info = ISocialShareInfo(request.root, None)
+ if share_info.fb_account:
+ yield PropertyMeta('article:author', share_info.fb_account)
+
# workflow informations
pub_info = IWorkflowPublicationInfo(context, None)
if pub_info is not None:
if pub_info.first_publication_date:
- yield PropertyMeta('article:published_time', pub_info.first_publication_date.isoformat())
+ yield PropertyMeta('article:published_time', tztime(pub_info.first_publication_date).isoformat())
if pub_info.publication_expiration_date:
- yield PropertyMeta('article:expiration_time', pub_info.publication_expiration_date.isoformat())
+ yield PropertyMeta('article:expiration_time', tztime(pub_info.publication_expiration_date).isoformat())
# tags
tags = ITagsInfo(context, None)
@@ -102,11 +113,6 @@
for tag in tags.tags or ():
yield PropertyMeta('article:tag', tag.label)
- # URL and site name
- yield PropertyMeta('og:url', canonical_url(context, request))
- configuration = IConfiguration(request.root)
- yield PropertyMeta('og:site_name', configuration.title)
-
# illustration properties
registry = request.registry
thumbnail = None
@@ -137,10 +143,12 @@
yield PropertyMeta('og:locale:alternate', other_lang)
# twitter properties
- share_info = ISocialShareInfo(request.root, None)
- if (share_info is not None) and share_info.twitter_account:
- yield ContentMeta('twitter:site', share_info.twitter_account)
- yield ContentMeta('twitter:creator', share_info.twitter_creator_account or share_info.twitter_account)
+ if share_info is not None:
+ if share_info.fb_app_id:
+ yield PropertyMeta('fb:app_id', share_info.fb_app_id)
+ if share_info.twitter_account:
+ yield ContentMeta('twitter:site', share_info.twitter_account)
+ yield ContentMeta('twitter:creator', share_info.twitter_creator_account or share_info.twitter_account)
yield ContentMeta('twitter:title', i18n.query_attribute('title', lang=lang, request=request))
if description:
yield ContentMeta('twitter:description', description)