<% if @prefs %>
  <%= form_tag( update_email_preferences_user_path(@user), method: :put, id: "preferences_registration_form", class: "form-horizontal") do |f| %>
    <div class="preferences">

    <p>
      <%= link_to _('Select all'), '#', id: 'select_all' %> |
      <%= link_to _('Deselect all'), '#', id: 'deselect_all' %>
    </p>

    <p class="form-control-static"><strong>All Users</strong></p>
    <div class="checkbox">
      <label>
        <%= check_box_tag 'prefs[users][new_comment]', true, @prefs[:users][:new_comment] %><%= _('A new comment has been added to my DMP')  %>
      </label>
    </div>
    <div class="checkbox">
      <label>
        <%= check_box_tag 'prefs[users][added_as_coowner]', true, @prefs[:users][:added_as_coowner] %><%= _('A plan has been shared with me')  %>
      </label>
    </div>
    <div class="checkbox">
      <label>
        <%= check_box_tag 'prefs[users][admin_privileges]', true, @prefs[:users][:admin_privileges] %><%= _('Admin privileges granted to me')  %>
      </label>
    </div>
    <% if @user.org.present? && @user.org.feedback_enabled %>
      <div class="checkbox">
        <label>
          <%= check_box_tag 'prefs[users][feedback_requested]', true, @prefs[:users][:feedback_requested] %><%= _('Feedback has been requested for my DMP') %>
        </label>
      </div>
      <div class="checkbox">
        <label>
          <%= check_box_tag 'prefs[users][feedback_provided]', true, @prefs[:users][:feedback_provided] %><%= _('Feedback has been provided for my DMP')  %>
        </label>
      </div>
    <% end %>

    <p class="form-control-static"><strong>DMP owners and co-owners</strong></p>

    <div class="checkbox">
      <label>
        <%= check_box_tag 'prefs[owners_and_coowners][visibility_changed]', true, @prefs[:owners_and_coowners][:visibility_changed] %><%= _("My DMP's visibility has changed")  %>
      </label>
    </div>

    <%= submit_tag _('Save'), class: 'btn btn-default' %>
  <% end %>
<% end %>
