Revision 4772922a djnro/templates/overview/index.html

b/djnro/templates/overview/index.html
2 2
{% load i18n %}
3 3
{% load tolocale %}
4 4
{% load staticfiles %}
5

  
6 5
{% load i18n %}
7
{% block extrahead %}
6
{% load tolocale %}
7

  
8

  
9
{% block content %}
10
<div class="row">
11
	<div class="col-md-12">
12
		<div class="col-md-2">
13
			<div class="push-top"></div>
14
			<div class="well sidebar-nav">
15
				<ul class="nav nav-list">
16
					<li {% block homeactive %}class="active"{% endblock %}>
17
						<a href="{% url overview %}">{% trans "Overview" %}</a>
18
					</li>
19
					<li>
20
						<a href="{% url logout %}">{% trans "Logout" %}</a>
21
					</li>
22
				</ul>
23
			</div><!--/.well -->
24
		</div><!--/span-->
25
		<div class="col-md-10">
26
			<div class="row">
27
				<!--/span-->
28
				<div class="col-md-12">
29
				{% if violation %}
30
			  	<table class="table table-condensed">
31
					    <tr class="error"><td>You have no rights to access this area. Please contact your administrator<td></tr>
32
					</table>
33
				{% else %}
34
              <h4>{% trans "Users - Institutions" %}</h4>
35
              <hr>
36
                <ul class="nav nav-tabs">
37
				    <li class="active"><a href="#users" data-toggle="tab">{% trans "Users" %}</a></li>
38
				    <li><a href="#institutions" data-toggle="tab">{% trans "Institutions" %}</a></li>
39
			    </ul>
40

  
41
    			<div class="tab-content" style="margin-top: 20px;">
42
              		<div class="tab-pane active" id="users">
43
              		{% if users %}
44
               			<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="usertable">
45
	               			<thead>
46
								<tr>
47
									<th>{% trans "Username" %}</th>
48
									<th>{% trans "Email" %}</th>
49
									<th>{% trans "Name" %}</th>
50
									<th>{% trans "Status" %}</th>
51
									<th>{% trans "Institution" %}</th>
52
								</tr>
53
							</thead>
54
							<tbody>
55
	                			{% for user in users %}
56
	              				<tr class="GradeC">
57
	                				<td>{{user.username}}</td>
58
	                				<td>{{user.email}}</td>
59
	                				<td>{{user.first_name}} {{user.last_name}}</td>
60
	                				<td>
61
	                					{% if user.registrationprofile_set.all %}
62
	                						{% if user.registrationprofile_set.all.0.activation_key == "ALREADY_ACTIVATED" %}
63
	                							{% trans "Active" %}
64
	                						{% else %}
65
	                							{% trans "Inactive" %} or {% trans "Key Expired" %}
66
	                						{% endif %}
67
	                					{% else %}-{% endif %}
68
	                				</td>
69
	                				<td>{% if user.get_profile.institution %}{% tolocale user.get_profile.institution LANGUAGE_CODE %}{% endif %}</td>
70
	                			</tr>
71
	              				{% endfor %}
72
	              			</tbody>
73
	              		</table>
74
	              		{% endif %}
75
				  	</div>
76
				  	<div class="tab-pane" id="institutions">
77
	              		{% if institutions %}
78
               			<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="insttable">
79
	               			<thead>
80
								<tr>
81
									<th>{% trans "Name" %}</th>
82
									<th>{% trans "Type" %}</th>
83
									<th>{% trans "Contacts" %}</th>
84
									<th>{% trans "Address" %}</th>
85
									<th>{% trans "Admin Users" %}</th>
86
								</tr>
87
							</thead>
88
							<tbody>
89
				                {% for institution in institutions %}
90
				              	<tr class="GradeC">
91
				                	<td>{% tolocale institution LANGUAGE_CODE %}</td>
92
				                	<td>{{institution.get_ertype_display}}</td>
93
				                	<td>{% if institution.institutiondetails.contact.all %}{% for contact in institution.institutiondetails.contact.all %}{{contact}}<br>{% endfor %}{% endif %}</td>
94
			                        <td>{{institution.institutiondetails.address_street}}<br>{{institution.institutiondetails.address_city}}</td>
95
				                	<td>{% if institution.userprofile_set.all %}{% for admuser in institution.userprofile_set.all %}{{admuser.user}}<br>{% endfor %}{% endif %}</td>
96

  
97
				                </tr>
98
				              	{% endfor %}
99
	              			</tbody>
100
	              		</table>
101
	              		{% endif %}
102
	              	</div>
103
	             </div>
