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