root / djnro / templates / edumanage / institution_edit.html @ 4772922a
History | View | Annotate | Download (7.8 kB)
1 |
{% extends "edumanage/welcome.html"%} |
---|---|
2 |
{% load staticfiles %} |
3 |
{% load i18n %} |
4 |
{% load tolocale %} |
5 |
{% block homeactive %}{% endblock %} |
6 |
{% block instactive %}class="active"{% endblock %} |
7 |
{% block management_content %} |
8 |
|
9 |
<h4>{% tolocale institution LANGUAGE_CODE%} {% trans "Edit" %}</h4> |
10 |
<hr>
|
11 |
<div class="col-md-12"> |
12 |
<form method="POST"> |
13 |
{% csrf_token %} |
14 |
{% if form.non_field_errors %} |
15 |
<p class="error"> |
16 |
{{ form.non_field_errors}} |
17 |
</p>
|
18 |
{% endif %} |
19 |
<div style="display: none"> |
20 |
{{form.institution}} |
21 |
</div>
|
22 |
<div class="form-group"> |
23 |
<label class="control-label" for="id_name"><b>{% trans "Name" %}</b></label> |
24 |
<div class="controls"> |
25 |
<input class="input" id="disabledInput" type="text" placeholder="{% tolocale institution LANGUAGE_CODE %}" disabled |
26 |
</div |
27 |
</div |
28 |
<div ="form-group {% if %} error {% endif %}"> |
29 |
<label class="control-label" for="id_ertype"><b>{% trans "Type" %}</b></label> |
30 |
<div class="controls"> |
31 |
<input class="input" id="disabledInput2" type="text" placeholder="{{institution.get_ertype_display}}" disabled |
32 |
</div |
33 |
</div |
34 |
<div ="form-group {% if %} error {% endif %}"> |
35 |
<label class="control-label" for="id_address_street"><b>{% trans "Address Street" %}</b></label> |
36 |
<div class="controls"> |
37 |
{{ form.address_street }} |
38 |
{% if form.address_street.errors %} <span class="help-inline"> {{ form.address_street.errors|join:", " }} </span> |
39 |
{% endif %} <span class="help-block"> {{ form.address_street.help_text }}</span> |
40 |
</div>
|
41 |
</div>
|
42 |
<div class="form-group {% if form.address_city.errors %} error {% endif %}"> |
43 |
<label class="control-label" for="id_address_city"><b>{% trans "Address City" %}</b></label> |
44 |
<div class="controls"> |
45 |
{{ form.address_city }} |
46 |
{% if form.address_city.errors %} <span class="help-inline"> {{ form.address_city.errors|join:", " }} </span> |
47 |
{% endif %} <span class="help-block"> {{ form.address_city.help_text }}</span> |
48 |
</div>
|
49 |
</div>
|
50 |
<div class="form-group {% if form.contact.errors %} error {% endif %}"> |
51 |
<label class="control-label" for="id_contact"><b>{% trans "Contacts" %}</b></label> |
52 |
<div class="controls"> |
53 |
<div class="">{{ form.contact }}</div> |
54 |
<button class="btn btn-small btn-info" id="add_contact"><i class="icon-plus-sign icon-white"></i>Add...</button> |
55 |
{% if form.contact.errors %} <span class="help-inline"> {{ form.ertype.contact|join:", " }} </span> |
56 |
{% endif %} <span class="help-block"> {{ form.contact.help_text }}</span> |
57 |
</div>
|
58 |
</div>
|
59 |
<div class="form-group {% for err in urls_form.errors %}{% if err|length > 0 %}error{% endif %}{% endfor %}{% if urls_form.non_form_errors %}error{% endif %}"> |
60 |
<label class="control-label" for="id_urls"><b>{% trans "Urls" %}</b></label> |
61 |
{{urls_form.management_form}} |
62 |
<div class="controls"> |
63 |
{% if urls_form.non_form_errors %} <span class="help-inline"> {{ urls_form.non_form_errors|join:", "}}</span>{% endif %} |
64 |
<table id="urlsform"><thead><tr><td>url</td><td>type</td><td>language</td></tr></thead><tbody> |
65 |
{% for formset in urls_form.forms %} |
66 |
{{ formset.id }} |
67 |
|
68 |
|
69 |
<tr id="{{ formset.prefix }}-row"> |
70 |
<td> {% if formset.instance.pk %}{{ formset.DELETE }}{% endif %}{{ formset.url }}{% if formset.url.errors %}<br><div class="help-inline"> {{ formset.url.errors|join:", " }} </div>{% endif %}</td> |
71 |
<td>{{formset.urltype}}{% if formset.urltype.errors %}<br><p class="help-inline"> {{ formset.urltype.errors|join:", " }} </p>{% endif %}</td> |
72 |
<td>{{formset.lang}}{% if formset.lang.errors %}<br><p class="help-inline"> {{ formset.lang.errors|join:", " }} </p>{% endif %}</td> |
73 |
|
74 |
</tr>
|
75 |
{% endfor %} |
76 |
</tbody></table> |
77 |
</div>
|
78 |
</div>
|
79 |
{% if institution.ertype == 2 or institution.ertype == 3 %} |
80 |
<div class="form-group {% if form.oper_name.errors %} error {% endif %}"> |
81 |
<label class="control-label" for="id_oper_name"><b>{% trans "Domain Name" %}</b></label> |
82 |
<div class="controls"> |
83 |
{{ form.oper_name }} |
84 |
{% if form.oper_name.errors %} <span class="help-inline"> {{ form.oper_name.errors|join:", " }} </span> |
85 |
{% endif %} <span class="help-block">{% autoescape off %}{{ form.oper_name.help_text }}{% endautoescape %}</span> |
86 |
</div>
|
87 |
</div>
|
88 |
{% endif %} |
89 |
{% if institution.ertype == 1 or institution.ertype == 3 %} |
90 |
<div class="form-group {% if form.number_user.errors %} error {% endif %}"> |
91 |
<label class="control-label" for="id_number_user">{% trans "Number of Users" %}</label> |
92 |
<div class="controls"> |
93 |
{{ form.number_user }} |
94 |
{% if form.number_user.errors %} <span class="help-inline"> {{ form.number_user.errors|join:", " }} </span> |
95 |
{% endif %} <span class="help-block"> {{ form.number_user.help_text }}</span> |
96 |
</div>
|
97 |
</div>
|
98 |
{% endif %} |
99 |
<div class="form-group {% if form.number_id.errors %} error {% endif %}"> |
100 |
<label class="control-label" for="id_number_id">{% trans "Number of IDs" %}</label> |
101 |
<div class="controls"> |
102 |
{{ form.number_id }} |
103 |
{% if form.number_id.errors %} <span class="help-inline"> {{ form.number_id.errors|join:", " }} </span> |
104 |
{% endif %} <span class="help-block"> {{ form.number_id.help_text }}</span> |
105 |
</div>
|
106 |
</div>
|
107 |
<div class="form-group"> |
108 |
<div class="controls"> |
109 |
<button type="submit" id="applybutton" value="Apply" class="btn btn-primary"/>{% trans "Apply" %}</button> |
110 |
</div>
|
111 |
</div>
|
112 |
</form>
|
113 |
</div>
|
114 |
</div>
|
115 |
|
116 |
<div class="modal fade" id="myModal"> |
117 |
<div class="modal-dialog"> |
118 |
<div class="modal-content"> |
119 |
<div class="modal-header"> |
120 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
121 |
<h4 class="modal-title" id="myModalLabel">{% trans "Add User" %}</h4> |
122 |
</div>
|
123 |
<div class="modal-body" id="mymodalbody"> |
124 |
<p>Loading...</p> |
125 |
</div>
|
126 |
<div class="modal-footer"> |
127 |
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button> |
128 |
<button type="button" id="adduserSubmit" class="btn btn-primary">{% trans "Save changes" %}</button> |
129 |
</div>
|
130 |
</div>
|
131 |
</div>
|
132 |
</div>
|
133 |
|
134 |
{% endblock %} |
135 |
|
136 |
{% block extrajs %} |
137 |
<script type="text/javascript" src="{% static 'js/jquery.formset.js' %}"></script> |
138 |
<script type="text/javascript"> |
139 |
$(document).ready(function() {
|
140 |
$("#adduserSubmit").click(function(){
|
141 |
$.ajax({
|
142 |
url:"{% url adduser %}",
|
143 |
data:$("#add_user_form").serialize(),
|
144 |
type: "POST",
|
145 |
cache: false,
|
146 |
success:function(data){
|
147 |
try {
|
148 |
value = data.value;
|
149 |
text = data.text;
|
150 |
if (typeof value === 'undefined' && typeof text === 'undefined'){
|
151 |
$('#mymodalbody').html(data);
|
152 |
}
|
153 |
else{
|
154 |
$('#id_contact').append($("<option></option>").attr("value",value).text(text));
|
155 |
$('#myModal').modal('hide')
|
156 |
}
|
157 |
}
|
158 |
catch (exception) {
|
159 |
$('#mymodalbody').html(data);
|
160 |
}
|
161 |
}
|
162 |
});
|
163 |
return false;
|
164 |
});
|
165 |
|
166 |
$("#add_contact").click(function(){
|
167 |
$('#myModal').modal('show');
|
168 |
$.ajax({
|
169 |
url:"{% url adduser %}",
|
170 |
type: "GET",
|
171 |
success: function(data){
|
172 |
$('#mymodalbody').html(data);
|
173 |
}
|
174 |
});
|
175 |
|
176 |
return false;
|
177 |
});
|
178 |
|
179 |
|
180 |
$('#urlsform tbody tr').formset({
|
181 |
prefix: '{{urls_form.prefix}}',
|
182 |
formCssClass: "dynamic-formset1",
|
183 |
added: addButton,
|
184 |
});
|
185 |
|
186 |
$(".delete-row").prepend('<i class="icon-remove-sign icon-white"></i> ').addClass('btn btn-small btn-warning');
|
187 |
$(".add-row").prepend('<i class="icon-plus-sign icon-white"></i> ').addClass('btn btn-small btn-info');
|
188 |
|
189 |
|
190 |
});
|
191 |
function addButton(row){
|
192 |
$(row).find(".delete-row").prepend('<i class="icon-remove-sign icon-white"></i> ').addClass('btn btn-small btn-warning');
|
193 |
}
|
194 |
|
195 |
</script>
|
196 |
|
197 |
{% endblock %} |