This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
// addComponentToModule('./src/library/library.module.js', 'Module', '', '', 'new-component', 'newComponent', 'NewComponent'); | |
// addComponentToModule('./src/docs/docs.module.js', 'Demo', 'demos/', '-demo', 'new-component', 'newComponent', 'NewComponent'); | |
// addComponentToDemoHtml('new-component', 'newComponent', 'NewComponent'); | |
module.exports.addComponentToModule = function addComponentToModule(filename, variableSuffix, importPrefix, importSuffix, componentName, camelName, capitalName) { | |
// read the file | |
let content = fs.readFileSync(filename, 'utf8'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create instead of edit | |
$('form#user-list-form').get(0).action = location.href.replace(/lists(.*)/, 'lists/create/'); | |
// add positions | |
$('ul#user_list_items li').each(function(index, element) { | |
$(element) | |
.find('input:first') | |
.after('<input type="number" name="user_list[items][' + index + '][position]" value="' + (index + 1) + '">'); | |
}); |