<form id="update-values">
    {% for field in globals.custom_fields %}
      {% if field.name == '_milestone' %}
      <div class="grid-4">{{milestones}}
        <label for="{{field.name}}" class="cr">{{field.label}}:</label>
        <select name="{{field.name}}" class="wide">
          <option value="" selected="selected">no change</option>
          {% for m in field.milestones %}
            {% if not m.complete %}
              <option value="{{m.name}}">{{m.name}}</option>
            {% endif %}
          {% endfor %}
        </select>
      </div>
      {% endif %}
    {% endfor %}
    <div class="grid-4">
      <label for="status" class="cr">Status:</label>
      <select name="status" class="wide">
        <option value="" selected="selected">no change</option>
        {% for option in globals.all_status_names.split() %}
          <option value="{{option}}">{{option}}</option>
        {% endfor %}
      </select>
    </div>
    <div class="grid-4">
      <label for="assigned_to" class="cr">Owner:</label>
      {{c.user_select.display(name='assigned_to', value='', className='wide')}}
    </div>
    {% set cf_count = -1 %}
    {% for field in globals.custom_fields %}
      {% if field.type != 'sum' and field.name != '_milestone' %}
        {% if cf_count%4 == 0 %}
          <div style="clear: both"></div>
        {% endif %}
        <div class="grid-4">
          <label for="{{field.id}}" class="cr">{{field.label}}:</label>
          {% if field.type == 'boolean' %}
            <input name="{{field.name}}" type="checkbox" value="True"/>
          {% elif field.type == 'select' %}
            <select name="{{field.name}}" class="wide">
              <option value="" selected="selected">no change</option>
              {% for option in field.options.split() %}
                {% if option.startswith('*') %}
                  <option value="{{option[1:]}}" selected="selected">{{option[1:]}}</option>
                {% else %}
                  <option value="{{option}}">{{option}}</option>
                {% endif %}
              {% endfor %}
            </select>
          {% elif field.type == 'milestone' %}
            <select name="{{field.name}}">
              <option value="" selected="selected">no change</option>
              {% for m in field.milestones %}
                {% if not m.complete %}
                  <option value="{{m.name}}">{{m.name}}</option>
                {% endif %}
              {% endfor %}
            </select>
          {% else %}
            <input name="{{field.name}}" type="text" value="" class="wide"/>
          {% endif %}
        </div>
        {% set cf_count=cf_count+1 %}
      {% endif %}
    {% endfor %}
    <div class="grid-16">
      <input type="button" onclick="update_tickets()" value="Save"/>
      <a href="{{cancel_href}}" class="btn link">Cancel</a>
      <!-- tg.url(c.app.url+'search/', dict(q=query, limit=limit, sort=sort))}}" class="btn link">Cancel</a>-->
    </div>
</form>
