Revision 4772922a djnro/templates/edumanage/contacts.html

b/djnro/templates/edumanage/contacts.html
2 2
{% load i18n %}
3 3
{% load staticfiles %}
4 4

  
5
{% block crumbs %}
6
<li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
7
<li class="active">{% trans "Contacts" %}</li>
5

  
6
{% block homeactive %}{% endblock %}
7
{% block contactsactive %}class="active"{% endblock %}
8
{% block management_content %}
9
<h4>{% trans "Contacts" %}</h4>
10
<hr>
11
  {% if messages %}
12
    <table class="table table-condensed">
13
        {% for message in messages %}
14
        <tr {% if message.tags %} class="{{ message.tags }}"{% endif %}><td>{{ message }}<td></tr>
15
        {% endfor %}
16
    </table>
17
{% endif %}
18
  {% if contacts %}
19
  <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
20
	<thead>
21
	<tr>
22
		<th>{% trans "Name" %}</th>
23
		<th>{% trans "Email" %}</th>
24
		<th>{% trans "Phone" %}</th>
25
		<th style="text-align: center;">{% trans "Action" %}</th>
26
	</tr>
27
	</thead>
28

  
29
	<tbody>
30
    {% for contact in contacts %}
31
  	<tr class="GradeC">
32
    	<td>{{contact.name}}</td>
33
    	<td>{{contact.email}}</td>
34
    	<td>{{contact.phone}}</td>
35
    	<td style="text-align: center;"><a href="{% url edit-contacts contact.pk %}" class="btn btn-small">{% trans "edit" %}</a> <a href="#" id="del_contact_{{contact.pk}}" data-contactname="{{contact.name}}" class="btn btn-small btn-warning">{% trans "delete" %}</a></td>
36
    </tr>
37
  	{% endfor %}
38
  	</tbody>
39
  </table>
40
  {% endif %}
41
<div><a href="{% url edit-contacts %}" class="btn btn-primary">{% trans "Add new contact" %}</a></div>
42
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
43
	<div class="modal-dialog">
44
    	<div class="modal-content">
45
			<div class="modal-header">
46
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
47
				<h3 id="myModalLabel">{% trans "Delete contact" %}</h3>
48
			</div>
49
			<div class="modal-body" id="mymodalbody"></div>
50
			<div class="modal-footer">
51
				<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
52
				<a class="btn btn-warning" id="delcontactSubmit" href="#">{% trans "Delete" %}</a>
53
			</div>
54
		</div>
55
	</div>
