Revision 1d70dbce djnro/templates/edumanage/institution_edit.html

b/djnro/templates/edumanage/institution_edit.html
2 2
{% load staticfiles %}
3 3
{% load i18n %}
4 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

  
12
	<div class="col-md-12">
13
		<form method="POST">
14
			{% csrf_token %}
15
			{% if form.non_field_errors %}
16
			<p class="error">
17
				{{ form.non_field_errors}}
18
			</p>
19
			{% endif %}
20
			<div style="display: none">
21
				{{form.institution}}
22
			</div>
23
			<div class="form-group">
24
				<label class="control-label" for="id_name"><b>{% trans "Name" %}</b></label>
25
				<div class="controls">
26
					<input class="input" id="disabledInput" type="text" placeholder="{% tolocale institution LANGUAGE_CODE %}" disabled>
27
				</div>
28
			</div>
29
			<div class="form-group {% if form.ertype.errors %} error {% endif %}">
30
				<label class="control-label" for="id_ertype"><b>{% trans "Type" %}</b></label>
31
				<div class="controls">
32
					<input class="input" id="disabledInput2" type="text" placeholder="{{institution.get_ertype_display}}" disabled>
33
				</div>
34
			</div>
35
			<div class="form-group {% if form.address_street.errors %} error {% endif %}">
36
				<label class="control-label" for="id_address_street"><b>{% trans "Address Street" %}</b></label>
37
				<div class="controls">
38
					{{ form.address_street }}
39
					{% if form.address_street.errors %} <span class="help-inline"> {{ form.address_street.errors|join:", " }} </span>
40
					{% endif %} <span class="help-block"> {{ form.address_street.help_text }}</span>
41
				</div>
42
			</div>
43
			<div class="form-group {% if form.address_city.errors %} error {% endif %}">
44
				<label class="control-label" for="id_address_city"><b>{% trans "Address City" %}</b></label>
45
				<div class="controls">
46
					{{ form.address_city }}
47
					{% if form.address_city.errors %} <span class="help-inline"> {{ form.address_city.errors|join:", " }} </span>
48
					{% endif %} <span class="help-block"> {{ form.address_city.help_text }}</span>
49
				</div>
50
			</div>
51
			<div class="form-group {% if form.contact.errors %} error {% endif %}">
52
				<label class="control-label" for="id_contact"><b>{% trans "Contacts" %}</b></label>
53
				<div class="controls">
54
					<div class="">{{ form.contact }}</div>
55
					<button class="btn btn-small btn-info" id="add_contact"><i class="icon-plus-sign icon-white"></i>Add...</button>
56
					{% if form.contact.errors %} <span class="help-inline"> {{ form.ertype.contact|join:", " }} </span>
57
					{% endif %} <span class="help-block"> {{ form.contact.help_text }}</span>
58
				</div>
59
			</div>
60
		    <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 %}">
61
		        <label class="control-label" for="id_urls"><b>{% trans "Urls" %}</b></label>
62
		        {{urls_form.management_form}}
63
		        <div class="controls">
64
		        {% if urls_form.non_form_errors %} <span class="help-inline"> {{ urls_form.non_form_errors|join:", "}}</span>{% endif %}
65
		            <table id="urlsform"><thead><tr><td>url</td><td>type</td><td>language</td></tr></thead><tbody>
66
		        {% for formset in urls_form.forms %}
67
		        {{ formset.id }}
68

  
69

  
70
		            <tr id="{{ formset.prefix }}-row">
71
		            <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>
72
		             <td>{{formset.urltype}}{% if formset.urltype.errors %}<br><p class="help-inline"> {{ formset.urltype.errors|join:", " }} </p>{% endif %}</td>
73
		             <td>{{formset.lang}}{% if formset.lang.errors %}<br><p class="help-inline"> {{ formset.lang.errors|join:", " }} </p>{% endif %}</td>
74

  
75
		        </tr>
76
		        {% endfor %}
77
		        </tbody></table>
78
		        </div>
79
		    </div>
80
		    {% if institution.ertype == 2 or institution.ertype == 3 %}
81
			<div class="form-group {% if form.oper_name.errors %} error {% endif %}">
82
				<label class="control-label" for="id_oper_name"><b>{% trans "Domain Name" %}</b></label>
83
				<div class="controls">
84
					{{ form.oper_name }}
85
					{% if form.oper_name.errors %} <span class="help-inline"> {{ form.oper_name.errors|join:", " }} </span>
86
					{% endif %} <span class="help-block">{% autoescape off %}{{ form.oper_name.help_text }}{% endautoescape %}</span>
87
				</div>
88
			</div>
89
			{% endif %}
90
			{% if institution.ertype == 1 or institution.ertype == 3 %}
91
			<div class="form-group {% if form.number_user.errors %} error {% endif %}">
