{% extends g.theme.master %}

{% block title %}{{c.project.name}} / Overview{% endblock %}

{% block header %}Project Admin{% endblock %}

{% block content %}
        {% if c.project.deleted %}
          <div class="notice">This project has been deleted and is not visible to non-admin users</div>
        {% endif %}
          <form method="POST" action="update" enctype="multipart/form-data">
            <div class="grid-9">
              <label for="name">Name:</label>
              <br>
              <input type="text" name="name" id="name" value="{{c.project.name}}"
                     title="This is the publicly viewable name of the project, and will appear on project listings.
It should be what you want to see as the project title in search listing.">
            </div>
            <div class="grid-9">
              <label for="category">Category:</label>
              <br>
              <select name="category" id="category" title="This will determine which pages the project will appear under in the SourceForge Directory.">
                <option value="">Uncategorized</option>
                {% for cat in categories %}
                  <option value="{{cat._id}}" {% if c.project.category and c.project.category._id == cat._id %}selected="selected"{% endif%}>{{cat.label}}</option>
                  {% for subcat in cat.subcategories %}
                    <option value="{{subcat._id}}" {% if c.project.category and c.project.category._id == subcat._id %}selected="selected"{% endif %}>-- {{subcat.label}}</option>
                  {% endfor %}
                {% endfor %}
              </select>
            </div>
            <div style="clear: both"></div>
            <div class="grid-9">
              <label>Unixname:</label>
              <br>
              <input type="text" disabled="disabled" value="{{c.project.shortname}}">
            </div>
            <div class="grid-9">
              <label for="labels">Labels:</label>
              <br>
              {{c.label_edit.display(name='labels', value=c.project.labels, id='labels',
                     title="Free-form labels to describe your project.
These can be used to search for similar projects.")}}
            </div>
            <div class="grid-9">
              <label for="short_description_textarea">Summary:</label>
              <br>
              <textarea name="short_description" id="short_description_textarea" style="height: 100px;"
                        title="Add a short one or two sentence summary for your project.">{{c.project.short_description}}</textarea>
            </div>
            <div class="grid-9">
              <label for="icon">Icon:</label>
              <br>
              <div class="editable viewing">
                {% if c.project.icon %}
                  <div class="viewer"><img src="{{c.project.url()}}/icon"/></div>
                {% else %}
                  <div class="viewer">
                    No icon has been created.{% if c.project.private_project_of() %} A gravatar image associated with your primary email
                    address will be used instead if you have created one at <a href="http://gravatar.com/">gravatar.com</a>.{% endif %}
                  </div>
                {% endif %}
                <div class="editor">{{lib.file_field('icon', '')}}</div>
              </div>  
              {% if c.project.icon %}
                  <div>
                      <input type="submit" name="delete_icon" value="Delete Icon">
                  </div>
              {% endif %}
            </div>
            <hr class="grid-19" style="margin-top: 1em; margin-bottom: 1em;">
            <div class="grid-15">
              <input type="submit" value="Save">
            </div>
            {% if not c.project.deleted %}
              <input type="submit" value="Delete Project" name="delete" class="fright">
            {% elif config.get('auth.method', 'local') != 'sfx' %}
              <input type="submit" value="Undelete Project" name="undelete" class="fright">
            {% endif %}
          </form>
{% endblock %}

{% block extra_js %}
  <script type="text/javascript" src="{{g.forge_static('js/jquery.maxlength-min.js')}}"></script>
  <script type="text/javascript">
    $(document).ready(function () {
      $('#short_description_textarea').maxlength({maxCharacters: 250});
    });
  </script>
{% endblock %}

{% block extra_css %}
  <style type="text/css">
    .grid-9 input[type="text"], .grid-9 select, .grid-9 textarea{
      width: 95%
    }
  </style>
{% endblock %}

