template-edit.html 4.38 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="icon-puzzle-piece"></i> {% trans "Edit template" %}</h3>
16 17
      </div>
      <div class="panel-body">
18 19 20
        {% with form=form %}
          {% include "display-form-errors.html" %}
        {% endwith %}
21 22 23 24
        {% crispy form %}
      </div>
    </div>
  </div>
25

26
  <div class="col-md-5">
27 28
    <div class="panel panel-default">
      <div class="panel-heading">
29
        <h4 class="no-margin"><i class="icon-group"></i> {% trans "Manage access"  %}</h4>
30 31 32
      </div>
      <div class="panel-body">
        <form action="{% url "dashboard.views.template-acl" pk=object.pk %}" method="post">{% csrf_token %}
33 34 35 36 37 38 39 40
          <table class="table table-striped table-with-form-fields" id="template-access-table">
            <thead>
              <tr>
                <th></th>
                <th>{% trans "Who" %}</th>
                <th>{% trans "What" %}</th>
                <th><i class="icon-remove"></i></th>
            </tr></thead>
41 42
            <tbody>
                {% for i in acl.users %}
43 44 45 46 47 48 49 50 51 52 53 54 55
                <tr>
                  <td><i class="icon-user"></i></td><td>{{i.user}}</td>
                  <td>
                    <select class="form-control" name="perm-u-{{i.user.id}}">
                      {% for id, name in acl.levels %}
                      <option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option>
                      {% endfor %}
                    </select>
                  </td>
                  <td>
                    <input type="checkbox" name="remove-u-{{i.user.id}}" title="{% trans "Remove" %}"/>
                  </td>
                </tr>
56 57
                {% endfor %}
                {% for i in acl.groups %}
58 59 60 61 62 63 64 65 66 67 68 69 70
                <tr>
                  <td><i class="icon-group"></i></td><td>{{i.group}}</td>
                  <td>
                    <select class="form-control" name="perm-g-{{i.group.id}}">
                      {% for id, name in acl.levels %}
                      <option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option>
                      {% endfor %}
                    </select>
                  </td>
                  <td>
                    <input type="checkbox" name="remove-g-{{i.group.id}}" title="{% trans "Remove" %}"/>
                  </td>
                </tr>
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
                {% endfor %}
                <tr><td><i class="icon-plus"></i></td>
                    <td><input type="text" class="form-control" name="perm-new-name"
                        placeholder="{% trans "Name of group or user" %}"></td>
                    <td><select class="form-control" name="perm-new">
                            {% for id, name in acl.levels %}
                            <option value="{{id}}">{{name}}</option>
                            {% endfor %}
                    </select></td><td></td>
                </tr>
          </tbody>
          </table>
          <div class="form-actions">
            <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
          </div>
        </form>
      </div>
    </div>
89
    
90
        
91 92
    <div class="panel panel-default">
      <div class="panel-heading">
93 94 95
        <h4 class="no-margin"><i class="icon-file"></i> {% trans "Disk list" %}</h4>
      </div>
      <div class="panel-body">
96 97 98 99
        <ul class="template-disk-list">
        {% if not disks %}
          {% trans "No disks are added!" %}
        {% endif %}
100 101 102 103 104 105 106 107
        {% for d in disks %}
          <li>
            {% include "dashboard/_disk-list-element.html" %}
          </li>
        {% endfor %}
        </ul>
      </div>
    </div>
108 109
  </div><!-- .col-md-4 -->
</div><!-- .row -->
110

111

112 113 114 115 116 117 118 119
<style>
  fieldset {
    margin-top: 40px;
  }
  fieldset legend {
    font-weight: bold;
  }
</style>
120 121 122 123 124 125 126 127
{% endblock %}

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

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