92
				<label class="control-label" for="id_number_user">{% trans "Number of Users" %}</label>
93
				<div class="controls">
94
					{{ form.number_user }}
95
					{% if form.number_user.errors %} <span class="help-inline"> {{ form.number_user.errors|join:", " }} </span>
96
					{% endif %} <span class="help-block"> {{ form.number_user.help_text }}</span>
97
				</div>
98
			</div>
99
			{% endif %}
100
			<div class="form-group {% if form.number_id.errors %} error {% endif %}">
101
				<label class="control-label" for="id_number_id">{% trans "Number of IDs" %}</label>
102
				<div class="controls">
103
					{{ form.number_id }}
104
					{% if form.number_id.errors %} <span class="help-inline"> {{ form.number_id.errors|join:", " }} </span>
105
					{% endif %} <span class="help-block"> {{ form.number_id.help_text }}</span>
106
				</div>
107
			</div>
108
			<div class="form-group">
109
				<div class="controls">
110
					<button type="submit" id="applybutton" value="Apply" class="btn btn-primary"/>{% trans "Apply" %}</button>
111
				</div>
112
			</div>
113
		</form>
114
	</div>
115
</div>
116

  
117
<div class="modal fade" id="myModal">
118
  <div class="modal-dialog">
119
    <div class="modal-content">
120
      <div class="modal-header">
121
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
122
        <h4 class="modal-title" id="myModalLabel">{% trans "Add User" %}</h4>
123
      </div>
124
      <div class="modal-body" id="mymodalbody">
125
        <p>Loading...</p>
126
      </div>
127
      <div class="modal-footer">
128
        <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
129
        <button type="button" id="adduserSubmit" class="btn btn-primary">{% trans "Save changes" %}</button>
130
      </div>
131
    </div>
132
  </div>
133
</div>
5 134

  
6
{% block crumbs %}
7
	<li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
8
	<li><a href="{% url institutions %}">{% trans "Institution" %}</a><span class="divider">/</span></li>
9
	<li class="active">{% tolocale institution LANGUAGE_CODE%} ({% trans "Edit" %})</li>
10 135
{% endblock %}
11 136

  
12
{% block extrahead %}
137
{% block extrajs %}
13 138
<script type="text/javascript" src="{% static 'js/jquery.formset.js' %}"></script>
14 139
<script type="text/javascript">
15 140
$(document).ready(function() {
......
40 165
	});
