From 68015771478d2a8234cdc96718153bf6503b5753 Mon Sep 17 00:00:00 2001 From: Romano Licker Date: Thu, 30 Aug 2012 17:36:12 +0200 Subject: [PATCH] automatically create a wiki menu item when the module 'wiki' is activated --- app/models/enabled_module.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/enabled_module.rb b/app/models/enabled_module.rb index 62023d6057..c1bf8cd5d5 100644 --- a/app/models/enabled_module.rb +++ b/app/models/enabled_module.rb @@ -30,7 +30,14 @@ class EnabledModule < ActiveRecord::Base when 'wiki' # Create a wiki with a default start page if project && project.wiki.nil? - Wiki.create(:project => project, :start_page => 'Wiki') + wiki = Wiki.create(:project => project, :start_page => 'Wiki') + + wiki_menu_item = WikiMenuItem.find_or_initialize_by_wiki_id_and_title(wiki.id, wiki.start_page) + wiki_menu_item.name = 'Wiki' + wiki_menu_item.new_wiki_page = true + wiki_menu_item.index_page = true + + wiki_menu_item.save! end end end