`admin/extend` JS translations and misc

v1.18.x
Peter Jaszkowiak 8 years ago committed by Julian Lam
parent 38eba81933
commit 95bef8f3f6

@ -3,6 +3,8 @@
"active": "Active",
"inactive": "Inactive",
"out-of-date": "Out of Date",
"none-found": "No plugins found.",
"none-active": "No Active Plugins",
"find-plugins": "Find Plugins",
"plugin-search": "Plugin Search",
@ -25,5 +27,20 @@
"plugin-item.upgrade": "Upgrade",
"plugin-item.more-info": "For more information:",
"plugin-item.unknown": "Unknown",
"plugin-item.unknown-explanation": "The state of this plugin could not be determined, possibly due to a misconfiguration error."
"plugin-item.unknown-explanation": "The state of this plugin could not be determined, possibly due to a misconfiguration error.",
"alert.enabled": "Plugin Enabled",
"alert.disabled": "Plugin Disabled",
"alert.upgraded": "Plugin Upgraded",
"alert.installed": "Plugin Installed",
"alert.uninstalled": "Plugin Uninstalled",
"alert.activate-success": "Please restart your NodeBB to fully activate this plugin",
"alert.deactivate-success": "Plugin successfully deactivated",
"alert.upgrade-success": "Please reload your NodeBB to fully upgrade this plugin",
"alert.install-success": "Plugin successfully installed, please activate the plugin.",
"alert.uninstall-success": "The plugin has been successfully deactivated and uninstalled.",
"alert.suggest-error": "<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class=\"alert alert-danger\"><strong>Server returned (%1)</strong>: %2</div>",
"alert.package-manager-unreachable": "<p>NodeBB could not reach the package manager, an upgrade is not suggested at this time.</p>",
"alert.incompatible": "<p>Your version of NodeBB (v%1) is only cleared to upgrade to v%2 of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.</p>",
"alert.possibly-incompatible": "<div class=\"alert alert-warning\"><p><strong>No Compatibility Information Found</strong></p><p>This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.</p></div><p>In the event that NodeBB cannot boot properly:</p><pre><code>$ ./nodebb reset plugin=\"%1\"</code></pre><p>Continue installation of latest version of this plugin?</p>"
}

@ -9,5 +9,9 @@
"enable": "Enable",
"disable": "Disable",
"control-panel": "Rewards Control",
"new-reward": "New Reward"
"new-reward": "New Reward",
"alert.delete-success": "Successfully deleted reward",
"alert.no-inputs-found": "Illegal reward - no inputs found!",
"alert.save-success": "Successfully saved rewards"
}

@ -10,5 +10,10 @@
"container.panel": "Panel",
"container.panel-header": "Panel Header",
"container.panel-body": "Panel Body",
"container.alert": "Alert"
"container.alert": "Alert",
"alert.confirm-delete": "Are you sure you wish to delete this widget?",
"alert.updated": "Widgets Updated",
"alert.update-success": "Successfully updated widgets"
}