104
				{% endif %}
105
				</div>
106
			</div>
107
		</div><!--/span-->
108
	</div><!--/row-->
109
</div><!--/.fluid-container-->
110
{% endblock %}
8 111

  
9
<script type="text/javascript" src="{% static 'js/jquery.dataTables.min.js' %}"></script>
10
<script type="text/javascript" src="{% static 'js/datatables_bootstrap.js' %}"></script>
11
<style>
12
.tab-content {
13
    overflow: visible;
14
}
15
</style>
112

  
113

  
114

  
115
{% block extrajs %}
116
<script type="text/javascript" src="//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
117
<script type="text/javascript" src="//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/1/dataTables.bootstrap.js"></script>
16 118
<script type="text/javascript">
17 119
$(document).ready(function(){
18 120

  
......
60 162
oTableU.fnDraw();
61 163

  
62 164

  
63
var oTableI = $('#insttable').dataTable({
64
	"sPaginationType": "bootstrap",
65
	"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
66
	"aoColumns": [{
67
        "bSearchable": true,
68
        "bSortable": true
69
    }, {
70
        "bSearchable": true,
71
        "bSortable": true
72
    }, {
73
        "bSearchable": true,
74
        "bSortable": true
75
    }, {
76
        "bSearchable": true,
77
        "bSortable": true
78
    }, {
79
        "bSearchable": true,
80
        "bSortable": true
81
    }],
82
    "aaSorting": [[0, 'desc']],
83
    "iDisplayLength": 25,
84
    "oSearch": {"bSmart": false, "bRegex":true},
85
    "oLanguage": {
86
    	"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "institutions" %}',
87
        "sProcessing":   "Processing...",
88
        "sZeroRecords": '{% trans "No records to display" %}',
89
        "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
90
        "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
91
        "sInfoFiltered": "(filtered from _MAX_ total entries)",
92
        "sInfoPostFix":  "",
93
        "sSearch":       '{% trans "Search:" %}',
94
        "sUrl":          "",
95
        "oPaginate": {
96
            "sFirst":    '{% trans "First" %}',
97
            "sPrevious": '{% trans "Previous" %}',
98
            "sNext":     '{% trans "Next" %}',
99
            "sLast":     '{% trans "Last" %}'
100
        }
101
    }
102
});
165
var oTableI = $('#insttable')
166
	.on( 'init.dt', function () {
167
	       	$('.pagination ul').addClass('pagination');
168
	    })
169
	.dataTable({
170
		"sPaginationType": "bootstrap",
171
		"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
172
		"aoColumns": [{
173
	        "bSearchable": true,
174
	        "bSortable": true
175
	    }, {
176
	        "bSearchable": true,
177
	        "bSortable": true
178
	    }, {
179
	        "bSearchable": true,
180
	        "bSortable": true
181
	    }, {
182
	        "bSearchable": true,
183
	        "bSortable": true
184
	    }, {
185
	        "bSearchable": true,
186
	        "bSortable": true
187
	    }],
188
	    "aaSorting": [[0, 'desc']],
189
	    "iDisplayLength": 25,
190
	    "oSearch": {"bSmart": false, "bRegex":true},
191
	    "oLanguage": {
192
	    	"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "institutions" %}',
193
	        "sProcessing":   "Processing...",
194
	        "sZeroRecords": '{% trans "No records to display" %}',
195
	        "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
196
	        "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
197
	        "sInfoFiltered": "(filtered from _MAX_ total entries)",
198
	        "sInfoPostFix":  "",
199
	        "sSearch":       '{% trans "Search:" %}',
200
	        "sUrl":          "",
201
	        "oPaginate": {
202
	            "sFirst":    '{% trans "First" %}',
203
	            "sPrevious": '{% trans "Previous" %}',
204
	            "sNext":     '{% trans "Next" %}',
205
	            "sLast":     '{% trans "Last" %}'
206
	        }
207
	    }
208
	});
103 209

  
104 210
oTableI.fnDraw();
105 211

  
106 212
});
107 213
</script>
108 214
{% endblock %}
109

  
110
{% block content %}
111
<div class="container-fluid">
112
	<div class="row-fluid">
113
		<div class="span2"></div>
114
		<div class="span10">
115
			<div class="row-fluid">
116
			<div class="span12">
117
				<ul class="breadcrumb" style="display: inline-table; padding: 0">
118
					{% block crumbs %}
119
	    			<li class="active">{% trans "Overview" %}</li>
120
	    			{% endblock %}
121
	    		</ul>
