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

{% block title-page %}{% trans "Edit template" %}{% endblock %}

8 9 10
{% block content %}

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

        {% csrf_token %}

        {{ form.name|as_crispy_field }}
26 27 28 29 30 31 32 33 34 35
        <a {% if form.parent.value %}
            href="{% url "dashboard.views.template-detail" pk=form.parent.value %}" 
           {% else %}
            disabled %}
          {% endif %}
          class="btn btn-default pull-right" style="margin-top: 24px;">
          {% trans "Visit" %}
          <i class="fa fa-arrow-circle-right"></i>
        </a> 
        <div style="width: 80%;">
36
        {{ form.parent|as_crispy_field }}
37
        </div>
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
    <div class="panel panel-default">
      <div class="panel-heading">
73
        <h4 class="no-margin"><i class="fa fa-group"></i> {% trans "Manage access"  %}</h4>
74 75
      </div>
      <div class="panel-body">
76
        {% include "dashboard/_manage_access.html" with table_id="template-access-table" %}
77 78
      </div>
    </div>
79 80


81 82
    <div class="panel panel-default">
      <div class="panel-heading">
83
        <h4 class="no-margin"><i class="fa fa-file"></i> {% trans "Disk list" %}</h4>
84 85
      </div>
      <div class="panel-body">
86 87 88 89
        <ul class="template-disk-list">
        {% if not disks %}
          {% trans "No disks are added!" %}
        {% endif %}
90 91 92 93 94 95 96 97
        {% for d in disks %}
          <li>
            {% include "dashboard/_disk-list-element.html" %}
          </li>
        {% endfor %}
        </ul>
      </div>
    </div>
98 99
  </div><!-- .col-md-4 -->
</div><!-- .row -->
100

101

102 103 104 105 106 107 108 109
<style>
  fieldset {
    margin-top: 40px;
  }
  fieldset legend {
    font-weight: bold;
  }
</style>
110 111 112 113 114 115 116 117
{% endblock %}

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

119
  <script src="{{ STATIC_URL }}dashboard/disk-list.js"></script>
120
{% endblock %}