<% content_for :style do %>
  <style>
    h2 {
      padding-bottom: 10px;
    }
  </style>
<% end %>

<div class="page">
  <h1 class="marginbottom10"><%= message('my_profile.page') -%></h1>

  <div class="admin marginbottom10">
    <table class="form">
      <tr>
        <td><b><%= message('my_profile.login') -%>:</b></td>
        <td id="login"><%= current_user.login %></td>
      </tr>
      <tr>
        <td><b><%= message('my_profile.name') -%>:</b></td>
        <td id="name"><%= current_user.name %></td>
      </tr>
      <tr>
        <td><b><%= message('my_profile.email') -%>:</b></td>
        <td id="email"><%= current_user.email %></td>
      </tr>
      <tr>
        <td><b><%= message('my_profile.groups') -%>:</b></td>
        <td id="groups"><%= current_user.groups.sort.map(&:name).join(', ') %></td>
      </tr>
      <tr>
        <td><b><%= message('my_profile.scm_accounts') -%>:</b></td>
        <td id="groups"><%= current_user.full_scm_accounts.join(', ') %></td>
      </tr>
    </table>
  </div>

  <% if User.editable_password? %>
    <div class="admin marginbottom10">
      <h2><%= message('my_profile.password.title') -%></h2>

      <form id="pass_form_tag" name="pass_form_tag" method="post" action="<%= ApplicationController.root_context -%>/account/change_password">
        <table class="form">
          <tr>
            <td class="keyCell"><label for="old_password"><%= message('my_profile.password.old') -%>:</label></td>
            <td><%= password_field_tag 'old_password', nil, {:autocomplete => 'off'} %></td>
          </tr>
          <tr>
            <td class="keyCell"><label for="password"><%= message('my_profile.password.new') -%>:</label></td>
            <td><%= password_field_tag 'password', nil, {:autocomplete => 'off'}  %></td>
          </tr>
          <tr>
            <td class="keyCell"><label for="password_confirmation"><%= message('my_profile.password.confirm') -%>:</label></td>
            <td><%= password_field_tag 'password_confirmation', nil, {:autocomplete => 'off'}  %></td>
          </tr>
          <tr>
            <td></td>
            <td><%= submit_tag message('my_profile.password.submit') %></td>
          </tr>
        </table>
      </form>

      <script>
        //<![CDATA[
         $j('#pass_form_tag :input:enabled:visible:first').focus();
        //]]>
      </script>
    </div>
  <% end -%>

  <div class="admin marginbottom10">
    <form id="notif_form" method="post" action="<%= ApplicationController.root_context -%>/account/update_notifications">
      <% unless @global_dispatchers.empty? -%>
        <%= render "account/global_notifications" -%>
        <br/><br/>
      <% end %>

      <% unless @per_project_dispatchers.empty? -%>
        <%= render "account/per_project_notifications" -%>  
      <% end %>
      
      <br/><br/>
      <input type="submit" value="<%= message('my_profile.notifications.submit') -%>" name="commit">
    </form>
  </div>
  
</div>
