Project

General

Profile

Defect #34634 » 34634.patch

Marius BĂLTEANU, 2022-03-21 22:44

View differences:

app/controllers/wikis_controller.rb
# 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
app/models/enabled_module.rb
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
app/models/wiki.rb
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
app/views/wikis/destroy.html.erb
<h2><%=l(:label_confirmation)%></h2>
<div class="warning">
<p><strong><%= @project.name %></strong><br /><%=l(:text_wiki_destroy_confirmation)%></p>
<p><strong><%= @project.name %></strong><br />
<%=l(:text_wiki_destroy_confirmation)%><br />
<%=l(:text_wiki_destroy_reinitialize_wiki)%>
</p>
</div>
<%= form_tag({:controller => 'wikis', :action => 'destroy', :id => @project}) do %>
config/locales/en.yml
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
(2-2/2)