group-detail.html 7.43 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 52
<hr />

53 54 55 56 57
<h3>{% trans "User list"|capfirst %}
    {% if perms.auth.add_user %}
        <a href="{% url "dashboard.views.create-user" group.pk %}" class="btn btn-success pull-right">{% trans "Create user" %}</a>
    {% endif %}
</h3>
58
<form action="" method="post">{% csrf_token %}
59
<table class="table table-striped table-with-form-fields table-bordered" id="group-detail-user-table">
60
    <tbody>
61
      <thead><tr><th></th><th>{% trans "Who" %}</th><th>{% trans "Remove" %}</th></tr></thead>
62
        {% for i in users %}
63
	  <tr>
64 65 66 67
            <td>
              <i class="icon-user"></i>
            </td>
            <td>
68
              <a href="{% url "dashboard.views.profile" username=i.username %}" title="{{ i.username }}"
69
                >{% include "dashboard/_display-name.html" with user=i show_org=True %}</a>
70
            </td>
71 72 73 74
	    <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>
75
        {% endfor %}
76 77 78 79 80 81 82 83 84 85 86 87 88
        {% for i in future_users %}
	  <tr>
            <td>
              <i class="icon-user text-muted"></i>
            </td>
            <td> {{ i.org_id }} </td>
	    <td>
              <a href="{% url "dashboard.views.remove-future-user" member_org_id=i.org_id group_pk=group.pk %}"
                  class="real-link btn-link btn-xs">
                  <i class="icon-remove"><span class="sr-only">{% trans "remove" %}</span></i></a>
            </td>
          </tr>
        {% endfor %}
89 90 91
        <tr>
          <td><i class="icon-plus"></i></td>
          <td colspan="2">
92 93
            <input type="text" class="form-control" name="list-new-name"
            placeholder="{% trans "Name of user" %}">
94
          </td>
95 96 97
        </tr>
  </tbody>
  </table>
98
  <textarea name="list-new-namelist" class="form-control" 
99
    placeholder="{% trans "Add multiple users at once (one identifier per line)." %}"></textarea>
100 101 102 103 104
  <div class="form-actions">
    <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
  </div>
  </form>

105 106
  <hr />
<h3 id="group-detail-perm-header">{% trans "Access permissions"|capfirst %}</h3>
107
  <form action="{{acl.url}}" method="post">{% csrf_token %}
108 109 110 111 112 113
  <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>
114
    <tbody>
115 116
    {% for i in acl.users %}
    <tr>
117 118 119 120
      <td>
        <i class="icon-user"></i>
      </td>
      <td>
121
        <a href="{% url "dashboard.views.profile" username=i.user.username %}" title="{{ i.user.username }}"
122
          >{% include "dashboard/_display-name.html" with user=i.user show_org=True %}</a>
123
      </td>
124 125 126 127
      <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>
128
        {% endfor %}
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>
137 138 139 140 141 142
        <td>
          <i class="icon-group"></i>
        </td>
        <td>
          <a href="{% url "dashboard.views.group-detail" pk=i.group.pk %}">{{ i.group }}</a>
        </td>
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
        <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>
169 170
  </tbody>
  </table>
171

172
  <div class="form-actions">
173 174 175
    <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
  </div>
  </form>
176

177 178 179 180 181 182 183 184 185 186 187 188 189 190
{% if user.is_superuser %}
  <hr />

<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
{{ group_perm_form.media }}

<h3>{% trans "Group permissions" %}</h3>

<div id="group-detail-permission">
{% crispy group_perm_form %}
</div>

<link rel="stylesheet" type="text/css" href="/static/admin/css/widgets.css" />
191

192
{% endif %}
193 194 195 196 197
	</div>
     </div>
    </div>
  </div>
</div>
198
{% endblock %}