@ -39,29 +39,27 @@ define('admin/appearance/themes', ['translator'], function (translator) {
});
}
});
translator.translate('[[admin/appearance/themes:revert-confirm]]', function (revert) {
$('#revert_theme').on('click', function () {
bootbox.confirm(revert, function (confirm) {
if (confirm) {
socket.emit('admin.themes.set', {
type: 'local',
id: 'nodebb-theme-persona'
}, function (err) {
if (err) {
return app.alertError(err.message);
}
highlightSelectedTheme('nodebb-theme-persona');
app.alert({
alert_id: 'admin:theme',
type: 'success',
title: '[[admin/appearance/themes:theme-changed]]',
message: '[[admin/appearance/themes:revert-success]]',
timeout: 3500
});
$('#revert_theme').on('click', function () {
bootbox.confirm('[[admin/appearance/themes:revert-confirm]]', function (confirm) {
if (confirm) {
socket.emit('admin.themes.set', {
type: 'local',
id: 'nodebb-theme-persona'
}, function (err) {
if (err) {
return app.alertError(err.message);
}
highlightSelectedTheme('nodebb-theme-persona');
app.alert({
alert_id: 'admin:theme',
type: 'success',
title: '[[admin/appearance/themes:theme-changed]]',
message: '[[admin/appearance/themes:revert-success]]',
timeout: 3500
});
}
});
});
}
});
});

@ -1,7 +1,7 @@
"use strict";
/* global define, app, socket, bootbox */
define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
define('admin/extend/plugins', ['jqueryui', 'translator'], function (jqueryui, translator) {
var Plugins = {};
Plugins.init = function () {
var pluginsList = $('.plugins'),
@ -9,7 +9,9 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
pluginID;
if (!numPlugins) {
pluginsList.append('<li><p><i>No plugins found.</i></p></li>');
translator.translate('<li><p><i>[[admin/extend/plugins:none-found]]</i></p></li>', function (html) {
pluginsList.append(html);
});
return;
}
@ -23,25 +25,27 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
if (err) {
return app.alertError(err);
}
btn.html('<i class="fa fa-power-off"></i> ' + (status.active ? 'Deactivate' : 'Activate'));
btn.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active);
//clone it to active plugins tab
if (status.active && !$('#active #' + pluginID).length) {
$('#active ul').prepend(pluginEl.clone(true));
}
translator.translate('<i class="fa fa-power-off"></i> [[admin/extend/plugins:plugin-item.' + (status.active ? 'deactivate' : 'activate') + ']]', function (buttonText) {
btn.html(buttonText);
btn.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active);
app.alert({
alert_id: 'plugin_toggled',
title: 'Plugin ' + (status.active ? 'Enabled' : 'Disabled'),
message: status.active ? 'Please restart your NodeBB to fully activate this plugin' : 'Plugin successfully deactivated',
type: status.active ? 'warning' : 'success',
timeout: 5000,
clickfn: function () {
require(['admin/modules/instance'], function (instance) {
instance.restart();
});
//clone it to active plugins tab
if (status.active && !$('#active #' + pluginID).length) {
$('#active ul').prepend(pluginEl.clone(true));
}
app.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') + ']]',
type: status.active ? 'warning' : 'success',
timeout: 5000,
clickfn: function () {
require(['admin/modules/instance'], function (instance) {
instance.restart();
});
}
});
});
});
});
@ -57,7 +61,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
Plugins.suggest(pluginID, function (err, payload) {
if (err) {
bootbox.confirm('<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class="alert alert-danger"><strong>Server returned (' + err.status + ')</strong>: ' + err.responseText + '</div>', function (confirm) {
bootbox.confirm(translator.compile('admin/extend/plugins:alert.suggest-error', err.status, err.responseText), function (confirm) {
if (confirm) {
Plugins.toggleInstall(pluginID, 'latest');
} else {
@ -92,7 +96,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
Plugins.suggest(pluginID, function (err, payload) {
if (err) {
return bootbox.alert('<p>NodeBB could not reach the package manager, an upgrade is not suggested at this time.</p>');
return bootbox.alert('[[admin/extend/plugins:alert.package-manager-unreachable]]');
}
require(['semver'], function (semver) {
@ -103,7 +107,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
upgrade(pluginID, btn, payload.version);
});
} else {
bootbox.alert('<p>Your version of NodeBB (v' + app.config.version + ') is only cleared to upgrade to v' + payload.version + ' of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.');
bootbox.alert(translator.compile('admin/extend/plugins:alert.incompatible', app.config.version, payload.version));
}
});
});
@ -128,7 +132,10 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
html += '<li class="">' + plugin + '</li>';
});
if (!activePlugins.length) {
html = 'No Active Plugins';
translator.translate('[[admin/extend/plugins:none-active]]', function (text) {
$('#order-active-plugins-modal .plugin-list').html(text).sortable();
});
return;
}
$('#order-active-plugins-modal .plugin-list').html(html).sortable();
});
@ -154,11 +161,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
};
function confirmInstall(pluginID, callback) {
bootbox.confirm(
'<div class="alert alert-warning"><p><strong>No Compatibility Infomation Found</strong></p><p>This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.</p></div>' +
'<p>In the event that NodeBB cannot boot properly:</p>' +
'<pre><code>$ ./nodebb reset plugin="' + pluginID + '"</code></pre>' +
'<p>Continue installation of latest version of this plugin?</p>', function (confirm) {
bootbox.confirm(translator.compile('admin/extend/plugins:alert.possibly-incompatible', pluginID), function (confirm) {
callback(confirm);
});
}
@ -179,8 +182,8 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
if (isActive) {
app.alert({
alert_id: 'plugin_upgraded',
title: 'Plugin Upgraded',
message: 'Please reload your NodeBB to fully upgrade this plugin',
title: '[[admin/extend/plugins:alert.upgraded]]',
message: '[[admin/extend/plugins:alert.upgrade-success]]',
type: 'warning',
timeout: 5000,
clickfn: function () {
@ -211,8 +214,8 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
app.alert({
alert_id: 'plugin_toggled',
title: 'Plugin ' + (pluginData.installed ? 'Installed' : 'Uninstalled'),
message: pluginData.installed ? 'Plugin successfully installed, please activate the plugin.' : 'The plugin has been successfully deactivated and uninstalled.',
title: '[[admin/extend/plugins:alert.' + (pluginData.installed ? 'installed' : 'uninstalled') + ']]',
message: '[[admin/extend/plugins:alert.' + (pluginData.installed ? 'install-success' : 'uninstall-success') + ']]',
type: 'info',
timeout: 5000
});

@ -32,7 +32,7 @@ define('admin/extend/rewards', ['translator'], function (translator) {
if (err) {
app.alertError(err.message);
} else {
app.alertSuccess('Successfully deleted reward');
app.alertSuccess('[[admin/extend/rewards:alert.delete-success]]');
}
});
@ -43,8 +43,9 @@ define('admin/extend/rewards', ['translator'], function (translator) {
var btn = $(this),
disabled = btn.hasClass('btn-success'),
id = $(this).parents('[data-id]').attr('data-id');
btn.toggleClass('btn-warning').toggleClass('btn-success').html(disabled ? 'Disable' : 'Enable');
translator.translate('[[admin/extend/rewards:' + disabled ? 'disable' : 'enable' + ']]', function (text) {
btn.toggleClass('btn-warning').toggleClass('btn-success').html(text);
});
// send disable api call
return false;
});
@ -90,7 +91,7 @@ define('admin/extend/rewards', ['translator'], function (translator) {
}
if (!inputs) {
return app.alertError('Illegal reward - no inputs found! ' + el.attr('data-selected'));
return app.alertError('[[admin/extend/rewards:alert.no-inputs-found]] ' + el.attr('data-selected'));
}
inputs.forEach(function (input) {
@ -176,7 +177,7 @@ define('admin/extend/rewards', ['translator'], function (translator) {
if (err) {
app.alertError(err.message);
} else {
app.alertSuccess('Successfully saved rewards');
app.alertSuccess('[[admin/extend/rewards:alert.save-success]]');
}
});
}

@ -1,5 +1,5 @@
"use strict";
/* global define, app, socket */
/* global define, app, socket, bootbox */
define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
var Widgets = {};
@ -61,7 +61,7 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
}).on('click', '.delete-widget', function () {
var panel = $(this).parents('.widget-panel');
bootbox.confirm('Are you sure you wish to delete this widget?', function (confirm) {
bootbox.confirm('[[admin/extend/widgets:alert.confirm-delete]]', function (confirm) {
if (confirm) {
panel.remove();
}
@ -125,8 +125,8 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
app.alert({
alert_id: 'admin:widgets',
type: 'success',
title: 'Widgets Updated',
message: 'Successfully updated widgets',
title: '[[admin/extend/widgets:alert.updated]]',
message: '[[admin/extend/widgets:alert.update-success]]',
timeout: 2500
});
}

@ -58,7 +58,7 @@
<div class="panel-heading">[[admin/extend/plugins:dev-interested]]</div>
<div class="panel-body">
<p>
[[admin/extend/plugins:documentation-info]]
[[admin/extend/plugins:docs-info]]
</p>
</div>
</div>

@ -2,7 +2,7 @@
<li id="{installed.id}" data-plugin-id="{installed.id}" data-version="{installed.version}" class="clearfix <!-- IF installed.active -->active<!-- ENDIF installed.active -->">
<div class="pull-right controls">
<!-- IF installed.isTheme -->
<a href="{config.relative_path}/admin/appearance/themes" class="btn btn-info">[[admin/extend/plugins:themes]]</a>
<a href="{config.relative_path}/admin/appearance/themes" class="btn btn-info">[[admin/extend/plugins:plugin-item.themes]]</a>
<!-- ELSE -->
<button data-action="toggleActive" class="btn <!-- IF installed.active --> btn-warning<!-- ELSE --> btn-success<!-- ENDIF installed.active -->">
<i class="fa fa-power-off"></i> <!-- IF installed.active -->[[admin/extend/plugins:plugin-item.deactivate]]<!-- ELSE -->[[admin/extend/plugins:plugin-item.activate]]<!-- ENDIF installed.active --></button>

Loading…
Cancel
Save