Sfoglia il codice sorgente

create /Sandbox when installed

Yuki Takei 8 anni fa
parent
commit
15d8299473
1 ha cambiato i file con 14 aggiunte e 4 eliminazioni
  1. 14 4
      lib/routes/installer.js

+ 14 - 4
lib/routes/installer.js

@@ -11,6 +11,18 @@ module.exports = function(crowi, app) {
 
     , actions = {};
 
+  function createInitialPages(owner, lang) {
+    // create portal page for '/'
+    const welcomeMarkdownPath = path.join(crowi.localeDir, lang, 'welcome.md');
+    const welcomeMarkdown = fs.readFileSync(welcomeMarkdownPath);
+    Page.create('/', welcomeMarkdown, owner, {});
+
+    // create /Sandbox
+    const sandboxMarkdownPath = path.join(crowi.localeDir, lang, 'sandbox.md');
+    const sandboxMarkdown = fs.readFileSync(sandboxMarkdownPath);
+    Page.create('/Sandbox', sandboxMarkdown, owner, {});
+  }
+
   actions.index = function(req, res) {
     return res.render('installer');
   };
@@ -49,10 +61,8 @@ module.exports = function(crowi, app) {
             });
           });
 
-          // create portal page for '/'
-          const welcomeMarkdownPath = path.join(crowi.localeDir, language, 'welcome.md');
-          const welcomeMarkdown = fs.readFileSync(welcomeMarkdownPath);
-          Page.create('/', welcomeMarkdown, userData, {});
+          // create initial pages
+          createInitialPages(userData, language);
         });
       });
     } else {