From 5d10423c40913c5e7f13e0bb60a9552029a8bf44 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 24 Apr 2020 16:39:09 +0000 Subject: [PATCH] [Admin Tools | Trunk]: Add on scripts new FAQs page. --- init_db.js | 1 + update_db.js | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/init_db.js b/init_db.js index 9834566..7be41e1 100755 --- a/init_db.js +++ b/init_db.js @@ -45,6 +45,7 @@ print("\n\n Initialize entities and pages\n\n") // Other Pages for Connect db.page.save({"name" : "About - Learn How", "route" : "/about/learn-how", "type" : "other", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":true,"bottom":false,"right":false,"left":false}); db.page.save({"name" : "About - Learn in depth", "route" : "/about/learn-in-depth", "type" : "other", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":true,"bottom":false,"right":false,"left":false}); + db.page.save({"name" : "About - FAQs", "route" : "/about/faq", "type" : "other", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":true,"bottom":false,"right":false,"left":false}); db.page.save({"name" : "Contact us", "route" : "/contact-us", "type" : "other", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":false,"bottom":false,"right":true,"left":false}); db.page.save({"name" : "Content Policy", "route" : "/content", "type" : "other", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":true,"bottom":false,"right":false,"left":false}); diff --git a/update_db.js b/update_db.js index 23daa59..f069223 100644 --- a/update_db.js +++ b/update_db.js @@ -1559,6 +1559,31 @@ function removeContentPolicyPageAndAddHelpTextInCommunitiesSourcesPage() { } } +function addFAQsPage() { + db.page.save({"name" : "About - FAQs", + "route" : "/about/faq", + "type" : "other", + "connect":true, + "communities":false, + "openaire":false, + "entities" : [], + "top":true, + "bottom":false, + "right":false, + "left":false + }); + faq = db.page.find( { route: "/about/faq" }).map( function(page) { return page._id.str; } ).toString(); + communities = db.community.find().map( function(community) { return community; } ); + for (var i = 0; i < communities.length; i++) { + community_pages = communities[i].pages; + + community_pages[faq] = true; + community_pid = communities[i].pid; + db.community.update({ "pid" : community_pid },{$set: { "pages": community_pages}}); + print("Update pages for " + community_pid); + } +} + use openaire_admin; //updatePages(); @@ -1626,6 +1651,9 @@ use openaire_admin; //addSearchResearchOutcomesPages(); // 10-04-2020 -createNewPagesForConnect(); -createNewPagesForCommunities(); -removeContentPolicyPageAndAddHelpTextInCommunitiesSourcesPage(); \ No newline at end of file +// createNewPagesForConnect(); +// createNewPagesForCommunities(); +// removeContentPolicyPageAndAddHelpTextInCommunitiesSourcesPage(); + +//24-04-2020 +addFAQsPage(); \ No newline at end of file