[issue #64] Added Wiki seeding on create.

This commit is contained in:
George Vinogradov 2012-01-19 16:06:27 +04:00
parent a03690a9f7
commit 022a013b79
3 changed files with 20 additions and 1 deletions

View File

@ -164,7 +164,12 @@ class Project < ActiveRecord::Base
end
def create_wiki
Grit::Repo.init_bare(wiki_path) if has_wiki && !FileTest.exist?(wiki_path)
if has_wiki && !FileTest.exist?(wiki_path)
Grit::Repo.init_bare(wiki_path)
wiki = Gollum::Wiki.new(wiki_path, {:base_path => Rails.application.routes.url_helpers.project_wiki_index_path(self)})
wiki.write_page('Home', :markdown, I18n.t("wiki.seed.welcome_content"),
{:name => owner.name, :email => owner.email, :message => 'Initial commit'})
end
end
def destroy_wiki

View File

@ -0,0 +1,7 @@
en:
wiki:
seed:
welcome_content: |
# Welcome to **Wiki** #
Edit this page and create new ones.

View File

@ -0,0 +1,7 @@
ru:
wiki:
seed:
welcome_content: |
# Добро пожаловать в **Wiki** #
Отредактируйте эту страницу и создайте новые.