mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 09:25:45 +01:00
Switch client t.js usage to Benchpress
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/account/edit', ['forum/account/header', 'translator', 'components', 'pictureCropper'], function (header, translator, components, pictureCropper) {
|
||||
define('forum/account/edit', ['forum/account/header', 'translator', 'components', 'pictureCropper', 'benchpress'], function (header, translator, components, pictureCropper, Benchpress) {
|
||||
var AccountEdit = {};
|
||||
|
||||
AccountEdit.init = function () {
|
||||
@@ -84,7 +84,7 @@ define('forum/account/edit', ['forum/account/header', 'translator', 'components'
|
||||
return memo || cur.type === 'uploaded';
|
||||
}, false);
|
||||
|
||||
templates.parse('partials/modals/change_picture_modal', {
|
||||
Benchpress.parse('partials/modals/change_picture_modal', {
|
||||
pictures: pictures,
|
||||
uploaded: uploaded,
|
||||
icon: { text: ajaxify.data['icon:text'], bgColor: ajaxify.data['icon:bgColor'] },
|
||||
@@ -229,7 +229,7 @@ define('forum/account/edit', ['forum/account/header', 'translator', 'components'
|
||||
|
||||
modal.find('[data-action="upload-url"]').on('click', function () {
|
||||
modal.modal('hide');
|
||||
templates.parse('partials/modals/upload_picture_from_url_modal', {}, function (html) {
|
||||
Benchpress.parse('partials/modals/upload_picture_from_url_modal', {}, function (html) {
|
||||
translator.translate(html, function (html) {
|
||||
var uploadModal = $(html);
|
||||
uploadModal.modal('show');
|
||||
|
||||
@@ -6,7 +6,8 @@ define('forum/account/header', [
|
||||
'pictureCropper',
|
||||
'components',
|
||||
'translator',
|
||||
], function (coverPhoto, pictureCropper, components, translator) {
|
||||
'benchpress',
|
||||
], function (coverPhoto, pictureCropper, components, translator, Benchpress) {
|
||||
var AccountHeader = {};
|
||||
var isAdminOrSelfOrGlobalMod;
|
||||
|
||||
@@ -114,7 +115,7 @@ define('forum/account/header', [
|
||||
}
|
||||
|
||||
function banAccount() {
|
||||
templates.parse('admin/partials/temporary-ban', {}, function (html) {
|
||||
Benchpress.parse('admin/partials/temporary-ban', {}, function (html) {
|
||||
bootbox.dialog({
|
||||
className: 'ban-modal',
|
||||
title: '[[user:ban_account]]',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/categories', ['components', 'translator'], function (components, translator) {
|
||||
define('forum/categories', ['components', 'translator', 'benchpress'], function (components, translator, Benchpress) {
|
||||
var categories = {};
|
||||
|
||||
$(window).on('action:ajaxify.start', function (ev, data) {
|
||||
@@ -58,7 +58,7 @@ define('forum/categories', ['components', 'translator'], function (components, t
|
||||
}
|
||||
|
||||
function parseAndTranslate(posts, callback) {
|
||||
templates.parse('categories', '(categories.)?posts', { categories: { posts: posts } }, function (html) {
|
||||
Benchpress.parse('categories', '(categories\\.)?posts', { categories: { posts: posts } }, function (html) {
|
||||
translator.translate(html, function (translatedHTML) {
|
||||
translatedHTML = $(translatedHTML);
|
||||
translatedHTML.find('.post-content img:not(.not-responsive)').addClass('img-responsive');
|
||||
|
||||
@@ -12,7 +12,8 @@ define('forum/category', [
|
||||
'topicSelect',
|
||||
'forum/pagination',
|
||||
'storage',
|
||||
], function (infinitescroll, share, navigator, categoryTools, sort, components, translator, topicSelect, pagination, storage) {
|
||||
'benchpress',
|
||||
], function (infinitescroll, share, navigator, categoryTools, sort, components, translator, topicSelect, pagination, storage, Benchpress) {
|
||||
var Category = {};
|
||||
|
||||
$(window).on('action:ajaxify.start', function (ev, data) {
|
||||
@@ -204,7 +205,7 @@ define('forum/category', [
|
||||
|
||||
var editable = !!$('.thread-tools').length;
|
||||
|
||||
templates.parse('category', 'topics', {
|
||||
Benchpress.parse('category', 'topics', {
|
||||
privileges: { editable: editable },
|
||||
showSelect: editable,
|
||||
topics: [topic],
|
||||
|
||||
@@ -8,7 +8,8 @@ define('forum/chats', [
|
||||
'forum/chats/recent',
|
||||
'forum/chats/search',
|
||||
'forum/chats/messages',
|
||||
], function (components, translator, mousetrap, recentChats, search, messages) {
|
||||
'benchpress',
|
||||
], function (components, translator, mousetrap, recentChats, search, messages, Benchpress) {
|
||||
var Chats = {
|
||||
initialised: false,
|
||||
};
|
||||
@@ -366,7 +367,7 @@ define('forum/chats', [
|
||||
roomEl.addClass('unread');
|
||||
} else {
|
||||
var recentEl = components.get('chat/recent');
|
||||
templates.parse('partials/chats/recent_room', {
|
||||
Benchpress.parse('partials/chats/recent_room', {
|
||||
rooms: {
|
||||
roomId: data.roomId,
|
||||
lastUser: data.message.fromUser,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/chats/messages', ['components', 'sounds', 'translator'], function (components, sounds, translator) {
|
||||
define('forum/chats/messages', ['components', 'sounds', 'translator', 'benchpress'], function (components, sounds, translator, Benchpress) {
|
||||
var messages = {};
|
||||
|
||||
messages.sendMessage = function (roomId, inputEl) {
|
||||
@@ -86,7 +86,7 @@ define('forum/chats/messages', ['components', 'sounds', 'translator'], function
|
||||
|
||||
|
||||
messages.parseMessage = function (data, callback) {
|
||||
templates.parse('partials/chats/message' + (Array.isArray(data) ? 's' : ''), {
|
||||
Benchpress.parse('partials/chats/message' + (Array.isArray(data) ? 's' : ''), {
|
||||
messages: data,
|
||||
}, function (html) {
|
||||
translator.translate(html, callback);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/* globals define */
|
||||
|
||||
define('forum/flags/detail', ['forum/flags/list', 'components', 'translator'], function (FlagsList, components, translator) {
|
||||
define('forum/flags/detail', ['forum/flags/list', 'components', 'translator', 'benchpress'], function (FlagsList, components, translator, Benchpress) {
|
||||
var Flags = {};
|
||||
|
||||
Flags.init = function () {
|
||||
@@ -48,7 +48,7 @@ define('forum/flags/detail', ['forum/flags/list', 'components', 'translator'], f
|
||||
};
|
||||
|
||||
Flags.reloadNotes = function (notes) {
|
||||
templates.parse('flags/detail', 'notes', {
|
||||
Benchpress.parse('flags/detail', 'notes', {
|
||||
notes: notes,
|
||||
}, function (html) {
|
||||
var wrapperEl = components.get('flag/notes');
|
||||
@@ -60,7 +60,7 @@ define('forum/flags/detail', ['forum/flags/list', 'components', 'translator'], f
|
||||
};
|
||||
|
||||
Flags.reloadHistory = function (history) {
|
||||
templates.parse('flags/detail', 'history', {
|
||||
Benchpress.parse('flags/detail', 'history', {
|
||||
history: history,
|
||||
}, function (html) {
|
||||
translator.translate(html, function (translated) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/groups/list', ['forum/infinitescroll'], function (infinitescroll) {
|
||||
define('forum/groups/list', ['forum/infinitescroll', 'benchpress'], function (infinitescroll, Benchpress) {
|
||||
var Groups = {};
|
||||
|
||||
Groups.init = function () {
|
||||
@@ -44,7 +44,7 @@ define('forum/groups/list', ['forum/infinitescroll'], function (infinitescroll)
|
||||
after: $('[component="groups/container"]').attr('data-nextstart'),
|
||||
}, function (data, done) {
|
||||
if (data && data.groups.length) {
|
||||
templates.parse('partials/groups/list', {
|
||||
Benchpress.parse('partials/groups/list', {
|
||||
groups: data.groups,
|
||||
}, function (html) {
|
||||
$('#groups-list').append(html);
|
||||
@@ -78,7 +78,7 @@ define('forum/groups/list', ['forum/infinitescroll'], function (infinitescroll)
|
||||
groups = groups.filter(function (group) {
|
||||
return group.name !== 'registered-users' && group.name !== 'guests';
|
||||
});
|
||||
templates.parse('partials/groups/list', {
|
||||
Benchpress.parse('partials/groups/list', {
|
||||
groups: groups,
|
||||
}, function (html) {
|
||||
groupsEl.empty().append(html);
|
||||
|
||||
@@ -9,7 +9,8 @@ define('forum/topic/events', [
|
||||
'forum/topic/images',
|
||||
'components',
|
||||
'translator',
|
||||
], function (postTools, threadTools, posts, images, components, translator) {
|
||||
'benchpress',
|
||||
], function (postTools, threadTools, posts, images, components, translator, Benchpress) {
|
||||
var Events = {};
|
||||
|
||||
var events = {
|
||||
@@ -139,7 +140,7 @@ define('forum/topic/events', [
|
||||
editedISO: utils.toISOString(data.post.edited),
|
||||
};
|
||||
|
||||
templates.parse('partials/topic/post-editor', editData, function (html) {
|
||||
Benchpress.parse('partials/topic/post-editor', editData, function (html) {
|
||||
translator.translate(html, function (translated) {
|
||||
html = $(translated);
|
||||
editorEl.replaceWith(html);
|
||||
@@ -150,7 +151,7 @@ define('forum/topic/events', [
|
||||
});
|
||||
|
||||
if (data.topic.tags && tagsUpdated(data.topic.tags)) {
|
||||
templates.parse('partials/post_bar', 'tags', { tags: data.topic.tags }, function (html) {
|
||||
Benchpress.parse('partials/post_bar', 'tags', { tags: data.topic.tags }, function (html) {
|
||||
var tags = $('.tags');
|
||||
|
||||
tags.fadeOut(250, function () {
|
||||
|
||||
@@ -8,7 +8,8 @@ define('forum/topic/postTools', [
|
||||
'translator',
|
||||
'forum/topic/votes',
|
||||
'forum/topic/move-post',
|
||||
], function (share, navigator, components, translator, votes, movePost) {
|
||||
'benchpress',
|
||||
], function (share, navigator, components, translator, votes, movePost, Benchpress) {
|
||||
var PostTools = {};
|
||||
|
||||
var staleReplyAnyway = false;
|
||||
@@ -44,7 +45,7 @@ define('forum/topic/postTools', [
|
||||
}
|
||||
data.posts.display_move_tools = data.posts.display_move_tools && index !== 0;
|
||||
|
||||
templates.parse('partials/topic/post-menu-list', data, function (html) {
|
||||
Benchpress.parse('partials/topic/post-menu-list', data, function (html) {
|
||||
translator.translate(html, function (html) {
|
||||
dropdownMenu.html(html);
|
||||
$(window).trigger('action:post.tools.load');
|
||||
|
||||
@@ -7,7 +7,8 @@ define('forum/topic/threadTools', [
|
||||
'forum/topic/delete-posts',
|
||||
'components',
|
||||
'translator',
|
||||
], function (fork, move, deletePosts, components, translator) {
|
||||
'benchpress',
|
||||
], function (fork, move, deletePosts, components, translator, Benchpress) {
|
||||
var ThreadTools = {};
|
||||
|
||||
ThreadTools.init = function (tid) {
|
||||
@@ -138,7 +139,7 @@ define('forum/topic/threadTools', [
|
||||
return app.alertError(err);
|
||||
}
|
||||
|
||||
templates.parse('partials/topic/topic-menu-list', data, function (html) {
|
||||
Benchpress.parse('partials/topic/topic-menu-list', data, function (html) {
|
||||
translator.translate(html, function (html) {
|
||||
dropdownMenu.html(html);
|
||||
$(window).trigger('action:topic.tools.load');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/topic/votes', ['components', 'translator'], function (components, translator) {
|
||||
define('forum/topic/votes', ['components', 'translator', 'benchpress'], function (components, translator, Benchpress) {
|
||||
var Votes = {};
|
||||
|
||||
Votes.addVoteHandler = function () {
|
||||
@@ -92,7 +92,7 @@ define('forum/topic/votes', ['components', 'translator'], function (components,
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
|
||||
templates.parse('partials/modals/votes_modal', data, function (html) {
|
||||
Benchpress.parse('partials/modals/votes_modal', data, function (html) {
|
||||
translator.translate(html, function (translated) {
|
||||
var dialog = bootbox.dialog({
|
||||
title: 'Voters',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/users', ['translator'], function (translator) {
|
||||
define('forum/users', ['translator', 'benchpress'], function (translator, Benchpress) {
|
||||
var Users = {};
|
||||
|
||||
var searchTimeoutID = 0;
|
||||
@@ -98,11 +98,11 @@ define('forum/users', ['translator'], function (translator) {
|
||||
}
|
||||
|
||||
function renderSearchResults(data) {
|
||||
templates.parse('partials/paginator', { pagination: data.pagination }, function (html) {
|
||||
Benchpress.parse('partials/paginator', { pagination: data.pagination }, function (html) {
|
||||
$('.pagination-container').replaceWith(html);
|
||||
});
|
||||
|
||||
templates.parse('users', 'users', data, function (html) {
|
||||
Benchpress.parse('users', 'users', data, function (html) {
|
||||
translator.translate(html, function (translated) {
|
||||
translated = $(translated);
|
||||
$('#users-container').html(translated);
|
||||
|
||||
Reference in New Issue
Block a user