From 0dd7bc7fb9d1615257417a8b586486ac333b1b83 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 25 Jan 2018 13:30:27 +0000 Subject: [PATCH] Better default README.md content and edit button --- editor/js/ui/projects/projectSettings.js | 4 ++-- .../localfilesystem/projects/defaultFileSet.js | 9 +++++++-- .../localfilesystem/projects/defaultFileSet_spec.js | 12 ------------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/editor/js/ui/projects/projectSettings.js b/editor/js/ui/projects/projectSettings.js index 696bfb025..8cb440d85 100644 --- a/editor/js/ui/projects/projectSettings.js +++ b/editor/js/ui/projects/projectSettings.js @@ -233,7 +233,7 @@ RED.projects.settings = (function() { var summaryContent = $('
',{style:"color: #999"}).appendTo(summary); updateProjectSummary(activeProject.summary, summaryContent); if (RED.user.hasPermission("projects.write")) { - $('') + $('') .prependTo(summary) .click(function(evt) { evt.preventDefault(); @@ -248,7 +248,7 @@ RED.projects.settings = (function() { updateProjectDescription(activeProject, descriptionContent); if (RED.user.hasPermission("projects.write")) { - $('') + $('') .prependTo(description) .click(function(evt) { evt.preventDefault(); diff --git a/red/runtime/storage/localfilesystem/projects/defaultFileSet.js b/red/runtime/storage/localfilesystem/projects/defaultFileSet.js index 7f29b8fc0..12368ec75 100644 --- a/red/runtime/storage/localfilesystem/projects/defaultFileSet.js +++ b/red/runtime/storage/localfilesystem/projects/defaultFileSet.js @@ -35,8 +35,13 @@ module.exports = { return JSON.stringify(package,"",4); }, "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" ;} } diff --git a/test/red/runtime/storage/localfilesystem/projects/defaultFileSet_spec.js b/test/red/runtime/storage/localfilesystem/projects/defaultFileSet_spec.js index d84a3de7f..130e5c15b 100644 --- a/test/red/runtime/storage/localfilesystem/projects/defaultFileSet_spec.js +++ b/test/red/runtime/storage/localfilesystem/projects/defaultFileSet_spec.js @@ -46,13 +46,6 @@ describe('storage/localfilesystem/projects/defaultFileSet', function() { generated.should.match(/A TEST NAME/); 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() { var generated = defaultFileSet[".gitignore"]({ name: "A TEST NAME", @@ -60,9 +53,4 @@ describe('storage/localfilesystem/projects/defaultFileSet', function() { }); generated.length.should.be.greaterThan(0); }); - - - - - });