2334be0bdc5c4618b05b1bc96e67aad78b1d57db
[redakcja.git] / apps / organizations / templates / organizations / main.html
1 {% extends "catalogue/base.html" %}
2 {% load i18n %}
3 {% load document_list from document_list %}
4
5 {% block inner_content %}
6
7     {% if am_owner %}
8     <a style="float:right" class="btn btn-default" href="{% url 'organizations_edit' org.pk %}">{% trans "Edit" %}</a>
9     {% elif not my_status %}
10     <a style="float:right" class="btn btn-default" href="{% url 'organizations_join' org.pk %}">{% trans "Join" %}</a>
11     {% endif %}
12     {% if am_member %}
13     <a style="float:right; margin-right: 5px" class="btn btn-default" href="{% url 'catalogue_create_missing' %}?organization={{ org.pk }}">{% trans "New resource +" %}</a>
14     {% endif %}
15
16     {{ org.get_preview_html|safe }}
17
18     {% if tab == 'members' %}
19
20     <ul class="nav nav-tabs">
21         <li role="presentation"><a href="{% url 'organizations_main' org.pk %}">{% trans "Resources" %}</a></li>
22         <li role="presentation" class="active"><a href="#">{% trans "Members" %}</a></li>
23     </ul>
24
25
26     <table class="table table-striped">
27     <thead>
28         <th>{% trans "Name" %}</th>
29         {% if am_owner %}<th>{% trans "E-mail" %}</th>{% endif %}
30         <th>{% trans "Status" %}</th>
31         {% if am_owner %}<th></th>{% endif %}
32     </thead>
33     <tbody>
34
35
36     {% for m in org.membership_set.all %}
37         {% if am_owner or m.status != 'pending' or m.user == request.user %}
38             <tr class="member-{{ m.status }}">
39                 <td>{{ m.user.first_name }} {{ m.user.last_name }}</td>
40                 {% if am_owner %}<td>{{ m.user.email }}</td>{% endif %}
41                 <td>
42                     {% if m.status == 'owner' %}
43                         {% trans "owner" %}
44                         {% if am_owner %}
45                         </td><td>
46                         {% if not m.user == user %}
47                         <form action="{% url 'organizations_membership' org.pk %}" method="POST">
48                             {% csrf_token %}
49                             <input type="hidden" name="user" value="{{ m.user.pk }}">
50                             <div class="btn-group" role="group">
51                                 <button type="submit" name="action" value="regular" class="btn btn-info">{% trans "Make regular" %}</button>
52                                 <button type="submit" name="action" value="remove" class="btn btn-danger">{% trans "Remove" %}</button>
53                             </div>
54                         </form>
55                         {% endif %}
56                         {% endif %}
57                     {% elif m.status == 'pending' %}
58                         {% trans "pending" %}
59                         {% if am_owner %}
60                         </td><td>
61                         <form action="{% url 'organizations_membership' org.pk %}" method="POST">
62                             {% csrf_token %}
63                             <input type="hidden" name="user" value="{{ m.user.pk }}">
64                             <div class="btn-group" role="group">
65                                 <button type="submit" name="action" value="regular" class="btn btn-success">{% trans "Accept" %}</button>
66                                 <button type="submit" name="action" value="remove" class="btn btn-danger">{% trans "Reject" %}</button>
67                             </div>
68                         </form>
69                         {% elif m.user == request.user %}
70                             <br><small>{% trans "Waiting for the owner of the organization to accept you as a member." %}</small>
71                         {% endif %}
72                     {% else %}
73                         regular
74                         {% if am_owner %}
75                         </td><td>
76                         <form action="{% url 'organizations_membership' org.pk %}" method="POST">
77                             {% csrf_token %}
78                             <input type="hidden" name="user" value="{{ m.user.pk }}">
79                             <div class="btn-group" role="group">
80                                 <button type="submit" name="action" value="owner" class="btn btn-warning">{% trans "Make owner" %}</button>
81                                 <button type="submit" name="action" value="remove" class="btn btn-danger">{% trans "Remove" %}</button>
82                             </div>
83                         </form>
84                         {% endif %}
85                     {% endif %}
86                 </td>
87             </tr>
88         {% endif %}
89     {% endfor %}
90     </tbody>
91     </table>
92
93     {% elif tab == 'documents' %}
94
95     <ul class="nav nav-tabs">
96         <li role="presentation" class="active"><a href="">{% trans "Resources" %}</a></li>
97         <li role="presentation"><a href="{% url 'organizations_members' org.pk %}">{% trans "Members" %}</a></li>
98     </ul>
99
100     {% document_list organization=org %}
101
102     {% endif %}
103
104
105 {% endblock %}