mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-14 17:56:16 +01:00
settings - automated table of contents
This commit is contained in:
@@ -8,6 +8,16 @@ define('admin/settings', ['uploader', 'sounds'], function(uploader, sounds) {
|
||||
$(window).on('action:config.loaded', Settings.prepare);
|
||||
};
|
||||
|
||||
Settings.populateTOC = function() {
|
||||
$('.settings-header').each(function() {
|
||||
var header = $(this).text(),
|
||||
anchor = header.toLowerCase().replace(/ /g, '-').trim();
|
||||
|
||||
$(this).prepend('<a name="' + anchor + '"></a>');
|
||||
$('.section-content ul').append('<li><a href="#' + anchor + '">' + header + '</a></li>');
|
||||
});
|
||||
};
|
||||
|
||||
Settings.prepare = function(callback) {
|
||||
// Populate the fields on the page from the config
|
||||
var fields = $('#content [data-field]'),
|
||||
|
||||
Reference in New Issue
Block a user