diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb index a958383bf..df3a2b943 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/wikis_controller.rb @@ -24,7 +24,9 @@ class WikisController < ApplicationController # Delete a project's wiki def destroy if request.post? && params[:confirm] && @project.wiki - @project.wiki.destroy + if @project.wiki.destroy + Wiki.create_default_page(@project) unless @wiki + end redirect_to project_path(@project) end end diff --git a/app/models/enabled_module.rb b/app/models/enabled_module.rb index 045e011a5..2a18f918a 100644 --- a/app/models/enabled_module.rb +++ b/app/models/enabled_module.rb @@ -34,7 +34,7 @@ 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.create_default_page(project) end end end diff --git a/app/models/wiki.rb b/app/models/wiki.rb index a86565093..39b807ec1 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -97,6 +97,10 @@ class Wiki < ActiveRecord::Base end end + def self.create_default_page(project) + create(:project => project, :start_page => 'Wiki') + end + # turn a string into a valid page title def self.titleize(title) # replace spaces with _ and remove unwanted caracters diff --git a/app/views/wikis/destroy.html.erb b/app/views/wikis/destroy.html.erb index d996da546..97bd02782 100644 --- a/app/views/wikis/destroy.html.erb +++ b/app/views/wikis/destroy.html.erb @@ -1,7 +1,10 @@

<%=l(:label_confirmation)%>

-

<%= @project.name %>
<%=l(:text_wiki_destroy_confirmation)%>

+

<%= @project.name %>
+ <%=l(:text_wiki_destroy_confirmation)%>
+ <%=l(:text_wiki_destroy_reinitialize_wiki)%> +

<%= form_tag({:controller => 'wikis', :action => 'destroy', :id => @project}) do %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 2378e56d5..c6ab43a16 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1231,6 +1231,7 @@ en: text_issue_added: "Issue %{id} has been reported by %{author}." text_issue_updated: "Issue %{id} has been updated by %{author}." text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content? + text_wiki_destroy_reinitialize_wiki: A new empty Wiki will be automatically created. text_issue_category_destroy_question: "Some issues (%{count}) are assigned to this category. What do you want to do?" text_issue_category_destroy_assignments: Remove category assignments text_issue_category_reassign_to: Reassign issues to this category