group-detail.html 6.01 KB
Newer Older
1
{% extends "dashboard/base.html" %}
2
{% load crispy_forms_tags %}
3 4
{% load i18n %}

5 6 7
{% block content %}
<div class="body-content">
  <div class="page-header">
8 9 10 11 12 13
    <div class="pull-right" style="padding-top: 15px;">
      <a title="{% trans "Rename" %}" href="#" class="btn btn-default btn-xs group-details-rename-button"><i class="icon-pencil"></i></a>
      <a title="{% trans "Delete" %}" data-group-pk="{{ group.pk }}" class="btn btn-default btn-xs real-link group-delete" href="{% url "dashboard.views.delete-group" pk=group.pk %}"><i class="icon-trash"></i></a>
      <a title="{% trans "Help" %}" href="#" class="btn btn-default btn-xs group-details-help-button"><i class="icon-question"></i></a>
    </div>
   <h1>
14 15 16 17 18 19
      <div id="group-details-rename">
        <form action="" method="POST" id="group-details-rename-form">
          {% csrf_token %}
          <input id="group-details-rename-name" class="form-control" name="new_name" type="text" value="{{ group.name }}"/> 
          <button type="submit" id="group-details-rename-submit" class="btn">{% trans "Rename" %}</button>
        </form>
20
      </div>
21 22
      <div id="group-details-h1-name">
        {{ group.name }} 
23 24 25
        {% if group.groupprofile.org_id %}
        <small>{{group.groupprofile.org_id}}</small>
        {% endif %}
26
      </div>
27
    </h1>
28 29 30 31 32 33 34 35 36 37 38 39 40
    <div class="group-details-help js-hidden">
      <ul style="list-style: none;">
        <li>
          <strong>{% trans "Rename" %}:</strong>
          {% trans "Change the name of the group." %}
        </li>
        <li>
          <strong>{% trans "Delete" %}:</strong>
          {% trans "Delete group." %}
        </li>
      </ul>
    </div>
 </div>
41
  <div class="row">
42
    <div class="col-md-12" id="group-detail-pane">
43
      <div class="panel panel-default" id="group-detail-panel">
44
        <div class="tab-content panel-body" id="group-form-body">
45 46 47 48 49 50

          <form method="POST" action="{% url "dashboard.views.group-update" pk=group.pk %}">
{% csrf_token %}
{% crispy group_profile_form %}
</form>

51
          <h3>{% trans "User list"|capfirst %}</h3>
52
<form action="" method="post">{% csrf_token %}
53
<table class="table table-striped table-with-form-fields table-bordered" id="group-detail-user-table">
54
    <tbody>
55 56 57 58 59
    {% if perms.auth.add_user %}
	    <p class="pull-right">
	    <a href="{% url "dashboard.views.create-user" group.pk %}" class="btn btn-success">{% trans "Create user" %}</a>
	    </p>
    {% endif %}
60
      <thead><tr><th></th><th>{% trans "Who" %}</th><th>{% trans "Remove" %}</th></tr></thead>
61
        {% for i in users %}
62 63 64 65 66 67
	  <tr>
            <td><i class="icon-user"></i></td><td>{{i.username}}</td>
	    <td>
              <a data-group_pk="{{ group.pk }}" data-member_pk="{{i.pk}}" href="{% url "dashboard.views.remove-user" member_pk=i.pk group_pk=group.pk %}" class="real-link delete-from-group btn btn-link btn-xs"><i class="icon-remove"><span class="sr-only">{% trans "remove" %}</span></i></a>
            </td>
          </tr>
68
        {% endfor %}
69 70 71 72 73
        <tr>
          <td><i class="icon-plus"></i></td>
          <td colspan="2">
            <input type="text" class="form-control" name="list-new-name"placeholder="{% trans "Name of user" %}">
          </td>
74 75 76
        </tr>
  </tbody>
  </table>
77 78
  <textarea name="list-new-namelist" class="form-control" 
    placeholder="{% trans "List of usernames (one per line)." %}"></textarea>
79 80 81 82 83
  <div class="form-actions">
    <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
  </div>
  </form>

84

85
<h3 id="group-detail-perm-header">{% trans "Permissions"|capfirst %}</h3>
86
  <form action="{{acl.url}}" method="post">{% csrf_token %}
87 88 89 90 91 92
  <table class="table table-striped table-with-form-fields table-bordered" id="group-detail-perm-table">
    <thead>
      <tr>
        <th></th><th>{% trans "Who" %}</th><th>{% trans "What" %}</th><th>{% trans "Remove" %}</th>
      </tr>
    </thead>
93
    <tbody>
94 95 96 97 98 99 100
    {% for i in acl.users %}
    <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>
101
        {% endfor %}
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
        </select>
      </td>
      <td class="user-remove"><a data-group_pk="{{ group.pk }}" data-member_pk="{{i.user.pk }}" href="{% url "dashboard.views.remove-acluser" member_pk=i.user.pk group_pk=group.pk %}" class="real-link delete-from-group btn btn-link btn-xs"><i class="icon-remove"><span class="sr-only">{% trans "remove" %}</span></i></a></td>
    </tr>
    {% endfor %}
    
    {% for i in acl.groups %}
      <tr>
        <td><i class="icon-group"></i></td><td>{{ i.group }}</td>
        <td>
          <select class="form-control" name="perm-g-{{ i.group.pk }}">
          {% for id, name in acl.levels %}
            <option{%if id = i.level%} selected="selected"{%endif%} value="{{id}}">{{name}}</option>
          {% endfor %}
          </select>
        </td>
        <td class="user-remove"><a data-group_pk="{{ i.pk }}"data-member_pk="{{i.group.pk }}" href="{% url "dashboard.views.remove-aclgroup" member_pk=i.group.pk group_pk=group.pk %}" class="real-link delete-from-group btn btn-link btn-xs"><i class="icon-remove"><span class="sr-only">{% trans "remove" %}</span></i></a>
        </td>
      </tr>
      {% 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>
137 138
  </tbody>
  </table>
139

140
  <div class="form-actions">
141 142 143
    <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
  </div>
  </form>
144 145


146 147 148 149 150 151
	</div>
     </div>
    </div>
  </div>
</div>
<script src="{{ STATIC_URL}}dashboard/group-details.js"></script>
152
{% endblock %}