Skip to content

Commit 22fa586

Browse files
kfischer-okarinRedmine Patch Meetup
authored andcommitted
Add functionality to delete link
1 parent 56ff740 commit 22fa586

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

app/views/wiki/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
1717
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
1818
<% @redirects_to_self.map { |redirect| %>
19-
<%= link_to("Delete redirect from #{WikiPage.pretty_title(redirect.title)}", '', :class => 'icon icon-link-break') %>
19+
<%= link_to("Delete redirect from #{WikiPage.pretty_title(redirect.title)}", {:controller => 'wiki_redirects', :action => 'destroy', :project_id => @project.identifier, :wiki_page_id => @page.title, :id => redirect.id}, :method => :delete, :class => 'icon icon-link-break') %>
2020
<% } %>
2121
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %>
2222
<% else %>

test/functional/wiki_controller_test.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,20 +231,23 @@ def test_show_delete_redirect_links
231231
@request.session[:user_id] = 2
232232

233233
wiki_page = WikiPage.find_by(title: 'CookBook_documentation')
234-
second_title = 'Old_Cookbook'
235-
wiki_page.title = second_title
234+
wiki_page.title = 'Old_Cookbook'
236235
wiki_page.save
237236

238-
new_title = 'New_Cookbook'
239-
wiki_page.title = new_title
237+
wiki_page.title = 'New_Cookbook'
240238
wiki_page.save
241239

242-
get :show, :params => {:project_id => 'ecookbook', :id => new_title}
240+
cookbook_doc_redirect = WikiRedirect.find_by(title: 'CookBook_documentation', redirects_to: 'New_Cookbook')
241+
old_cookbook_redirect = WikiRedirect.find_by(title: 'Old_Cookbook', redirects_to: 'New_Cookbook')
242+
243+
get :show, :params => {:project_id => 'ecookbook', :id => 'New_Cookbook'}
243244

244245
assert_select '.drdn-items' do
245-
assert_select 'a.icon-link-break',
246+
assert_select 'a.icon-link-break[href=?]',
247+
"/projects/ecookbook/wiki/New_Cookbook/redirects/#{cookbook_doc_redirect.id}",
246248
text: 'Delete redirect from CookBook documentation'
247-
assert_select 'a.icon-link-break',
249+
assert_select 'a.icon-link-break[href=?]',
250+
"/projects/ecookbook/wiki/New_Cookbook/redirects/#{old_cookbook_redirect.id}",
248251
text: 'Delete redirect from Old Cookbook'
249252
end
250253
end

0 commit comments

Comments
 (0)