122
			<p class="pull-right"><strong>{{user}}</strong> (<a href="{% url logout %}">{% trans "Logout" %}</a>)</p>
123
			</div></div>
124
		</div>
125
	</div>
126
	<div class="row-fluid">
127
		<div class="span2">
128
			<div class="well sidebar-nav">
129
				<ul class="nav nav-list">
130
					<li {% block homeactive %}class="active"{% endblock %}>
131
						<a href="{% url overview %}">{% trans "Overview" %}</a>
132
					</li>
133
					<li>
134
						<a href="{% url logout %}">{% trans "Logout" %}</a>
135
					</li>
136

  
137
				</ul>
138
			</div><!--/.well -->
139
		</div><!--/span-->
140
		<div class="span10">
141
			<div class="row-fluid">
142
				<!--/span-->
143
				<div class="span12">
144
				{% if violation %}
145
			  	<table class="table table-condensed">
146
					    <tr class="error"><td>You have no rights to access this area. Please contact your administrator<td></tr>
147
					</table>
148
				{% else %}
149
				   {% block subcontent %}
150
              <h4>{% trans "Users - Institutions" %}</h4>
151
              <hr>
152

  
153
              {% load tolocale %}
154

  
155

  
156
                <ul class="nav nav-tabs">
157
				    <li class="active"><a href="#users" data-toggle="tab">{% trans "Users" %}</a></li>
158
				    <li><a href="#institutions" data-toggle="tab">{% trans "Institutions" %}</a></li>
159
			    </ul>
160

  
161
    <div class="tab-content">
162

  
163
              <div class="tab-pane active" id="users">
164
              {% if users %}
165
               <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="usertable">
166
	               <thead>
167
					<tr>
168
					<th>{% trans "Username" %}</th>
169
					<th>{% trans "Email" %}</th>
170
					<th>{% trans "Name" %}</th>
171
					<th>{% trans "Status" %}</th>
172
					<th>{% trans "Institution" %}</th>
173
					</tr>
174
					</thead>
175
					<tbody>
176
	                {% for user in users %}
177
	              	<tr class="GradeC">
178
	                	<td>{{user.username}}</td>
179
	                	<td>{{user.email}}</td>
180
	                	<td>{{user.first_name}} {{user.last_name}}</td>
181
	                	<td>{% if user.registrationprofile_set.all %}{% if user.registrationprofile_set.all.0.activation_key == "ALREADY_ACTIVATED" %}{% trans "Active" %}{% else %}{% trans "Inactive" %} or {% trans "Key Expired" %}{% endif %}{% else %}-{% endif %}</td>
182
	                	<td>{% if user.get_profile.institution %}{% tolocale user.get_profile.institution LANGUAGE_CODE %}{% endif %}</td>
183
	                </tr>
184
	              	{% endfor %}
185
	              	</tbody>
186
	              </table>
187
	              {% endif %}
188
				  </div>
189
				  <div class="tab-pane" id="institutions">
190
	              {% if institutions %}
191
               <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="insttable">
192
	               <thead>
193
					<tr>
194
					<th>{% trans "Name" %}</th>
195
					<th>{% trans "Type" %}</th>
196
					<th>{% trans "Contacts" %}</th>
197
					<th>{% trans "Address" %}</th>
198
					<th>{% trans "Admin Users" %}</th>
199

  
200
					</tr>
201
					</thead>
202
					<tbody>
203
	                {% for institution in institutions %}
204
	              	<tr class="GradeC">
205
	                	<td>{% tolocale institution LANGUAGE_CODE %}</td>
206
	                	<td>{{institution.get_ertype_display}}</td>
207
	                	<td>{% if institution.institutiondetails.contact.all %}{% for contact in institution.institutiondetails.contact.all %}{{contact}}<br>{% endfor %}{% endif %}</td>
208
                        <td>{{institution.institutiondetails.address_street}}<br>{{institution.institutiondetails.address_city}}</td>
209
	                	<td>{% if institution.userprofile_set.all %}{% for admuser in institution.userprofile_set.all %}{{admuser.user}}<br>{% endfor %}{% endif %}</td>
210

  
211
	                </tr>
212
	              	{% endfor %}
213
	              	</tbody>
214
	              </table>
215
	              {% endif %}
216
	              </div>
217
	             </div>
218

  
219
		{% endblock %}
220
				  {% endif %}
221

  
222
				</div><!--/span-->
223
				<!--/span-->
224
			</div><!--/row-->
225
		</div><!--/span-->
226
	</div><!--/row-->
227
</div><!--/.fluid-container-->
228
{% endblock %}
229

  
230

  
231

  

Also available in: Unified diff