<% form_for :metric, @metric, :url => { :action => 'save_from_web', :id => @metric.id }, :html => { :id =>'metric_edit_form', :method => 'post'} do |f| %>
  <fieldset>
      <div class="modal-head">
          <h2>Edit Manual Metric: <%= @metric.key -%></h2>
      </div>
      <div class="modal-body">
          <% if @errors %>
            <p class="error"><%= @errors -%></p>
          <% end %>

          <div class="modal-field">
              <label for="user[login]">Name <em class="mandatory">*</em></label><%= f.text_field :short_name %><br/>
          </div>
          <div class="modal-field">
              <label for="user[login]"> Description</label><%= f.text_area :description, :size => 40, :cols => 50, :rows => 5 %><br/>
          </div>
          <div class="modal-field">
              <label for="user[login]">Domain</label><%= f.select( :domain, @domains, :include_blank => true) %>
              <span class="desc">or</span> <input id="newdomain" name="newdomain" size="15" type="text"><br/>
          </div>
          <div class="modal-field">
              <label for="user[login]">Type</label><%= f.select( :val_type, Metric.value_type_names.invert) %><br/>
          </div>
      </div>

      <div class="modal-foot">
          <%= submit_tag 'Save' %>
          <%= link_to message('cancel'), { :controller => 'metrics', :action => 'index', :id => nil}, { :class => 'action' } %>
      </div>
  </fieldset>
<% end %>

<script>
  $j("#metric_edit_form").modalForm();
</script>
