Merge pull request #3774 from overleaf/jpa-meta

[frontend] import meta tag processing from das7pads fork

GitOrigin-RevId: ca74ff9fbbcb51091a626a45468ff3d24d6136ca
This commit is contained in:
Jakob Ackermann
2021-03-23 03:05:12 +00:00
committed by Copybot
parent 2e305f36bc
commit 535c97e8cf
8 changed files with 135 additions and 47 deletions
+31 -34
View File
@@ -69,45 +69,42 @@ html(
script(type='text/javascript').
window.ga = function() { console.log("would send to GA", arguments) };
script(type="text/javascript").
window.csrfToken = "#{csrfToken}";
block meta
meta(name="ol-csrfToken" content=csrfToken)
//- Configure dynamically loaded assets (via webpack) to be downloaded from CDN
//- See: https://webpack.js.org/guides/public-path/#on-the-fly
window.baseAssetPath = "#{buildBaseAssetPath()}"
meta(name="ol-baseAssetPath" content=buildBaseAssetPath())
meta(name="ol-usersEmail" content=getUserEmail())
meta(name="ol-sharelatex" data-type="json" content={
siteUrl: settings.siteUrl,
wsUrl,
})
meta(name="ol-ab" data-type="json" content={})
meta(name="ol-user_id" content=getLoggedInUserId())
//- Internationalisation settings
meta(name="ol-i18n" data-type="json" content={
currentLangCode: currentLngCode
})
//- Expose some settings globally to the frontend
meta(name="ol-ExposedSettings" data-type="json" content=ExposedSettings)
if (typeof(settings.algolia) != "undefined")
meta(name="ol-sharelatex.algolia" data-type="json" content={
app_id: settings.algolia.app_id,
api_key: settings.algolia.read_only_api_key,
indexes: settings.algolia.indexes
})
if (typeof(settings.templates) != "undefined")
meta(name="ol-sharelatex.templates" data-type="json" content={
user_id : settings.templates.user_id,
cdnDomain : settings.templates.cdnDomain,
indexName : settings.templates.indexName
})
block head-scripts
meta(id="ol-usersEmail" content=getUserEmail())
script.
window.sharelatex = {
siteUrl: '#{settings.siteUrl}',
wsUrl: '#{wsUrl}',
};
window.ab = {};
window.user_id = '#{getLoggedInUserId()}';
//- Internationalisation settings
window.i18n = {
currentLangCode: '#{currentLngCode}'
}
//- Expose some settings globally to the frontend
window.ExposedSettings = JSON.parse('!{StringHelper.stringifyJsonForScript(ExposedSettings)}');
- if (typeof(settings.algolia) != "undefined")
script.
window.sharelatex.algolia = {
app_id:'#{settings.algolia.app_id}',
api_key:'#{settings.algolia.read_only_api_key}',
indexes:!{StringHelper.stringifyJsonForScript(settings.algolia.indexes)}
}
- if (typeof(settings.templates) != "undefined")
script.
window.sharelatex.templates = {
user_id : '!{settings.templates.user_id}',
cdnDomain : '!{settings.templates.cdnDomain}',
indexName : '!{settings.templates.indexName}'
}
body
if(settings.recaptcha && settings.recaptcha.siteKeyV3)
+15 -10
View File
@@ -3,18 +3,23 @@ extends ../layout
block vars
- var suppressNavContentLinks = true
block content
script#data(type="application/json").
!{StringHelper.stringifyJsonForScript({ projects, tags, notifications, notificationsInstitution, userAffiliations, userEmails, allInReconfirmNotificationPeriods, reconfirmedViaSAML })}
script(type="text/javascript").
window.data = JSON.parse(document.querySelector("#data").text);
window.algolia = {
block append meta
meta(name="ol-projects" data-type="json" content=projects)
meta(name="ol-tags" data-type="json" content=tags)
meta(name="ol-notifications" data-type="json" content=notifications)
meta(name="ol-notificationsInstitution" data-type="json" content=notificationsInstitution)
meta(name="ol-userAffiliations" data-type="json" content=userAffiliations)
meta(name="ol-userEmails" data-type="json" content=userEmails)
meta(name="ol-allInReconfirmNotificationPeriods" data-type="json" content=allInReconfirmNotificationPeriods)
meta(name="ol-reconfirmedViaSAML" content=reconfirmedViaSAML)
meta(name="ol-algolia" data-type="json" content={
institutions: {
app_id: '#{algolia_app_id}',
api_key: '#{algolia_api_key}'
app_id: algolia_app_id,
api_key: algolia_api_key
}
};
})
block content
main.content.content-alt.project-list-page(
ng-controller="ProjectPageController"