% if @user %>
<%= link_to(l(:label_profile), { :controller => 'users', :action => 'show', :id => @user }, :class => 'icon icon-user') %>
<%= link_to(l(:button_edit), { :controller => 'users', :action => 'edit', :id => @user }, :class => 'icon icon-edit') if User.current.admin? %>
<% end %>
<% if @user %>
<%= avatar(@user, :size => "50") %> <%= l(:label_contact) %> <%= h(@user.name) %>
<% else %>
<%= Setting.contact_us_title %>
<% end %>
<% begin %>
<% form_builder = TabularFormBuilder %>
<% rescue %>
<% begin %>
<% form_builder = Redmine::Views::LabelledFormBuilder %>
<% rescue %>
<% form_builder = nil %>
<% end %>
<% end %>
<% if Rails::VERSION::MAJOR < 3 %>
<% form_for_args = [ :contact_form, @email, { :url => { :action => 'mail', :id => params[:id] },
:html => { :id => 'contact_form' },
:builder => form_builder } ] %>
<% else %>
<% form_for_args = [ @email, { :as => :contact_form,
:url => { :action => 'mail', :id => params[:id] },
:html => { :id => 'contact_form' },
:builder => form_builder } ] %>
<% end %>
<% if defined? remote_form_for %>
<% form = form_for(*form_for_args) do |f| %>
<%= render(:partial => 'contact_form/form', :locals => { :email => @email, :f => f }) %>
<%= link_to_remote(l(:label_preview),
{ :url => { :controller => 'contact_form', :action => 'preview' },
:method => 'post',
:update => 'preview',
:with => "Form.serialize('contact_form')",
:complete => "Element.scrollTo('preview')"
}, :accesskey => accesskey(:preview)) %>
<% end %>
<% else %>
<% form = form_for(*form_for_args) do |f| %>
<%= render(:partial => 'contact_form/form', :locals => { :email => @email, :f => f }) %>
<%= preview_link({ :controller => 'contact_form', :action => 'preview' }, 'contact_form') %>
<% end %>
<% end %>
<%= form if Rails::VERSION::MAJOR >= 3 %>
<% if @user %>
<% html_title(l(:label_contact) + ' ' + @user.name) %>
<% else %>
<% html_title(Setting.contact_us_title) %>
<% end %>