<form id="default-templates-form" method="post" action="<%= ApplicationController.root_context -%>/permission_templates/update_default_templates">
  <fieldset>
    <div class="modal-head">
      <h2><%= message('permission_template.set_default_templates') -%></h2>
    </div>
    <div class="modal-body">
      <div class="modal-error"/>
      <% @root_qualifiers.each do |qualifier| %>
        <div class="modal-field">
          <%= label_tag("default_template_#{qualifier}", " For #{message('qualifier.' + qualifier).downcase}s") %>
          <%= select_tag("default_template_#{qualifier}", options_for_select(@permission_templates_options, @default_templates[qualifier])) %>
        </div>
      <% end %>
    </div>
    <div class="modal-foot">
      <input type="submit" value="<%= h message('permission_template.update_permissions') -%>" id="submit-default-templates"/>
      <a href="#" onclick="return closeModalWindow()" id="cancel-default-templates"><%= h message('cancel') -%></a>
    </div>
  </fieldset>
</form>

<script>
  $j("#default-templates-form").modalForm({
    success: function (data) {
      window.location.reload();
    }
  });
</script>