56
</div>
8 57
{% endblock %}
9 58

  
10
{% block extrahead %}
11
<script type="text/javascript" src="{% static 'js/jquery.dataTables.min.js' %}"></script>
12
<script type="text/javascript" src="{% static 'js/datatables_bootstrap.js' %}"></script>
59

  
60

  
61
{% block extrajs %}
62
<script type="text/javascript" src="//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
63
<script type="text/javascript" src="//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/1/dataTables.bootstrap.js"></script>
13 64
<script type="text/javascript">
14 65
$(document).ready(function(){
15 66
	 {% if contacts %}
16
var oTable = $('#table').dataTable({
17
	"sPaginationType": "bootstrap",
18
	"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
19
	"aoColumns": [{
20
        "bSearchable": true,
21
        "bSortable": true
22
    }, {
23
        "bSearchable": true,
24
        "bSortable": true
25
    }, {
26
        "bSearchable": true,
27
        "bSortable": true
28
    }, {
29
        "bVisible": true,
30
        "bSearchable": false,
31
        "bSortable": false
32
    }],
33
    "aaSorting": [[0, 'desc']],
34
    "iDisplayLength": 25,
35
    "oSearch": {"bSmart": false, "bRegex":true},
36
    "oLanguage": {
37
    	"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "contacts" %}',
38
        "sProcessing":   "Processing...",
39
        "sZeroRecords": '{% trans "No records to display" %}',
40
        "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
41
        "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
42
        "sInfoFiltered": "(filtered from _MAX_ total entries)",
43
        "sInfoPostFix":  "",
44
        "sSearch":       '{% trans "Search:" %}',
45
        "sUrl":          "",
46
        "oPaginate": {
47
            "sFirst":    '{% trans "First" %}',
48
            "sPrevious": '{% trans "Previous" %}',
49
            "sNext":     '{% trans "Next" %}',
50
            "sLast":     '{% trans "Last" %}'
51
        }
52
    }
53
});
67
var oTable = $('#table')
68
	.on( 'init.dt', function () {
69
	       	$('.pagination ul').addClass('pagination');
70
	    })
71
	.dataTable({
72
		"sPaginationType": "bootstrap",
73
		"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
74
		"aoColumns": [{
75
	        "bSearchable": true,
76
	        "bSortable": true
77
	    }, {
78
	        "bSearchable": true,
79
	        "bSortable": true
80
	    }, {
81
	        "bSearchable": true,
82
	        "bSortable": true
83
	    }, {
84
	        "bVisible": true,
85
	        "bSearchable": false,
86
	        "bSortable": false
87
	    }],
88
	    "aaSorting": [[0, 'desc']],
89
	    "iDisplayLength": 25,
90
	    "oSearch": {"bSmart": false, "bRegex":true},
91
	    "oLanguage": {
92
	    	"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "contacts" %}',
93
	        "sProcessing":   "Processing...",
94
	        "sZeroRecords": '{% trans "No records to display" %}',
95
	        "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
96
	        "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
97
	        "sInfoFiltered": "(filtered from _MAX_ total entries)",
98
	        "sInfoPostFix":  "",
99
	        "sSearch":       '{% trans "Search:" %}',
100
	        "sUrl":          "",
101
	        "oPaginate": {
102
	            "sFirst":    '{% trans "First" %}',
103
	            "sPrevious": '{% trans "Previous" %}',
104
	            "sNext":     '{% trans "Next" %}',
105
	            "sLast":     '{% trans "Last" %}'
106
	        }
107
	    }
108
	});
54 109

  
55
oTable.fnDraw();
110
	oTable.fnDraw();
56 111

  
57 112
$('[id^=del_contact_]').click(function(){
58 113
	contact_id = (this.id).replace("del_contact_", '');
......
88 143
});
89 144
</script>
90 145
{% endblock %}
91

  
92
	{% block navbar %}
93

  
94
    		{% endblock %}
95

  
96
    		{% block homeactive %}{% endblock %}
97
    		{% block contactsactive %}class="active"{% endblock %}
98
				{% block management_content %}
99

  
100

  
101
	              <h4>{% trans "Contacts" %}</h4>
102
	              <hr>
103
	              {% if messages %}
104
                    <table class="table table-condensed">
105
                        {% for message in messages %}
106
                        <tr {% if message.tags %} class="{{ message.tags }}"{% endif %}><td>{{ message }}<td></tr>
107
                        {% endfor %}
108
                    </table>
109
                {% endif %}
110
	              <div><a href="{% url edit-contacts %}" class="btn btn-primary">{% trans "Add new contact" %}</a></div>
111
	              <div class="span10"></div>
112
	              {% if contacts %}
113
	              <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
114
					<thead>
115
					<tr>
116
						<th>{% trans "Name" %}</th>
117
						<th>{% trans "Email" %}</th>
118
						<th>{% trans "Phone" %}</th>
119
						<th style="text-align: center;">{% trans "Action" %}</th>
120
					</tr>
121
					</thead>
122

  
123
					<tbody>
124
	                {% for contact in contacts %}
125
	              	<tr class="GradeC">
126
	                	<td>{{contact.name}}</td>
127
	                	<td>{{contact.email}}</td>
128
	                	<td>{{contact.phone}}</td>
129
	                	<td style="text-align: center;"><a href="{% url edit-contacts contact.pk %}" class="btn btn-small">{% trans "edit" %}</a> <a href="#" id="del_contact_{{contact.pk}}" data-contactname="{{contact.name}}" class="btn btn-small btn-warning">{% trans "delete" %}</a></td>
130
	                </tr>
131
	              	{% endfor %}
132
	              	</tbody>
133
	              </table>
134
	              {% endif %}
135
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
136
<div class="modal-header">
137
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
138
<h3 id="myModalLabel">{% trans "Delete contact" %}</h3>
139
</div>
140
<div class="modal-body" id="mymodalbody">
141

  
142
</div>
143
<div class="modal-footer">
144
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
145
<a class="btn btn-warning" id="delcontactSubmit" href="#">{% trans "Delete" %}</a>
146
</div>
147
</div>
148
            {% endblock %}
149

  

Also available in: Unified diff