Patch #1103 ยป a.patch
app/controllers/wiki_controller.rb | ||
---|---|---|
119 | 119 |
@annotate = @page.annotate(params[:version]) |
120 | 120 |
end |
121 | 121 |
|
122 |
def delete |
|
123 |
@page = @wiki.find_page(params[:page]) |
|
124 |
@page.delete_version(params[:version]) if @page |
|
125 |
redirect_to :action => 'history', :id => @project, :page => @page.title |
|
126 |
end |
|
127 |
|
|
122 | 128 |
# remove a wiki page and its history |
123 | 129 |
def destroy |
124 | 130 |
@page = @wiki.find_page(params[:page]) |
app/models/wiki_page.rb | ||
---|---|---|
71 | 71 |
WikiPage.pretty_title(title) |
72 | 72 |
end |
73 | 73 |
|
74 |
def delete_version(version) |
|
75 |
content.versions.find_by_version(version.to_i) |
|
76 |
end |
|
77 | ||
74 | 78 |
def content_for_version(version=nil) |
75 | 79 |
result = content.versions.find_by_version(version.to_i) if version |
76 | 80 |
result ||= content |
app/views/wiki/history.rhtml | ||
---|---|---|
12 | 12 |
<th><%= l(:field_author) %></th> |
13 | 13 |
<th><%= l(:field_comments) %></th> |
14 | 14 |
<th></th> |
15 |
<th></th> |
|
15 | 16 |
</tr></thead> |
16 | 17 |
<tbody> |
17 | 18 |
<% show_diff = @versions.size > 1 %> |
... | ... | |
25 | 26 |
<td><em><%= ver.author ? ver.author.name : "anonyme" %></em></td> |
26 | 27 |
<td><%=h ver.comments %></td> |
27 | 28 |
<td align="center"><%= link_to l(:button_annotate), :action => 'annotate', :page => @page.title, :version => ver.version %></td> |
29 |
<td align="center"><%= if line_num != 1 then link_to l(:button_delete), :action => 'delete', :page => @page.title, :version => ver.version end %></td> |
|
28 | 30 |
</tr> |
29 | 31 |
<% line_num += 1 %> |
30 | 32 |
<% end %> |
lib/redmine.rb | ||
---|---|---|
72 | 72 |
map.project_module :wiki do |map| |
73 | 73 |
map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member |
74 | 74 |
map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
75 |
map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member
|
|
75 |
map.permission :delete_wiki_pages, {:wiki => [:destroy, :delete]}, :require => :member
|
|
76 | 76 |
map.permission :view_wiki_pages, :wiki => [:index, :history, :diff, :annotate, :special] |
77 | 77 |
map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment] |
78 | 78 |
end |