mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
refactor: use alerts module
This commit is contained in:
@@ -3,5 +3,9 @@
|
||||
"alert.confirm-restart": "Are you sure you wish to restart NodeBB?",
|
||||
|
||||
"acp-title": "%1 | NodeBB Admin Control Panel",
|
||||
"settings-header-contents": "Contents"
|
||||
"settings-header-contents": "Contents",
|
||||
"changes-saved": "Changed Saved",
|
||||
"changes-saved-message": "Your changes to the NodeBB configuration have been saved.",
|
||||
"changes-not-saved": "Changes Not Saved",
|
||||
"changes-not-saved-message": "NodeBB encountered a problem saving your changes. (%1)"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('admin/appearance/skins', ['translator'], function (translator) {
|
||||
define('admin/appearance/skins', ['translator', 'alerts'], function (translator, alerts) {
|
||||
const Skins = {};
|
||||
|
||||
Skins.init = function () {
|
||||
@@ -33,11 +33,11 @@ define('admin/appearance/skins', ['translator'], function (translator) {
|
||||
src: cssSrc,
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
highlightSelectedTheme(themeId);
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'admin:theme',
|
||||
type: 'info',
|
||||
title: '[[admin/appearance/skins:skin-updated]]',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('admin/appearance/themes', ['bootbox', 'translator'], function (bootbox, translator) {
|
||||
define('admin/appearance/themes', ['bootbox', 'translator', 'alerts'], function (bootbox, translator, alerts) {
|
||||
const Themes = {};
|
||||
|
||||
Themes.init = function () {
|
||||
@@ -21,12 +21,12 @@ define('admin/appearance/themes', ['bootbox', 'translator'], function (bootbox,
|
||||
src: cssSrc,
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
config['theme:id'] = themeId;
|
||||
highlightSelectedTheme(themeId);
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'admin:theme',
|
||||
type: 'info',
|
||||
title: '[[admin/appearance/themes:theme-changed]]',
|
||||
@@ -50,10 +50,10 @@ define('admin/appearance/themes', ['bootbox', 'translator'], function (bootbox,
|
||||
id: 'nodebb-theme-persona',
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
highlightSelectedTheme('nodebb-theme-persona');
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'admin:theme',
|
||||
type: 'success',
|
||||
title: '[[admin/appearance/themes:theme-changed]]',
|
||||
@@ -67,7 +67,7 @@ define('admin/appearance/themes', ['bootbox', 'translator'], function (bootbox,
|
||||
|
||||
socket.emit('admin.themes.getInstalled', function (err, themes) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
|
||||
const instListEl = $('#installed_themes');
|
||||
|
||||
@@ -5,8 +5,9 @@ define('admin/extend/plugins', [
|
||||
'translator',
|
||||
'benchpress',
|
||||
'bootbox',
|
||||
'alerts',
|
||||
'jquery-ui/widgets/sortable',
|
||||
], function (translator, Benchpress, bootbox) {
|
||||
], function (translator, Benchpress, bootbox, alerts) {
|
||||
const Plugins = {};
|
||||
Plugins.init = function () {
|
||||
const pluginsList = $('.plugins');
|
||||
@@ -33,7 +34,7 @@ define('admin/extend/plugins', [
|
||||
function toggleActivate() {
|
||||
socket.emit('admin.plugins.toggleActive', pluginID, function (err, status) {
|
||||
if (err) {
|
||||
return app.alertError(err);
|
||||
return alerts.error(err);
|
||||
}
|
||||
translator.translate('<i class="fa fa-power-off"></i> [[admin/extend/plugins:plugin-item.' + (status.active ? 'deactivate' : 'activate') + ']]', function (buttonText) {
|
||||
btn.html(buttonText);
|
||||
@@ -47,7 +48,7 @@ define('admin/extend/plugins', [
|
||||
// Toggle active state in template data
|
||||
pluginData.active = !pluginData.active;
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'plugin_toggled',
|
||||
title: '[[admin/extend/plugins:alert.' + (status.active ? 'enabled' : 'disabled') + ']]',
|
||||
message: '[[admin/extend/plugins:alert.' + (status.active ? 'activate-success' : 'deactivate-success') + ']]',
|
||||
@@ -213,11 +214,11 @@ define('admin/extend/plugins', [
|
||||
|
||||
socket.emit('admin.plugins.orderActivePlugins', data, function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
$('#order-active-plugins-modal').modal('hide');
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'plugin_reordered',
|
||||
title: '[[admin/extend/plugins:alert.reorder]]',
|
||||
message: '[[admin/extend/plugins:alert.reorder-success]]',
|
||||
@@ -250,14 +251,14 @@ define('admin/extend/plugins', [
|
||||
version: version,
|
||||
}, function (err, isActive) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
const parent = btn.parents('li');
|
||||
parent.find('.fa-exclamation-triangle').remove();
|
||||
parent.find('.currentVersion').text(version);
|
||||
btn.remove();
|
||||
if (isActive) {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'plugin_upgraded',
|
||||
title: '[[admin/extend/plugins:alert.upgraded]]',
|
||||
message: '[[admin/extend/plugins:alert.upgrade-success]]',
|
||||
@@ -283,12 +284,12 @@ define('admin/extend/plugins', [
|
||||
}, function (err, pluginData) {
|
||||
if (err) {
|
||||
btn.removeAttr('disabled');
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
|
||||
ajaxify.refresh();
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'plugin_toggled',
|
||||
title: '[[admin/extend/plugins:alert.' + (pluginData.installed ? 'installed' : 'uninstalled') + ']]',
|
||||
message: '[[admin/extend/plugins:alert.' + (pluginData.installed ? 'install-success' : 'uninstall-success') + ']]',
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
|
||||
define('admin/extend/widgets', [
|
||||
'bootbox',
|
||||
'alerts',
|
||||
'jquery-ui/widgets/sortable',
|
||||
'jquery-ui/widgets/draggable',
|
||||
'jquery-ui/widgets/droppable',
|
||||
'jquery-ui/widgets/datepicker',
|
||||
], function (bootbox) {
|
||||
], function (bootbox, alerts) {
|
||||
const Widgets = {};
|
||||
|
||||
Widgets.init = function () {
|
||||
@@ -126,10 +127,10 @@ define('admin/extend/widgets', [
|
||||
|
||||
socket.emit('admin.widgets.set', saveData, function (err) {
|
||||
if (err) {
|
||||
app.alertError(err.message);
|
||||
alerts.error(err);
|
||||
}
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'admin:widgets',
|
||||
type: 'success',
|
||||
title: '[[admin/extend/widgets:alert.updated]]',
|
||||
|
||||
@@ -7,7 +7,8 @@ define('admin/manage/categories', [
|
||||
'api',
|
||||
'Sortable',
|
||||
'bootbox',
|
||||
], function (translator, Benchpress, categorySelector, api, Sortable, bootbox) {
|
||||
'alerts',
|
||||
], function (translator, Benchpress, categorySelector, api, Sortable, bootbox, alerts) {
|
||||
const Categories = {};
|
||||
let newCategoryId = -1;
|
||||
let sortables;
|
||||
@@ -143,10 +144,10 @@ define('admin/manage/categories', [
|
||||
Categories.create = function (payload) {
|
||||
api.post('/categories', payload, function (err, data) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'category_created',
|
||||
title: '[[admin/manage/categories:alert.created]]',
|
||||
message: '[[admin/manage/categories:alert.create-success]]',
|
||||
|
||||
@@ -7,7 +7,8 @@ define('admin/manage/category', [
|
||||
'benchpress',
|
||||
'api',
|
||||
'bootbox',
|
||||
], function (uploader, iconSelect, categorySelector, Benchpress, api, bootbox) {
|
||||
'alerts',
|
||||
], function (uploader, iconSelect, categorySelector, Benchpress, api, bootbox, alerts) {
|
||||
const Category = {};
|
||||
let updateHash = {};
|
||||
|
||||
@@ -55,14 +56,14 @@ define('admin/manage/category', [
|
||||
const cid = ajaxify.data.category.cid;
|
||||
api.put('/categories/' + cid, updateHash).then((res) => {
|
||||
app.flags._unsaved = false;
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
title: 'Updated Categories',
|
||||
message: 'Category "' + res.name + '" was successfully updated.',
|
||||
type: 'success',
|
||||
timeout: 5000,
|
||||
});
|
||||
updateHash = {};
|
||||
}).catch(app.alertError);
|
||||
}).catch(alerts.error);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -4,11 +4,12 @@ define('admin/manage/privileges', [
|
||||
'api',
|
||||
'autocomplete',
|
||||
'bootbox',
|
||||
'alerts',
|
||||
'translator',
|
||||
'categorySelector',
|
||||
'mousetrap',
|
||||
'admin/modules/checkboxRowSelector',
|
||||
], function (api, autocomplete, bootbox, translator, categorySelector, mousetrap, checkboxRowSelector) {
|
||||
], function (api, autocomplete, bootbox, alerts, translator, categorySelector, mousetrap, checkboxRowSelector) {
|
||||
const Privileges = {};
|
||||
|
||||
let cid;
|
||||
@@ -267,7 +268,7 @@ define('admin/manage/privileges', [
|
||||
|
||||
autocomplete.group(inputEl, function (ev, ui) {
|
||||
if (ui.item.group.name === 'administrators') {
|
||||
return app.alert({
|
||||
return alerts.alert({
|
||||
type: 'warning',
|
||||
message: '[[admin/manage/privileges:alert.admin-warning]]',
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
define('admin/manage/users', [
|
||||
'translator', 'benchpress', 'autocomplete', 'api', 'slugify', 'bootbox', 'accounts/invite',
|
||||
], function (translator, Benchpress, autocomplete, api, slugify, bootbox, AccountInvite) {
|
||||
'translator', 'benchpress', 'autocomplete', 'api', 'slugify', 'bootbox', 'alerts', 'accounts/invite',
|
||||
], function (translator, Benchpress, autocomplete, api, slugify, bootbox, alerts, AccountInvite) {
|
||||
const Users = {};
|
||||
|
||||
Users.init = function () {
|
||||
@@ -15,8 +15,8 @@ define('admin/manage/users', [
|
||||
|
||||
$('.export-csv').on('click', function () {
|
||||
socket.once('event:export-users-csv', function () {
|
||||
app.removeAlert('export-users-start');
|
||||
app.alert({
|
||||
alerts.remove('export-users-start');
|
||||
alerts.alert({
|
||||
alert_id: 'export-users',
|
||||
type: 'success',
|
||||
title: '[[global:alert.success]]',
|
||||
@@ -29,9 +29,9 @@ define('admin/manage/users', [
|
||||
});
|
||||
socket.emit('admin.user.exportUsersCSV', {}, function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err);
|
||||
return alerts.error(err);
|
||||
}
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'export-users-start',
|
||||
message: '[[admin/manage/users:export-users-started]]',
|
||||
timeout: (ajaxify.data.userCount / 5000) * 500,
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
define('admin/modules/instance', [
|
||||
'alerts',
|
||||
// need to preload the compiled alert template
|
||||
// otherwise it can be unloaded when rebuild & restart is run
|
||||
// the client can't fetch the template file, resulting in an error
|
||||
config.relative_path + '/assets/templates/alert.js',
|
||||
], function () {
|
||||
], function (alerts) {
|
||||
const instance = {};
|
||||
|
||||
instance.rebuildAndRestart = function (callback) {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'instance_rebuild_and_restart',
|
||||
type: 'info',
|
||||
title: 'Rebuilding... <i class="fa fa-spin fa-refresh"></i>',
|
||||
@@ -17,7 +18,7 @@ define('admin/modules/instance', [
|
||||
});
|
||||
|
||||
$(window).one('action:reconnected', function () {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'instance_rebuild_and_restart',
|
||||
type: 'success',
|
||||
title: '<i class="fa fa-check"></i> Success',
|
||||
@@ -31,7 +32,7 @@ define('admin/modules/instance', [
|
||||
});
|
||||
|
||||
socket.emit('admin.reload', function () {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'instance_rebuild_and_restart',
|
||||
type: 'info',
|
||||
title: 'Build Complete!... <i class="fa fa-spin fa-refresh"></i>',
|
||||
@@ -41,7 +42,7 @@ define('admin/modules/instance', [
|
||||
};
|
||||
|
||||
instance.restart = function (callback) {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'instance_restart',
|
||||
type: 'info',
|
||||
title: 'Restarting... <i class="fa fa-spin fa-refresh"></i>',
|
||||
@@ -49,7 +50,7 @@ define('admin/modules/instance', [
|
||||
});
|
||||
|
||||
$(window).one('action:reconnected', function () {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'instance_restart',
|
||||
type: 'success',
|
||||
title: '<i class="fa fa-check"></i> Success',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('admin/settings', ['uploader', 'mousetrap', 'hooks'], function (uploader, mousetrap, hooks) {
|
||||
define('admin/settings', ['uploader', 'mousetrap', 'hooks', 'alerts'], function (uploader, mousetrap, hooks, alerts) {
|
||||
const Settings = {};
|
||||
|
||||
Settings.populateTOC = function () {
|
||||
@@ -68,22 +68,22 @@ define('admin/settings', ['uploader', 'mousetrap', 'hooks'], function (uploader,
|
||||
|
||||
saveFields(fields, function onFieldsSaved(err) {
|
||||
if (err) {
|
||||
return app.alert({
|
||||
return alerts.alert({
|
||||
alert_id: 'config_status',
|
||||
timeout: 2500,
|
||||
title: 'Changes Not Saved',
|
||||
message: 'NodeBB encountered a problem saving your changes. (' + err.message + ')',
|
||||
title: '[[admin/admin:changes-not-saved]]',
|
||||
message: `[[admin/admin:changes-not-saved-message, ${err.message}]]`,
|
||||
type: 'danger',
|
||||
});
|
||||
}
|
||||
|
||||
app.flags._unsaved = false;
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'config_status',
|
||||
timeout: 2500,
|
||||
title: 'Changes Saved',
|
||||
message: 'Your changes to the NodeBB configuration have been saved.',
|
||||
title: '[[admin/admin:changes-saved]]',
|
||||
message: '[[admin/admin:changes-saved-message]]',
|
||||
type: 'success',
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
define('admin/settings/api', ['settings'], function (settings) {
|
||||
define('admin/settings/api', ['settings', 'alerts'], function (settings, alerts) {
|
||||
const ACP = {};
|
||||
|
||||
ACP.init = function () {
|
||||
@@ -20,7 +20,7 @@ define('admin/settings/api', ['settings'], function (settings) {
|
||||
|
||||
function saveSettings() {
|
||||
settings.save('core.api', $('.core-api-settings'), function () {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
type: 'success',
|
||||
alert_id: 'core.api-saved',
|
||||
title: 'Settings Saved',
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
|
||||
define('forum/chats/messages', [
|
||||
'components', 'translator', 'benchpress', 'hooks', 'bootbox', 'messages',
|
||||
], function (components, translator, Benchpress, hooks, bootbox, messagesModule) {
|
||||
'components', 'translator', 'benchpress', 'hooks', 'bootbox', 'alerts', 'messages',
|
||||
], function (components, translator, Benchpress, hooks, bootbox, alerts, messagesModule) {
|
||||
const messages = {};
|
||||
|
||||
messages.sendMessage = function (roomId, inputEl) {
|
||||
@@ -35,7 +35,7 @@ define('forum/chats/messages', [
|
||||
return messagesModule.showEmailConfirmWarning(err.message);
|
||||
}
|
||||
|
||||
return app.alert({
|
||||
return alerts.alert({
|
||||
alert_id: 'chat_spam_error',
|
||||
title: '[[global:alert.error]]',
|
||||
message: err.message,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/ip-blacklist', ['Chart', 'benchpress', 'bootbox'], function (Chart, Benchpress, bootbox) {
|
||||
define('forum/ip-blacklist', ['Chart', 'benchpress', 'bootbox', 'alerts'], function (Chart, Benchpress, bootbox, alerts) {
|
||||
const Blacklist = {};
|
||||
|
||||
Blacklist.init = function () {
|
||||
@@ -14,9 +14,9 @@ define('forum/ip-blacklist', ['Chart', 'benchpress', 'bootbox'], function (Chart
|
||||
$('[data-action="apply"]').on('click', function () {
|
||||
socket.emit('blacklist.save', blacklist.val(), function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
type: 'success',
|
||||
alert_id: 'blacklist-saved',
|
||||
title: '[[ip-blacklist:alerts.applied-success]]',
|
||||
@@ -29,7 +29,7 @@ define('forum/ip-blacklist', ['Chart', 'benchpress', 'bootbox'], function (Chart
|
||||
rules: blacklist.val(),
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err);
|
||||
}
|
||||
|
||||
Benchpress.render('admin/partials/blacklist-validate', data).then(function (html) {
|
||||
|
||||
@@ -13,10 +13,11 @@ define('forum/topic', [
|
||||
'storage',
|
||||
'hooks',
|
||||
'api',
|
||||
'alerts',
|
||||
], function (
|
||||
infinitescroll, threadTools, postTools,
|
||||
events, posts, navigator, sort,
|
||||
components, storage, hooks, api
|
||||
components, storage, hooks, api, alerts
|
||||
) {
|
||||
const Topic = {};
|
||||
let currentUrl = '';
|
||||
@@ -113,7 +114,7 @@ define('forum/topic', [
|
||||
!config.usePagination ||
|
||||
(config.usePagination && ajaxify.data.pagination.currentPage === 1)
|
||||
) && ajaxify.data.postcount > ajaxify.data.bookmarkThreshold) {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'bookmark',
|
||||
message: '[[topic:bookmark_instructions]]',
|
||||
timeout: 0,
|
||||
@@ -126,7 +127,7 @@ define('forum/topic', [
|
||||
},
|
||||
});
|
||||
setTimeout(function () {
|
||||
app.removeAlert('bookmark');
|
||||
alerts.remove('bookmark');
|
||||
}, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/topic/fork', ['components', 'postSelect'], function (components, postSelect) {
|
||||
define('forum/topic/fork', ['components', 'postSelect', 'alerts'], function (components, postSelect, alerts) {
|
||||
const Fork = {};
|
||||
let forkModal;
|
||||
let forkCommit;
|
||||
@@ -57,10 +57,10 @@ define('forum/topic/fork', ['components', 'postSelect'], function (components, p
|
||||
}
|
||||
forkCommit.removeAttr('disabled');
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
return alerts.error(err.message);
|
||||
}
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
timeout: 5000,
|
||||
title: '[[global:alert.success]]',
|
||||
message: '[[topic:fork_success]]',
|
||||
|
||||
@@ -9,7 +9,8 @@ define('forum/topic/threadTools', [
|
||||
'api',
|
||||
'hooks',
|
||||
'bootbox',
|
||||
], function (components, translator, handleBack, posts, api, hooks, bootbox) {
|
||||
'alerts',
|
||||
], function (components, translator, handleBack, posts, api, hooks, bootbox, alerts) {
|
||||
const ThreadTools = {};
|
||||
|
||||
ThreadTools.init = function (tid, topicContainer) {
|
||||
@@ -149,7 +150,7 @@ define('forum/topic/threadTools', [
|
||||
|
||||
setFollowState(type);
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'follow_thread',
|
||||
message: message,
|
||||
type: 'success',
|
||||
@@ -158,7 +159,7 @@ define('forum/topic/threadTools', [
|
||||
|
||||
hooks.fire('action:topics.changeWatching', { tid: tid, type: type });
|
||||
}, () => {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
type: 'danger',
|
||||
alert_id: 'topic_follow',
|
||||
title: '[[global:please_log_in]]',
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
|
||||
define('coverPhoto', [
|
||||
'alerts',
|
||||
'vendor/jquery/draggable-background/backgroundDraggable',
|
||||
], function () {
|
||||
], function (alerts) {
|
||||
const coverPhoto = {
|
||||
coverEl: null,
|
||||
saveFn: null,
|
||||
@@ -58,7 +59,7 @@ define('coverPhoto', [
|
||||
units: 'percent',
|
||||
});
|
||||
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
alert_id: 'drag_start',
|
||||
title: '[[modules:cover.dragging_title]]',
|
||||
message: '[[modules:cover.dragging_message]]',
|
||||
@@ -75,9 +76,9 @@ define('coverPhoto', [
|
||||
coverPhoto.coverEl.backgroundDraggable('disable');
|
||||
coverPhoto.coverEl.off('dragover', coverPhoto.onDragOver);
|
||||
coverPhoto.coverEl.off('drop', coverPhoto.onDrop);
|
||||
app.alertSuccess('[[modules:cover.saved]]');
|
||||
alerts.success('[[modules:cover.saved]]');
|
||||
} else {
|
||||
app.alertError(err.message);
|
||||
alerts.error(err);
|
||||
}
|
||||
|
||||
coverPhoto.coverEl.removeClass('saving');
|
||||
|
||||
@@ -31,7 +31,7 @@ define('messages', ['bootbox', 'translator', 'storage', 'alerts'], function (boo
|
||||
app.removeAlert('email_confirm');
|
||||
ajaxify.go('user/' + app.user.userslug + '/edit/email');
|
||||
};
|
||||
app.alert(msg);
|
||||
alerts.alert(msg);
|
||||
} else if (!app.user['email:confirmed'] && !app.user.isEmailConfirmSent) {
|
||||
msg.message = message || '[[error:email-not-confirmed]]';
|
||||
msg.clickfn = function () {
|
||||
@@ -43,10 +43,10 @@ define('messages', ['bootbox', 'translator', 'storage', 'alerts'], function (boo
|
||||
app.alertSuccess('[[notifications:email-confirm-sent]]');
|
||||
});
|
||||
};
|
||||
app.alert(msg);
|
||||
alerts.alert(msg);
|
||||
} else if (!app.user['email:confirmed'] && app.user.isEmailConfirmSent) {
|
||||
msg.message = '[[error:email-not-confirmed-email-sent]]';
|
||||
app.alert(msg);
|
||||
alerts.alert(msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
define('search', ['translator', 'storage', 'hooks'], function (translator, storage, hooks) {
|
||||
define('search', ['translator', 'storage', 'hooks', 'alerts'], function (translator, storage, hooks, alerts) {
|
||||
const Search = {
|
||||
current: {},
|
||||
};
|
||||
@@ -45,7 +45,7 @@ define('search', ['translator', 'storage', 'hooks'], function (translator, stora
|
||||
|
||||
searchButton.off('click').on('click', function (e) {
|
||||
if (!config.loggedIn && !app.user.privileges['search:content']) {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
message: '[[error:search-requires-login]]',
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('settings', ['hooks'], function (hooks) {
|
||||
define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
||||
const DEFAULT_PLUGINS = [
|
||||
'settings/checkbox',
|
||||
'settings/number',
|
||||
@@ -310,17 +310,17 @@ define('settings', ['hooks'], function (hooks) {
|
||||
}, function (err) {
|
||||
if (notify) {
|
||||
if (err) {
|
||||
app.alert({
|
||||
title: 'Settings Not Saved',
|
||||
alerts.alert({
|
||||
title: '[[admin/admin:changes-not-saved]]',
|
||||
type: 'danger',
|
||||
message: 'NodeBB failed to save the settings.',
|
||||
message: `[[admin/admin/changes-not-saved-message, ${err.message}]]`,
|
||||
timeout: 5000,
|
||||
});
|
||||
} else {
|
||||
app.alert({
|
||||
title: 'Settings Saved',
|
||||
alerts.alert({
|
||||
title: '[[admin/admin:changes-saved]]',
|
||||
type: 'success',
|
||||
message: 'Settings have been successfully saved',
|
||||
message: '[[admin/admin:changes-saved-message]]',
|
||||
timeout: 2500,
|
||||
});
|
||||
}
|
||||
@@ -460,7 +460,7 @@ define('settings', ['hooks'], function (hooks) {
|
||||
}
|
||||
}
|
||||
if (notSaved.length) {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
title: 'Attributes Not Saved',
|
||||
message: "'" + (notSaved.join(', ')) + "' could not be saved. Please contact the plugin-author!",
|
||||
type: 'danger',
|
||||
@@ -554,13 +554,13 @@ define('settings', ['hooks'], function (hooks) {
|
||||
if (typeof callback === 'function') {
|
||||
callback(err);
|
||||
} else if (err) {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
title: 'Error while saving settings',
|
||||
type: 'error',
|
||||
timeout: 2500,
|
||||
});
|
||||
} else {
|
||||
app.alert({
|
||||
alerts.alert({
|
||||
title: 'Settings Saved',
|
||||
type: 'success',
|
||||
timeout: 2500,
|
||||
|
||||
@@ -99,7 +99,9 @@ socket = window.socket;
|
||||
});
|
||||
});
|
||||
socket.on('event:alert', function (params) {
|
||||
app.alert(params);
|
||||
require(['alerts'], function (alerts) {
|
||||
alerts.alert(params);
|
||||
});
|
||||
});
|
||||
socket.on('event:deprecated_call', function (data) {
|
||||
console.warn('[socket.io] ', data.eventName, 'is now deprecated in favour of', data.replacement);
|
||||
@@ -109,8 +111,8 @@ socket = window.socket;
|
||||
socket.on('event:nodebb.ready', function (data) {
|
||||
if ((data.hostname === app.upstreamHost) && (!app.cacheBuster || app.cacheBuster !== data['cache-buster'])) {
|
||||
app.cacheBuster = data['cache-buster'];
|
||||
|
||||
app.alert({
|
||||
require(['alerts'], function (alerts) {
|
||||
alerts.alert({
|
||||
alert_id: 'forum_updated',
|
||||
title: '[[global:updated.title]]',
|
||||
message: '[[global:updated.message]]',
|
||||
@@ -119,6 +121,7 @@ socket = window.socket;
|
||||
},
|
||||
type: 'warning',
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('event:livereload', function () {
|
||||
|
||||
Reference in New Issue
Block a user