html.html_safe
end
+ def delete_link(url, options={})
+ options = {
+ :method => :delete,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'icon icon-del'
+ }.merge(options)
+
+ link_to l(:button_delete), url, options
+ end
+
def back_url_hidden_field_tag
back_url = params[:back_url] || request.env['HTTP_REFERER']
back_url = CGI.unescape(back_url.to_s)
<td align="center"><%= checked_image project.is_public? %></td>
<td align="center"><%= format_date(project.created_on) %></td>
<td class="buttons">
- <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-lock') unless project.archived? %>
+ <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% if options[:deletable] %>
<%= link_to image_tag('delete.png'), attachment_path(attachment),
- :confirm => l(:text_are_you_sure),
+ :data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => 'delete',
:title => l(:button_delete) %>
<td align="center"><%= h source.users.count %></td>
<td class="buttons">
<%= link_to l(:button_test), {:action => 'test_connection', :id => source}, :class => 'icon icon-test' %>
- <%= link_to l(:button_delete), { :action => 'destroy', :id => source },
- :method => :delete,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del',
- :disabled => source.users.any? %>
+ <%= delete_link auth_source_path(source) %>
</td>
</tr>
<% end %>
:class => 'icon-copy', :disabled => !@can[:move] %></li>
<% end %>
<li><%= context_menu_link l(:button_delete), issues_path(:ids => @issues.collect(&:id), :back_url => @back),
- :method => :delete, :confirm => issues_destroy_confirmation_message(@issues), :class => 'icon-del', :disabled => !@can[:delete] %></li>
+ :method => :delete, :data => {:confirm => issues_destroy_confirmation_message(@issues)}, :class => 'icon-del', :disabled => !@can[:delete] %></li>
<%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
</ul>
<li>
<%= context_menu_link l(:button_delete),
{:controller => 'timelog', :action => 'destroy', :ids => @time_entries.collect(&:id), :back_url => @back},
- :method => :delete, :confirm => l(:text_time_entries_destroy_confirmation), :class => 'icon-del', :disabled => !@can[:delete] %>
+ :method => :delete, :data => {:confirm => l(:text_time_entries_destroy_confirmation)}, :class => 'icon-del', :disabled => !@can[:delete] %>
</li>
</ul>
<% end %>
<td align="center" style="width:15%;"><%= reorder_links('custom_field', {:action => 'update', :id => custom_field}, :put) %></td>
<td class="buttons">
- <%= link_to(l(:button_delete), custom_field_path(custom_field),
- :method => :delete,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del') %>
+ <%= delete_link custom_field_path(custom_field) %>
</td>
</tr>
<% end; reset_cycle %>
<div class="contextual">
<% if User.current.allowed_to?(:manage_documents, @project) %>
<%= link_to l(:button_edit), edit_document_path(@document), :class => 'icon icon-edit', :accesskey => accesskey(:edit) %>
-<%= link_to l(:button_delete), document_path(@document), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
+<%= delete_link document_path(@document) %>
<% end %>
</div>
<td class="center" style="width:15%;"><%= checked_image enumeration.active? %></td>
<td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}, :put) %></td>
<td class="buttons">
- <%= link_to l(:button_delete), enumeration_path(enumeration),
- :method => :delete,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del' %>
+ <%= delete_link enumeration_path(enumeration) %>
</td>
</tr>
<% end %>
<td class="digest"><%= file.digest %></td>
<td align="center">
<%= link_to(image_tag('delete.png'), attachment_path(file),
- :confirm => l(:text_are_you_sure), :method => :delete) if delete_allowed %>
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td>
</tr>
<% end
<tr class="<%= cycle 'odd', 'even' %>">
<td><%= link_to h(group), edit_group_path(group) %></td>
<td align="center"><%= group.users.size %></td>
- <td class="buttons"><%= link_to l(:button_delete), group, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %></td>
+ <td class="buttons"><%= delete_link group %></td>
</tr>
<% end %>
</table>
<div class="contextual">
<%= link_to l(:label_issue_status_new), new_issue_status_path, :class => 'icon icon-add' %>
-<%= link_to(l(:label_update_issue_done_ratios), update_issue_done_ratio_issue_statuses_path, :class => 'icon icon-multiple', :method => 'post', :confirm => l(:text_are_you_sure)) if Issue.use_status_for_done_ratio? %>
+<%= link_to(l(:label_update_issue_done_ratios), update_issue_done_ratio_issue_statuses_path, :class => 'icon icon-multiple', :method => 'post', :data => {:confirm => l(:text_are_you_sure)}) if Issue.use_status_for_done_ratio? %>
</div>
<h2><%=l(:label_issue_status_plural)%></h2>
<td align="center"><%= checked_image status.is_closed? %></td>
<td align="center" style="width:15%;"><%= reorder_links('issue_status', {:action => 'update', :id => status}, :put) %></td>
<td class="buttons">
- <%= link_to(l(:button_delete), issue_status_path(status),
- :method => :delete,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del') %>
+ <%= delete_link issue_status_path(status) %>
</td>
</tr>
<% end %>
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
<%= watcher_tag(@issue, User.current) %>
<%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue}, :class => 'icon icon-copy' %>
-<%= link_to l(:button_delete), issue_path(@issue), :confirm => issues_destroy_confirmation_message(@issue), :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %>
+<%= link_to l(:button_delete), issue_path(@issue), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %>
</div>
image_tag('link_break.png'),
{ :url => {:controller => 'issue_relations', :action => 'destroy', :id => relation},
:method => :delete,
- :confirm => l(:text_are_you_sure) },
+ :data => {:confirm => l(:text_are_you_sure)} },
:title => l(:label_relation_delete)
) if authorize_for('issue_relations', 'destroy') %></td>
</tr>
<div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %>
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
- <%= link_to l(:button_delete), query_path(@query), :confirm => l(:text_are_you_sure),
- :method => :delete, :class => 'icon icon-del' %>
+ <%= delete_link query_path(@query) %>
<% end %>
</div>
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
- :confirm => l(:text_are_you_sure),
+ :data => {:confirm => l(:text_are_you_sure)},
:class => 'icon icon-del'
) if @message.destroyable_by?(User.current) %>
</div>
image_tag('delete.png'),
{:action => 'destroy', :id => message},
:method => :post,
- :confirm => l(:text_are_you_sure),
+ :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.destroyable_by?(User.current) %>
</div>
<%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry},
:title => l(:button_edit) %>
<%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry},
- :confirm => l(:text_are_you_sure),
+ :data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:button_delete) %>
<% end -%>
:class => 'icon icon-edit',
:accesskey => accesskey(:edit),
:onclick => 'Element.show("edit-news"); return false;') if User.current.allowed_to?(:manage_news, @project) %>
-<%= link_to(l(:button_delete),
- news_path(@news),
- :confirm => l(:text_are_you_sure),
- :method => :delete,
- :class => 'icon icon-del') if User.current.allowed_to?(:manage_news, @project) %>
+<%= delete_link news_path(@news) if User.current.allowed_to?(:manage_news, @project) %>
</div>
<h2><%= avatar(@news.author, :size => "24") %><%=h @news.title %></h2>
<% next if comment.new_record? %>
<div class="contextual">
<%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
- :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %>
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
</div>
<h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
<%= textilizable(comment.comments) %>
<div class="contextual">
<%= link_to(l(:button_reset), project_enumerations_path(@project),
:method => :delete,
- :confirm => l(:text_are_you_sure),
+ :data => {:confirm => l(:text_are_you_sure)},
:class => 'icon icon-del') %>
</div>
<td class="buttons">
<% if User.current.allowed_to?(:manage_boards, @project) %>
<%= link_to l(:button_edit), edit_project_board_path(@project, board), :class => 'icon icon-edit' %>
- <%= link_to l(:button_delete), project_board_path(@project, board), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
+ <%= delete_link project_board_path(@project, board) %>
<% end %>
</td>
</tr>
<td class="buttons">
<% if User.current.allowed_to?(:manage_categories, @project) %>
<%= link_to l(:button_edit), edit_issue_category_path(category), :class => 'icon icon-edit' %>
- <%= link_to l(:button_delete), issue_category_path(category), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
+ <%= delete_link issue_category_path(category) %>
<% end %>
</td>
</tr>
l(:button_delete),
{ :url => membership_path(member),
:method => :delete,
- :confirm => (!User.current.admin? && member.include?(User.current) ? l(:text_own_membership_delete_confirmation) : nil) },
+ :data => {:confirm => (!User.current.admin? && member.include?(User.current) ? l(:text_own_membership_delete_confirmation) : nil)} },
:title => l(:button_delete),
:class => 'icon icon-del'
) if member.deletable? %>
:class => 'icon icon-user') %>
<%= link_to(l(:button_edit), edit_repository_path(repository),
:class => 'icon icon-edit') %>
- <%= link_to(l(:button_delete), repository_path(repository),
- :confirm => l(:text_are_you_sure),
- :method => :delete,
- :class => 'icon icon-del') %>
+ <%= delete_link repository_path(repository) %>
<% end %>
</td>
</tr>
<td class="buttons">
<% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %>
<%= link_to l(:button_edit), edit_version_path(version), :class => 'icon icon-edit' %>
- <%= link_to l(:button_delete), version_path(version), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
+ <%= delete_link version_path(version) %>
<% end %>
</td>
</tr>
<small>
<% if query.editable_by?(User.current) %>
<%= link_to l(:button_edit), edit_query_path(query), :class => 'icon icon-edit' %>
- <%= link_to l(:button_delete), query_path(query), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
+ <%= delete_link query_path(query) %>
</small>
<% end %>
</td>
:id => @project, :repository_id => @repository.identifier_param,
:rev => @changeset.identifier, :issue_id => issue},
:method => :delete,
- :confirm => l(:text_are_you_sure),
+ :data => {:confirm => l(:text_are_you_sure)},
}, :title => l(:label_relation_delete)) if manage_allowed %>
</li>
<% end %>
</td>
<td class="buttons">
- <%= link_to(l(:button_delete), role_path(role),
- :method => :delete,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del') unless role.builtin? %>
+ <%= delete_link role_path(role) unless role.builtin? %>
</td>
</tr>
<% end %>
<%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry, :project_id => nil},
:title => l(:button_edit) %>
<%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry, :project_id => nil},
- :confirm => l(:text_are_you_sure),
+ :data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:button_delete) %>
<% end -%>
<td align="center"><% unless tracker.workflows.count > 0 %><span class="icon icon-warning"><%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), {:controller => 'workflows', :action => 'edit', :tracker_id => tracker} %>)</span><% end %></td>
<td align="center" style="width:15%;"><%= reorder_links('tracker', {:action => 'update', :id => tracker}, :put) %></td>
<td class="buttons">
- <%= link_to(l(:button_delete), tracker_path(tracker),
- :method => :delete,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del') %>
+ <%= delete_link tracker_path(tracker) %>
</td>
</tr>
<% end %>
<div class="contextual">
<%= link_to l(:label_profile), user_path(@user), :class => 'icon icon-user' %>
<%= change_status_link(@user) %>
-<%= link_to(l(:button_delete), @user, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del') if User.current != @user %>
+<%= delete_link user_path(@user) if User.current != @user %>
</div>
<h2><%= link_to l(:label_user_plural), users_path %> » <%=h @user.login %></h2>
<td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
<td class="buttons">
<%= change_status_link(user) %>
- <%= link_to(l(:button_delete), user_path(user), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del') unless User.current == user %>
+ <%= delete_link user_path(user) unless User.current == user %>
</td>
</tr>
<% end -%>
<div class="contextual">
<%= link_to(l(:button_edit), edit_version_path(@version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= link_to_if_authorized(l(:button_edit_associated_wikipage, :page_title => @version.wiki_page_title), {:controller => 'wiki', :action => 'edit', :project_id => @version.project, :id => Wiki.titleize(@version.wiki_page_title)}, :class => 'icon icon-edit') unless @version.wiki_page_title.blank? || @version.project.wiki.nil? %>
-<%= link_to(l(:button_delete), version_path(@version, :back_url => url_for(:controller => 'versions', :action => 'index', :project_id => @version.project)),
- :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del') if User.current.allowed_to?(:manage_versions, @version.project) %>
+<%= delete_link version_path(@version, :back_url => url_for(:controller => 'versions', :action => 'index', :project_id => @version.project)) if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
</div>
<%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') if @content.current_version? %>
-<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
+<%= 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') %>
<%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') unless @content.current_version? %>
<% end %>
<%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>