<%inherit file="/template.html" />
<%namespace name="tiles_html" file="/milestone/tiles.html"/>
<%namespace name="components" file="/components.html"/>
<%namespace name="forms" file="/forms.html"/>
<%def name="title()">${_("Edit %s") % c.milestone.title|n}</%def>

<%def name="breadcrumbs()">
    ${h.milestone.breadcrumbs(c.milestone)|n} &raquo; ${_("Edit")}
</%def>

<%block name="main_content">

    <h3>${_("Edit milestone")}</h3>
<div class="form_wrapper">
<form name="edit_milestone" class="inplace" method="POST"
  action="${h.entity_url(c.milestone)}">
    ${h.field_token()|n}
    <input type="hidden" name="_method" value="PUT" />

    <div>
        <label for="title" class="">${_("Milestone title")}</label>
        <input autofocus="autofocus" name="title" value="${c.milestone.title}" />
    </div>

        <label for="text">${_("Milestone description")}</label>
        <div class="infobox">
            ${_("Give a brief description of the milestone.")|n}
        </div>

        <textarea class="description" name="text">${c.milestone.text}</textarea>
        ${components.formatting()}
        <br/>
        <label for="time">${_("Date of the milestone")}</label>
        <input name="time" id="time"
               value="${c.milestone.time and c.milestone.time.strftime('%d.%m.%Y') or 'Undefined'}" />
        <span class="hint">${_("Please use the DD.MM.YYYY format.")}</span>
        <br/>
        <br/>
        %if c.categories:
        <label for="category" class="">
            ${_('Category')}
        </label>
        <select id="category" name="category">
            <option value="">
                ${_('No Category')}
            </option>
            %for category in c.categories:
            <option class="ttip" title="${category.description}" value="${category.id}"
                    ${'selected="selected"' if c.milestone.category == category else ''}>
                ${category.title}
            </option>
            %endfor
        </select>
        %endif
        %if h.config.get_bool('adhocracy.milestone.allow_show_all_proposals'):
        ${forms.checkbox(_(u"Show all proposals"), 'show_all_proposals', help=_(u"Show all open proposals if milestone is in the future."))}
        %endif

    <div class="input_wrapper">
        ${components.form_watch(c.milestone)}
    </div>

    <div class="input_wrapper submit">
        ${components.savebox(h.entity_url(c.milestone))}
    </div>
</form>
</div>
</%block>
