group-detail.html 6.54 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 53 54 55
<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>
56
<form action="" method="post">{% csrf_token %}
57
<table class="table table-striped table-with-form-fields table-bordered" id="group-detail-user-table">
58
    <tbody>
59
      <thead><tr><th></th><th>{% trans "Who" %}</th><th>{% trans "Remove" %}</th></tr></thead>
60
        {% for i in users %}
61
	  <tr>
62 63 64 65
            <td>
              <i class="icon-user"></i>
            </td>
            <td>
66
              <a href="{% url "dashboard.views.profile" username=i.username %}" title="{{ i.username }}"
67
                >{% include "dashboard/_display-name.html" with user=i show_org=True %}</a>
68
            </td>
69 70 71 72
	    <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>
73
        {% endfor %}
74 75 76 77 78
        <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>
79 80 81
        </tr>
  </tbody>
  </table>
82 83
  <textarea name="list-new-namelist" class="form-control" 
    placeholder="{% trans "List of usernames (one per line)." %}"></textarea>
84 85 86 87 88
  <div class="form-actions">
    <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
  </div>
  </form>

89

90
<h3 id="group-detail-perm-header">{% trans "Permissions"|capfirst %}</h3>
91
  <form action="{{acl.url}}" method="post">{% csrf_token %}
92 93 94 95 96 97
  <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>
98
    <tbody>
99 100
    {% for i in acl.users %}
    <tr>
101 102 103 104
      <td>
        <i class="icon-user"></i>
      </td>
      <td>
105
        <a href="{% url "dashboard.views.profile" username=i.user.username %}" title="{{ i.user.username }}"
106
          >{% include "dashboard/_display-name.html" with user=i.user show_org=True %}</a>
107
      </td>
108 109 110 111
      <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>
112
        {% endfor %}
113 114 115 116 117 118 119 120
        </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>
121 122 123 124 125 126
        <td>
          <i class="icon-group"></i>
        </td>
        <td>
          <a href="{% url "dashboard.views.group-detail" pk=i.group.pk %}">{{ i.group }}</a>
        </td>
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
        <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>
153 154
  </tbody>
  </table>
155

156
  <div class="form-actions">
157 158 159
    <button type="submit" class="btn btn-success">{% trans "Save" %}</button>
  </div>
  </form>
160 161


162 163 164 165 166 167
	</div>
     </div>
    </div>
  </div>
</div>
<script src="{{ STATIC_URL}}dashboard/group-details.js"></script>
168
{% endblock %}