1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Better default README.md content and edit button

This commit is contained in:
Nick O'Leary 2018-01-25 13:30:27 +00:00
parent 0b0005337c
commit 0dd7bc7fb9
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 9 additions and 16 deletions

View File

@ -233,7 +233,7 @@ RED.projects.settings = (function() {
var summaryContent = $('<div></div>',{style:"color: #999"}).appendTo(summary); var summaryContent = $('<div></div>',{style:"color: #999"}).appendTo(summary);
updateProjectSummary(activeProject.summary, summaryContent); updateProjectSummary(activeProject.summary, summaryContent);
if (RED.user.hasPermission("projects.write")) { if (RED.user.hasPermission("projects.write")) {
$('<button class="editor-button editor-button-small" style="float: right;">edit</button>') $('<button class="editor-button editor-button-small" style="float: right;">edit description</button>')
.prependTo(summary) .prependTo(summary)
.click(function(evt) { .click(function(evt) {
evt.preventDefault(); evt.preventDefault();
@ -248,7 +248,7 @@ RED.projects.settings = (function() {
updateProjectDescription(activeProject, descriptionContent); updateProjectDescription(activeProject, descriptionContent);
if (RED.user.hasPermission("projects.write")) { if (RED.user.hasPermission("projects.write")) {
$('<button class="editor-button editor-button-small" style="float: right;">edit</button>') $('<button class="editor-button editor-button-small" style="float: right;">edit README.md</button>')
.prependTo(description) .prependTo(description)
.click(function(evt) { .click(function(evt) {
evt.preventDefault(); evt.preventDefault();

View File

@ -35,8 +35,13 @@ module.exports = {
return JSON.stringify(package,"",4); return JSON.stringify(package,"",4);
}, },
"README.md": function(project) { "README.md": function(project) {
return project.name+"\n"+("=".repeat(project.name.length))+"\n\n"+(project.summary||"A Node-RED Project")+"\n\n"; var content = project.name+"\n"+("=".repeat(project.name.length))+"\n\n";
if (project.summary) {
content += project.summary+"\n\n";
}
content += "### About\n\nThis is your project's README.md file. It helps users understand what your\nproject does, how to use it and anything else they may need to know.";
return content;
}, },
"settings.json": function() { return "{}" },
".gitignore": function() { return "*.backup" ;} ".gitignore": function() { return "*.backup" ;}
} }

View File

@ -46,13 +46,6 @@ describe('storage/localfilesystem/projects/defaultFileSet', function() {
generated.should.match(/A TEST NAME/); generated.should.match(/A TEST NAME/);
generated.should.match(/A TEST SUMMARY/); generated.should.match(/A TEST SUMMARY/);
}); });
it('generates settings.json for a project', function() {
var generated = defaultFileSet["settings.json"]({
name: "A TEST NAME",
summary: "A TEST SUMMARY"
});
generated.length.should.be.greaterThan(0);
});
it('generates .gitignore for a project', function() { it('generates .gitignore for a project', function() {
var generated = defaultFileSet[".gitignore"]({ var generated = defaultFileSet[".gitignore"]({
name: "A TEST NAME", name: "A TEST NAME",
@ -60,9 +53,4 @@ describe('storage/localfilesystem/projects/defaultFileSet', function() {
}); });
generated.length.should.be.greaterThan(0); generated.length.should.be.greaterThan(0);
}); });
}); });