template-edit.html 4.15 KB
Newer Older
1
{% extends "dashboard/base.html" %}
2
{% load staticfiles %}
3
{% load i18n %}
4
{% load sizefieldtags %}
5
{% load crispy_forms_tags %}
6

7
{% block title-page %}{{ form.name.value }} | {% trans "template" %}{% endblock %}
8

9 10 11
{% block content %}

<div class="row">
12
  <div class="col-md-7">
13 14
    <div class="panel panel-default">
      <div class="panel-heading">
15 16 17
        <a class="pull-right btn btn-default btn-xs" href="{% url "dashboard.views.template-list" %}">
          {% trans "Back" %}
        </a>
18
        <h3 class="no-margin"><i class="fa fa-puzzle-piece"></i> {% trans "Edit template" %}</h3>
19 20
      </div>
      <div class="panel-body">
21
        <form action="" method="POST">
22 23 24
        {% with form=form %}
          {% include "display-form-errors.html" %}
        {% endwith %}
25 26 27 28

        {% csrf_token %}

        {{ form.name|as_crispy_field }}
29 30 31 32 33 34 35 36 37

        <strong>{% trans "Parent template" %}:</strong>
        {% if parent %}
        <a href="{% url "dashboard.views.template-detail" pk=parent.pk %}">
          {{ parent.name }}
        </a>
        {% else %}
          -
        {% endif %}
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

        <fieldset class="resources-sliders">
          <legend>{% trans "Resource configuration" %}</legend>
          {% include "dashboard/_resources-sliders.html" with field_priority=form.priority field_num_cores=form.num_cores field_ram_size=form.ram_size %}
          {{ form.max_ram_size|as_crispy_field }}
        </fieldset>

        <fieldset>
          <legend>{% trans "Virtual machine settings" %}</legend>
        {{ form.arch|as_crispy_field }}
        {{ form.access_method|as_crispy_field }}
        {{ form.boot_menu|as_crispy_field }}
        {{ form.raw_data|as_crispy_field }}
        {{ form.req_traits|as_crispy_field }}
        {{ form.description|as_crispy_field }}
        {{ form.system|as_crispy_field }}
54
        {{ form.has_agent|as_crispy_field }}
55 56 57 58 59 60 61 62 63 64 65
        </fieldset>
        <fieldset>
          <legend>{% trans "External resources" %}</legend>
        {{ form.networks|as_crispy_field }}
        {{ form.lease|as_crispy_field }}

        {{ form.tags|as_crispy_field }}
        </fieldset>

        <input type="submit" value="{% trans "Save changes" %}" class="btn btn-primary">
        </form>
66 67 68
      </div>
    </div>
  </div>
69

70
  <div class="col-md-5">
71 72 73 74 75 76 77 78 79 80 81 82
    {% if is_owner %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <a href="{% url "dashboard.views.template-delete" pk=object.pk %}" 
         class="btn btn-xs btn-danger pull-right">
          {% trans "Delete" %}
        </a>
        <h4 class="no-margin"><i class="fa fa-times"></i> {% trans "Delete template"  %}</h4>
      </div>
    </div>
    {% endif %}

83 84
    <div class="panel panel-default">
      <div class="panel-heading">
85
        <h4 class="no-margin"><i class="fa fa-group"></i> {% trans "Manage access"  %}</h4>
86 87
      </div>
      <div class="panel-body">
88
        {% include "dashboard/_manage_access.html" with table_id="template-access-table" %}
89 90
      </div>
    </div>
91 92


93 94
    <div class="panel panel-default">
      <div class="panel-heading">
95
        <h4 class="no-margin"><i class="fa fa-file"></i> {% trans "Disk list" %}</h4>
96 97
      </div>
      <div class="panel-body">
98 99 100 101
        <ul class="template-disk-list">
        {% if not disks %}
          {% trans "No disks are added!" %}
        {% endif %}
102 103
        {% for d in disks %}
          <li>
104 105 106 107 108 109 110
            <i class="fa fa-file"></i>
            {{ d.name }} (#{{ d.id }}) -
            <a href="{% url "dashboard.views.disk-remove" pk=d.pk %}?next={{ request.path }}"
              data-disk-pk="{{ d.pk }}" class="btn btn-xs btn-danger pull-right disk-remove"
              {% if not long_remove %}title="{% trans "Remove" %}"{% endif %}>
              <i class="fa fa-times"></i>{% if long_remove %} {% trans "Remove" %}{% endif %}
            </a>
111 112 113 114 115
          </li>
        {% endfor %}
        </ul>
      </div>
    </div>
116 117
  </div><!-- .col-md-4 -->
</div><!-- .row -->
118

119

120 121 122 123 124 125 126 127
<style>
  fieldset {
    margin-top: 40px;
  }
  fieldset legend {
    font-weight: bold;
  }
</style>
128 129 130 131 132 133 134 135
{% endblock %}

{% block extra_js %}
  <script>
    $(function() {
      $("#hint_id_num_cores, #hint_id_priority, #hint_id_ram_size").hide();
    });
  </script>
136
{% endblock %}