Better 'config new' and fix a couple menu refs
This commit is contained in:
parent
f4ccc998f5
commit
60a1f14f6e
|
@ -60,8 +60,8 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher(
|
||||||
this.menuMethods = {
|
this.menuMethods = {
|
||||||
selectMessage : (formData, extraArgs, cb) => {
|
selectMessage : (formData, extraArgs, cb) => {
|
||||||
if(MciViewIds.allViews.msgList === formData.submitId) {
|
if(MciViewIds.allViews.msgList === formData.submitId) {
|
||||||
this.initialFocusIndex = formData.value.messageIndex ||
|
// 'messageIndex' or older deprecated 'message' member
|
||||||
formData.value.message; // older deprecated arg name
|
this.initialFocusIndex = _.get(formData, 'value.messageIndex', formData.value.message);
|
||||||
|
|
||||||
const modOpts = {
|
const modOpts = {
|
||||||
extraArgs : {
|
extraArgs : {
|
||||||
|
@ -108,8 +108,9 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher(
|
||||||
if(MciViewIds.allViews.msgList != formData.submitId) {
|
if(MciViewIds.allViews.msgList != formData.submitId) {
|
||||||
return cb(null);
|
return cb(null);
|
||||||
}
|
}
|
||||||
const messageIndex = formData.value.messageIndex ||
|
|
||||||
formData.value.message; // older, deprecated arg name
|
// newer 'messageIndex' or older deprecated value
|
||||||
|
const messageIndex = _.get(formData, 'value.messageIndex', formData.value.message);
|
||||||
return this.promptDeleteMessageConfirm(messageIndex, cb);
|
return this.promptDeleteMessageConfirm(messageIndex, cb);
|
||||||
},
|
},
|
||||||
deleteMessageYes : (formData, extraArgs, cb) => {
|
deleteMessageYes : (formData, extraArgs, cb) => {
|
||||||
|
|
|
@ -231,11 +231,8 @@ function buildNewConfig() {
|
||||||
.replace(/[^a-z0-9_-]/ig, '_')
|
.replace(/[^a-z0-9_-]/ig, '_')
|
||||||
.replace(/_+/g, '_')
|
.replace(/_+/g, '_')
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
const menuFile = `menus/${boardName}-main.hjson`;
|
|
||||||
|
|
||||||
const mainTemplate = hjson.rt.parse(fs.readFileSync(paths.join(__dirname, '../../misc/menu_templates/main.in.hjson'), 'utf8'));
|
const includeFilesIn = [
|
||||||
|
|
||||||
const includeFiles = [
|
|
||||||
'message_base.in.hjson',
|
'message_base.in.hjson',
|
||||||
'private_mail.in.hjson',
|
'private_mail.in.hjson',
|
||||||
'login.in.hjson',
|
'login.in.hjson',
|
||||||
|
@ -244,8 +241,11 @@ function buildNewConfig() {
|
||||||
'file_base.in.hjson',
|
'file_base.in.hjson',
|
||||||
];
|
];
|
||||||
|
|
||||||
includeFiles.forEach(incFile => {
|
let includeFiles = [];
|
||||||
|
includeFilesIn.forEach(incFile => {
|
||||||
const outName = `${boardName}-${incFile.replace('.in', '')}`;
|
const outName = `${boardName}-${incFile.replace('.in', '')}`;
|
||||||
|
includeFiles.push(outName);
|
||||||
|
|
||||||
copyFileSyncSilent(
|
copyFileSyncSilent(
|
||||||
paths.join(__dirname, '../../misc/menu_templates', incFile),
|
paths.join(__dirname, '../../misc/menu_templates', incFile),
|
||||||
paths.join(__dirname, '../../config/menus', outName),
|
paths.join(__dirname, '../../config/menus', outName),
|
||||||
|
@ -253,24 +253,24 @@ function buildNewConfig() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
mainTemplate.includes = includeFiles.map(incFile => {
|
// We really only need includes to be replaced
|
||||||
return `${boardName}-${incFile.replace('.in', '')}`;
|
const mainTemplate = fs.readFileSync(paths.join(__dirname, '../../misc/menu_templates/main.in.hjson'), 'utf8')
|
||||||
});
|
.replace(/%INCLUDE_FILES%/g, includeFiles.join('\n\t\t')); // cheesy, but works!
|
||||||
|
|
||||||
if (writeConfig(
|
const menuFile = `${boardName}-main.hjson`;
|
||||||
|
fs.writeFileSync(
|
||||||
|
paths.join(__dirname, '../../config/menus', menuFile),
|
||||||
mainTemplate,
|
mainTemplate,
|
||||||
paths.join(__dirname, '../../config/menus', `${boardName}-main.hjson`)))
|
'utf8'
|
||||||
{
|
);
|
||||||
config.general.menuFile = menuFile;
|
|
||||||
|
config.general.menuFile = paths.join(__dirname, '../../config/menus/', menuFile);
|
||||||
|
|
||||||
if(writeConfig(config, configPath)) {
|
if(writeConfig(config, configPath)) {
|
||||||
console.info('Configuration generated');
|
console.info('Configuration generated');
|
||||||
} else {
|
} else {
|
||||||
console.error('Failed writing configuration');
|
console.error('Failed writing configuration');
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.error('Failed writing configuration');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@
|
||||||
module: msg_list
|
module: msg_list
|
||||||
art: NEWMSGS
|
art: NEWMSGS
|
||||||
config: {
|
config: {
|
||||||
menuViewPost: messageBaseViewPost
|
menuViewPost: messageAreaViewPost
|
||||||
}
|
}
|
||||||
form: {
|
form: {
|
||||||
0: {
|
0: {
|
||||||
|
@ -379,7 +379,7 @@
|
||||||
submit: {
|
submit: {
|
||||||
*: [
|
*: [
|
||||||
{
|
{
|
||||||
value: { message: null }
|
value: { messageIndex: null }
|
||||||
action: @method:selectMessage
|
action: @method:selectMessage
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
// You may include as many additional fragments as you like here.
|
// You may include as many additional fragments as you like here.
|
||||||
includes: [
|
includes: [
|
||||||
XXXXXXXX
|
%INCLUDE_FILES%
|
||||||
]
|
]
|
||||||
|
|
||||||
// This section creates common fragments to use as @reference
|
// This section creates common fragments to use as @reference
|
||||||
|
|
|
@ -381,7 +381,7 @@
|
||||||
submit: {
|
submit: {
|
||||||
*: [
|
*: [
|
||||||
{
|
{
|
||||||
value: { message: null }
|
value: { messageIndex: null }
|
||||||
action: @method:selectMessage
|
action: @method:selectMessage
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -427,7 +427,7 @@
|
||||||
submit: {
|
submit: {
|
||||||
*: [
|
*: [
|
||||||
{
|
{
|
||||||
value: { message: null }
|
value: { messageIndex: null }
|
||||||
action: @method:selectMessage
|
action: @method:selectMessage
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -145,7 +145,7 @@
|
||||||
module: msg_list
|
module: msg_list
|
||||||
art: PRVMSGLIST
|
art: PRVMSGLIST
|
||||||
config: {
|
config: {
|
||||||
menuViewPost: messageBaseViewPost
|
menuViewPost: messageAreaViewPost
|
||||||
messageAreaTag: private_mail
|
messageAreaTag: private_mail
|
||||||
}
|
}
|
||||||
form: {
|
form: {
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
submit: {
|
submit: {
|
||||||
*: [
|
*: [
|
||||||
{
|
{
|
||||||
value: { message: null }
|
value: { messageIndex: null }
|
||||||
action: @method:selectMessage
|
action: @method:selectMessage
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue