% @page_title = @user.display_name -%>
<% content_for :right do %>
<% if admin? %>
Admin & Moderation
<% if @user.forums.any? -%>
This user can moderate the following forums. Select one to remove it.
<% @user.forums.find(:all, :select => 'forums.*, moderatorships.id as moderatorship_id').each do |forum| -%>
<%# form_for() calls form_tag() which for :method => :delete writes out a hidden INPUT field at the time of writing - but wraps it in an outer DIV. This broke earlier layout using
items to hold the buttons. Sigh - I have so many reservations about Rails 1.2.x... Anyway, herein, a rather tragic workaround which gives up on
tags but puts its own (currently redundant) DIV around the small form, to ensure line breaks work even in future Rails gets rid of its own strange little DIV. -%>
<% form_for(:user,
{
:html => {
:method => :delete,
:class => 'xdialog',
:onsubmit => 'return confirm("Are you sure you want to remove the user as a moderator for this forum?");'
},
:url => moderator_path(@user,
forum.moderatorship_id),
}
) do |f| -%>
<%= submit_tag forum.name %>
<% end -%>