From dc3f89a505240bd8a11d9c1d4706abbc58262cbc Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Wed, 30 Aug 2017 10:51:25 -0600
Subject: [PATCH] ajaxify t.js usage to Benchpress
---
public/src/ajaxify.js | 6 ++++--
public/src/app.js | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 98580332eb..c655cdca96 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -10,13 +10,15 @@ $(document).ready(function () {
var ajaxifyTimer;
var translator;
+ var Benchpress;
var retry = true;
var previousBodyClass = '';
// Dumb hack to fool ajaxify into thinking translator is still a global
// When ajaxify is migrated to a require.js module, then this can be merged into the "define" call
- require(['translator'], function (_translator) {
+ require(['translator', 'benchpress'], function (_translator, _Benchpress) {
translator = _translator;
+ Benchpress = _Benchpress;
});
$(window).on('popstate', function (ev) {
@@ -174,7 +176,7 @@ $(document).ready(function () {
function renderTemplate(url, tpl_url, data, callback) {
$(window).trigger('action:ajaxify.loadingTemplates', {});
- templates.parse(tpl_url, data, function (template) {
+ Benchpress.parse(tpl_url, data, function (template) {
translator.translate(template, function (translatedTemplate) {
translatedTemplate = translator.unescape(translatedTemplate);
$('body').removeClass(previousBodyClass).addClass(data.bodyClass);
diff --git a/public/src/app.js b/public/src/app.js
index f17d7c4c58..913360c615 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -624,7 +624,7 @@ app.cacheBuster = null;
};
app.parseAndTranslate = function (template, blockName, data, callback) {
- require(['translator'], function (translator) {
+ require(['translator', 'benchpress'], function (translator, Benchpress) {
function translate(html, callback) {
translator.translate(html, function (translatedHTML) {
translatedHTML = translator.unescape(translatedHTML);
@@ -633,13 +633,13 @@ app.cacheBuster = null;
}
if (typeof blockName === 'string') {
- templates.parse(template, blockName, data, function (html) {
+ Benchpress.parse(template, blockName, data, function (html) {
translate(html, callback);
});
} else {
callback = data;
data = blockName;
- templates.parse(template, data, function (html) {
+ Benchpress.parse(template, data, function (html) {
translate(html, callback);
});
}