41 166

  
42 167
	$("#add_contact").click(function(){
43
	 $('#myModal').modal('show')
44
	 $.ajax({
45
			url:"{% url adduser %}",
46
			type: "GET",
47
			success: function(data){
48
				$('#mymodalbody').html(data);
168
		$('#myModal').modal('show');
169
		$.ajax({
170
				url:"{% url adduser %}",
171
				type: "GET",
172
				success: function(data){
173
					$('#mymodalbody').html(data);
49 174
				}
50 175
			});
51 176

  
......
71 196
</script>
72 197

  
73 198
{% endblock %}
74
{% block homeactive %}{% endblock %}
75
{% block instactive %}class="active"{% endblock %}
76
{% block subcontent %}
77
<h4>{% tolocale institution LANGUAGE_CODE%} {% trans "Edit" %}</h4>
78
<hr>
79
<form method="POST" class="form-horizontal">
80
	{% csrf_token %}
81
	{% if form.non_field_errors %}
82
	<p class="error">
83
		{{ form.non_field_errors}}
84
	</p>
85
	{% endif %}
86
	<div style="display: none">
87
		{{form.institution}}
88
	</div>
89
		<div class="control-group">
90
		<label class="control-label" for="id_name"><b>{% trans "Name" %}</b></label>
91
		<div class="controls">
92
			<input class="input" id="disabledInput" type="text" placeholder="{% tolocale institution LANGUAGE_CODE %}" disabled>
93
		</div>
94
	</div>
95
	<div class="control-group {% if form.ertype.errors %} error {% endif %}">
96
		<label class="control-label" for="id_ertype"><b>{% trans "Type" %}</b></label>
97
		<div class="controls">
98
			<input class="input" id="disabledInput2" type="text" placeholder="{{institution.get_ertype_display}}" disabled>
99
		</div>
100
	</div>
101
	<div class="control-group {% if form.address_street.errors %} error {% endif %}">
102
		<label class="control-label" for="id_address_street"><b>{% trans "Address Street" %}</b></label>
103
		<div class="controls">
104
			{{ form.address_street }}
105
			{% if form.address_street.errors %} <span class="help-inline"> {{ form.address_street.errors|join:", " }} </span>
106
			{% endif %} <span class="help-block"> {{ form.address_street.help_text }}</span>
107
		</div>
108
	</div>
109
	<div class="control-group {% if form.address_city.errors %} error {% endif %}">
110
		<label class="control-label" for="id_address_city"><b>{% trans "Address City" %}</b></label>
111
		<div class="controls">
112
			{{ form.address_city }}
113
			{% if form.address_city.errors %} <span class="help-inline"> {{ form.address_city.errors|join:", " }} </span>
114
			{% endif %} <span class="help-block"> {{ form.address_city.help_text }}</span>
115
		</div>
116
	</div>
117
	<div class="control-group {% if form.contact.errors %} error {% endif %}">
118
		<label class="control-label" for="id_contact"><b>{% trans "Contacts" %}</b></label>
119
		<div class="controls">
120
			{{ form.contact }} <button class="btn btn-small btn-info" id="add_contact"><i class="icon-plus-sign icon-white"></i>Add...</button>
121
			{% if form.contact.errors %} <span class="help-inline"> {{ form.ertype.contact|join:", " }} </span>
122
			{% endif %} <span class="help-block"> {{ form.contact.help_text }}</span>
123
		</div>
124
	</div>
125
    <div class="control-group {% for err in urls_form.errors %}{% if err|length > 0 %}error{% endif %}{% endfor %}{% if urls_form.non_form_errors %}error{% endif %}">
126
        <label class="control-label" for="id_urls"><b>{% trans "Urls" %}</b></label>
127
        {{urls_form.management_form}}
128
        <div class="controls">
129
        {% if urls_form.non_form_errors %} <span class="help-inline"> {{ urls_form.non_form_errors|join:", "}}</span>{% endif %}
130
            <table id="urlsform"><thead><tr><td>url</td><td>type</td><td>language</td></tr></thead><tbody>
131
        {% for formset in urls_form.forms %}
132
        {{ formset.id }}
133

  
134

  
135
            <tr id="{{ formset.prefix }}-row">
136
            <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>
137
             <td>{{formset.urltype}}{% if formset.urltype.errors %}<br><p class="help-inline"> {{ formset.urltype.errors|join:", " }} </p>{% endif %}</td>
138
             <td>{{formset.lang}}{% if formset.lang.errors %}<br><p class="help-inline"> {{ formset.lang.errors|join:", " }} </p>{% endif %}</td>
139

  
140
        </tr>
141
        {% endfor %}
142
        </tbody></table>
143
        </div>
144
    </div>
145
    {% if institution.ertype == 2 or institution.ertype == 3 %}
146
	<div class="control-group {% if form.oper_name.errors %} error {% endif %}">
147
		<label class="control-label" for="id_oper_name"><b>{% trans "Domain Name" %}</b></label>
148
		<div class="controls">
149
			{{ form.oper_name }}
150
			{% if form.oper_name.errors %} <span class="help-inline"> {{ form.oper_name.errors|join:", " }} </span>
151
			{% endif %} <span class="help-block">{% autoescape off %}{{ form.oper_name.help_text }}{% endautoescape %}</span>
152
		</div>
153
	</div>
154
	{% endif %}
155
	{% if institution.ertype == 1 or institution.ertype == 3 %}
156
	<div class="control-group {% if form.number_user.errors %} error {% endif %}">
157
		<label class="control-label" for="id_number_user">{% trans "Number of Users" %}</label>
158
		<div class="controls">
159
			{{ form.number_user }}
160
			{% if form.number_user.errors %} <span class="help-inline"> {{ form.number_user.errors|join:", " }} </span>
161
			{% endif %} <span class="help-block"> {{ form.number_user.help_text }}</span>
162
		</div>
163
	</div>
164
	{% endif %}
165
	<div class="control-group {% if form.number_id.errors %} error {% endif %}">
166
		<label class="control-label" for="id_number_id">{% trans "Number of IDs" %}</label>
167
		<div class="controls">
168
			{{ form.number_id }}
169
			{% if form.number_id.errors %} <span class="help-inline"> {{ form.number_id.errors|join:", " }} </span>
170
			{% endif %} <span class="help-block"> {{ form.number_id.help_text }}</span>
171
		</div>
172
	</div>
173
	<div class="control-group">
174
		<div class="controls">
175
			<button type="submit" id="applybutton" value="Apply" class="btn btn-primary"/>{% trans "Apply" %}</button>
176
		</div>
177
	</div>
178
</form>
179
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
180
<div class="modal-header">
181
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
182
<h3 id="myModalLabel">{% trans "Add User" %}</h3>
183
</div>
184
<div class="modal-body" id="mymodalbody">
185

  
186
</div>
187
<div class="modal-footer">
188
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Close" %}</button>
189
<a class="btn btn-primary" id="adduserSubmit" href="#">{% trans "Save changes" %}</a>
190
</div>
191
</div>
192
{% endblock %}
193

  

Also available in: Unified diff