template-edit.html 5.24 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
                <tr>
44 45 46 47 48 49 50 51 52
                  <td>
                    <i class="icon-user"></i>
                  </td>
                  <td>
                    <a href="{% url "dashboard.views.profile" username=i.user.username %}"
                      title="{{ i.user.username }}">
                      {% include "dashboard/_display-name.html" with user=i.user show_org=True %}
                    </a>
                  </td>
53 54 55 56 57 58 59 60 61 62 63
                  <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>
64 65
                {% endfor %}
                {% for i in acl.groups %}
66
                <tr>
67 68 69 70 71 72
                  <td><i class="icon-group"></i></td>
                  <td>
                    <a href="{% url "dashboard.views.group-detail" pk=i.group.pk %}">
                      {{i.group}}
                    </a>
                  </td>
73 74 75 76 77 78 79 80 81 82 83
                  <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>
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
                {% 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>
102
    
103
        
104 105
    <div class="panel panel-default">
      <div class="panel-heading">
106 107 108
        <h4 class="no-margin"><i class="icon-file"></i> {% trans "Disk list" %}</h4>
      </div>
      <div class="panel-body">
109 110 111 112
        <ul class="template-disk-list">
        {% if not disks %}
          {% trans "No disks are added!" %}
        {% endif %}
113 114 115 116 117 118 119 120 121 122 123 124
        {% for d in disks %}
          <li>
            {% include "dashboard/_disk-list-element.html" %}
          </li>
        {% endfor %}
        </ul>
      </div>
    </div>
        
    <div class="panel panel-default">
      <div class="panel-heading">
        <h4 class="no-margin"><i class="icon-folder-open"></i> {% trans "Create new disk" %}</h4>
125 126 127 128 129 130 131 132 133
      </div>
      <div class="panel-body">
        <form action="{% url "dashboard.views.disk-add" %}" method="POST">
          {% crispy disk_add_form %} 
        </form>
      </div>
    </div>
  </div><!-- .col-md-4 -->
</div><!-- .row -->
134

135

136 137 138 139 140 141 142 143
<style>
  fieldset {
    margin-top: 40px;
  }
  fieldset legend {
    font-weight: bold;
  }
</style>
144 145 146 147 148 149 150 151
{% endblock %}

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

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