mirror of
https://hk.gh-proxy.com/https://github.com/NodeBB/nodebb-plugin-category-notifications.git
synced 2025-10-03 09:10:59 +08:00
refactor: v2 compatibility
This commit is contained in:
parent
f6f4925262
commit
06b28abc63
6 changed files with 1111 additions and 26 deletions
|
@ -4,7 +4,7 @@ const routes = module.exports;
|
|||
|
||||
routes.init = function (params) {
|
||||
const routesHelpers = require.main.require('./src/routes/helpers');
|
||||
routesHelpers.setupAdminPageRoute(params.router, '/admin/plugins/category-notifications', params.middleware, [], (req, res) => {
|
||||
routesHelpers.setupAdminPageRoute(params.router, '/admin/plugins/category-notifications', (req, res) => {
|
||||
res.render('admin/plugins/category-notifications', {});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -27,6 +27,6 @@
|
|||
"eslint-plugin-import": "2.25.4"
|
||||
},
|
||||
"nbbpm": {
|
||||
"compatibility": "^1.17.0"
|
||||
"compatibility": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
"scripts": [
|
||||
"public/scripts/client.js"
|
||||
],
|
||||
"modules": {
|
||||
"../admin/plugins/category-notifications.js": "public/scripts/admin.js"
|
||||
},
|
||||
"templates": "./public/templates",
|
||||
"languages": "languages",
|
||||
"defaultLang": "en-GB"
|
||||
|
|
24
public/scripts/admin.js
Normal file
24
public/scripts/admin.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
define('admin/plugins/category-notifications', [
|
||||
'settings', 'alerts',
|
||||
], function (settings, alerts) {
|
||||
var ACP = {};
|
||||
|
||||
ACP.init = function () {
|
||||
settings.load('category-notifications', $('.category-notifications-settings'));
|
||||
$('#save').on('click', saveSettings);
|
||||
};
|
||||
|
||||
function saveSettings() {
|
||||
settings.save('category-notifications', $('.category-notifications-settings'), function () {
|
||||
alerts.alert({
|
||||
type: 'success',
|
||||
alert_id: 'category-notifications-saved',
|
||||
title: 'Settings Saved',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return ACP;
|
||||
});
|
|
@ -16,27 +16,6 @@
|
|||
</div>
|
||||
</form>
|
||||
|
||||
<button class="btn btn-primary" id="save">Save</button>
|
||||
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
/* globals app */
|
||||
require(['settings'], function(Settings) {
|
||||
Settings.load('category-notifications', $('.category-notifications-settings'), function(err, settings) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
});
|
||||
|
||||
$('#save').on('click', function() {
|
||||
Settings.save('category-notifications', $('.category-notifications-settings'), function(err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
app.alertSuccess('Saved');
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<button id="save" class="floating-button mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
|
||||
<i class="material-icons">save</i>
|
||||
</button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue