Merge lp:~robbyoconnor/sahana-eden/sahana-eden-trunk into lp:sahana-eden
- sahana-eden-trunk
- Merge into trunk
Proposed by
Robert O'Connor
Status: | Merged |
---|---|
Merged at revision: | 1610 |
Proposed branch: | lp:~robbyoconnor/sahana-eden/sahana-eden-trunk |
Merge into: | lp:sahana-eden |
Diff against target: |
366 lines (+148/-48) 9 files modified
controllers/admin.py (+9/-2) languages/es.py (+14/-0) views/admin/user_create.html (+3/-0) views/admin/user_create_form.html (+35/-0) views/admin/user_list_create.html (+3/-0) views/admin/user_update.html (+2/-1) views/admin/user_update_form.html (+36/-0) views/auth/_register.html (+1/-45) views/auth/validation.js (+45/-0) |
To merge this branch: | bzr merge lp:~robbyoconnor/sahana-eden/sahana-eden-trunk |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Fran Boon | Needs Fixing | ||
Review via email: mp+44625@code.launchpad.net |
Commit message
Make UI between User registration and User CRUD pages more consistent. Thanks Yuri Stuken!
Description of the change
Made the UIs between the user CRUD pages and the user registration page more consistent. Thanks Yuri Stuken!!
To post a comment you must log in.
- 1584. By Robert O'Connor
-
back out the impact type change until the User UI update code is merged
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'controllers/admin.py' |
2 | --- controllers/admin.py 2010-12-15 00:36:11 +0000 |
3 | +++ controllers/admin.py 2010-12-23 21:23:11 +0000 |
4 | @@ -266,6 +266,8 @@ |
5 | |
6 | # In Controller to allow registration to work with UUIDs - only manual edits need this setting |
7 | db.auth_user.registration_key.requires = IS_NULL_OR(IS_IN_SET(["disabled", "pending"])) |
8 | + |
9 | + db.auth_user.language.default = "en" |
10 | |
11 | # Pre-processor |
12 | def user_prep(jr): |
13 | @@ -288,10 +290,15 @@ |
14 | s3xrc.model.configure(table, |
15 | main="first_name", |
16 | # Add users to Person Registry & 'Authenticated' role: |
17 | - create_onaccept = lambda form: auth.shn_register(form)) |
18 | - |
19 | + create_onaccept = lambda form: auth.shn_register(form), |
20 | + create_onvalidation = lambda form: user_create_onvalidation(form)) |
21 | return s3_rest_controller(module, resource) |
22 | |
23 | +def user_create_onvalidation (form): |
24 | + if (form.request_vars.has_key("password_two") and \ |
25 | + form.request_vars.password != form.request_vars.password_two): |
26 | + form.errors.password = T("Password fields don't match") |
27 | + return True |
28 | |
29 | def user_approve(form): |
30 | "Send an email to user if their account is approved (moved from 'pending' to 'blank'(i.e. enabled))" |
31 | |
32 | === modified file 'languages/es.py' |
33 | --- languages/es.py 2010-12-21 22:27:34 +0000 |
34 | +++ languages/es.py 2010-12-23 21:23:11 +0000 |
35 | @@ -420,6 +420,7 @@ |
36 | 'Adult female': 'Adult female', |
37 | 'Adult male': 'Adult male', |
38 | 'Adults in prisons': 'Adults in prisons', |
39 | +'Advanced': 'Advanced', |
40 | 'Advanced Bin Search': 'Búsqueda Avanzada de Repositorio', |
41 | 'Advanced Catalog Search': 'Búsqueda Avanzada de Catálogo', |
42 | 'Advanced Category Search': 'Búsqueda Avanzada de Categoría', |
43 | @@ -711,6 +712,7 @@ |
44 | "Can't import tweepy": "Can't import tweepy", |
45 | 'Canada': 'Canadá', |
46 | 'Cancel': 'Cancel', |
47 | +'Cancel Add': 'Cancel Add', |
48 | 'Cancelled': 'Cancelled', |
49 | 'Candidate Matches for Body %s': 'Candidate Matches for Body %s', |
50 | 'Canned Fish': 'Canned Fish', |
51 | @@ -1203,6 +1205,7 @@ |
52 | 'Donors Report': 'Donors Report', |
53 | 'Door frame': 'Door frame', |
54 | 'Draft': 'Draft', |
55 | +'Draft Features': 'Draft Features', |
56 | 'Drainage': 'Drainage', |
57 | 'Drawing up a Budget for Staff & Equipment across various Locations.': 'La elaboración de un presupuesto para el personal y equipo a través de varios lugares.', |
58 | 'Drill Down by Group': 'Drill Down por el Grupo', |
59 | @@ -1413,8 +1416,10 @@ |
60 | 'End date should be after start date': 'End date should be after start date', |
61 | 'End of Period': 'End de Period', |
62 | 'English': 'Inglés', |
63 | +'Enter Coordinates': 'Enter Coordinates', |
64 | 'Enter Coordinates:': 'Enter Coordinates:', |
65 | 'Enter a GPS Coord': 'Enter a GPS Coord', |
66 | +'Enter a GPS Coordinate': 'Enter a GPS Coordinate', |
67 | 'Enter a date before': 'Introduzca una fecha antes de', |
68 | 'Enter a name for the spreadsheet you are uploading (mandatory).': 'Enter a name for the spreadsheet you are uploading (mandatory).', |
69 | 'Enter a new support request.': 'Introduzca una nueva solicitud de soporte.', |
70 | @@ -2294,6 +2299,7 @@ |
71 | 'Load Details': 'Load Detalles', |
72 | 'Load Raw File into Grid': 'Load Raw File into Grid', |
73 | 'Load the details to help decide which is the best one to keep out of the 2.': 'Load the details to help decide which is the best one to keep out of the 2.', |
74 | +'Loading Locations': 'Loading Locations', |
75 | 'Loading Locations...': 'Loading Locations...', |
76 | 'Local Name': 'Local Name', |
77 | 'Local Names': 'Local Names', |
78 | @@ -2456,6 +2462,7 @@ |
79 | 'Military': 'Militar', |
80 | 'Minorities participating in coping activities': 'Minorities participating in coping activities', |
81 | 'Minutes must be a number between 0 and 60': 'Minutes must be a number between 0 and 60', |
82 | +'Minutes must be a number greater than 0 and less than 60': 'Minutes must be a number greater than 0 and less than 60', |
83 | 'Minutes must be between 0 and 60': 'Minutos must be between 0 and 60', |
84 | 'Minutes per Month': 'Minutos por Mes', |
85 | 'Minutes should be a number greater than 0 and less than 60': 'Minutes should be a number greater than 0 and less than 60', |
86 | @@ -2738,6 +2745,7 @@ |
87 | 'No access at all': 'No access at all', |
88 | 'No access to this record!': 'No hay acceso a este registro!', |
89 | 'No action recommended': 'No action recommended', |
90 | +'No calculations made': 'No calculations made', |
91 | 'No conflicts logged': 'No conflicts logged', |
92 | 'No contact information available': 'No contact information available', |
93 | 'No contacts currently registered': 'Aún no hay miembros registrados actualmente', |
94 | @@ -3628,6 +3636,7 @@ |
95 | 'Searching for different groups and individuals': 'La búsqueda de los diferentes grupos e individuos', |
96 | 'Secondary Server (Optional)': 'Secondary Server (Optional)', |
97 | 'Seconds must be a number between 0 and 60': 'Seconds must be a number between 0 and 60', |
98 | +'Seconds must be a number greater than 0 and less than 60': 'Seconds must be a number greater than 0 and less than 60', |
99 | 'Seconds must be between 0 and 60': 'Seconds must be between 0 and 60', |
100 | 'Section Details': 'Section Detalles', |
101 | 'Section deleted': 'Section eliminada', |
102 | @@ -3749,6 +3758,7 @@ |
103 | 'Short Description': 'Short Description', |
104 | 'Short Description: ': 'Short Description: ', |
105 | 'Show Checklist': 'Lista de verificación Mostrar', |
106 | +'Show Map': 'Show Map', |
107 | 'Show on map': 'Mostrar en el mapa', |
108 | 'Sierra Leone': 'Sierra Leona', |
109 | 'Sindhi': 'Sindhi', |
110 | @@ -3836,6 +3846,7 @@ |
111 | 'Special Marine': 'Special Marine', |
112 | 'Special needs': 'Necesidades especiales', |
113 | 'Specialized Hospital': 'Hospital Especializado', |
114 | +'Specific Location': 'Specific Location', |
115 | 'Specific locations need to have a parent of level': 'Specific locations need to have a parent of level', |
116 | 'Specify a descriptive title for the image.': 'Specify a descriptive title for the image.', |
117 | 'Specify the bed type of this unit.': 'Specify the bed type de this unit.', |
118 | @@ -4091,6 +4102,7 @@ |
119 | 'The URL of your web gateway without the post parameters': 'The URL of your web gateway without the post parameters', |
120 | 'The URL to access the service.': 'The URL to access the service.', |
121 | 'The Unique Identifier (UUID) as assigned to this facility by the government.': 'The Unique Identifier (UUID) as assigned to this facility by the government.', |
122 | +'The area is ': 'The area is ', |
123 | 'The area was ': 'El área fue', |
124 | 'The attribute within the KML which is used for the title of popups.': 'The attribute within the KML which is used for the title of popups.', |
125 | 'The attribute(s) within the KML which are used for the body of popups. (Use a space between attributes)': 'The attribute(s) within the KML which are used for the body of popups. (Use a space between attributes)', |
126 | @@ -4109,6 +4121,7 @@ |
127 | 'The language to use for notifications.': 'The language to use for notifications.', |
128 | 'The last known location of the missing person before disappearance.': 'The last known location of the missing person before disappearance.', |
129 | 'The last known location of the missing person.': 'The last known location of the missing person.', |
130 | +'The length is ': 'The length is ', |
131 | 'The length was ': 'La longitud se', |
132 | 'The list of Item categories are maintained by the Administrators.': 'The list of Item categories are maintained by the Administrators.', |
133 | 'The name to be used when calling for or directly addressing the person (optional).': 'The name to be used when calling for or directly addressing the person (optional).', |
134 | @@ -4566,6 +4579,7 @@ |
135 | 'Zoom In: click in the map or use the left mouse button and drag to create a rectangle': 'Acercar: haga clic en el mapa o utiliza el botón izquierdo del ratón y arrastre para crear un rectángulo', |
136 | 'Zoom Levels': 'Los niveles de zoom', |
137 | 'Zoom Out: click in the map or use the left mouse button and drag to create a rectangle': 'Alejar: haga clic en el mapa o utiliza el botón izquierdo del ratón y arrastre para crear un rectángulo', |
138 | +'Zoom to Current Location': 'Zoom to Current Location', |
139 | 'Zoom to maximum map extent': 'Zoom para asignar la máxima medida', |
140 | 'accepted': 'aceptado', |
141 | 'act': 'acto', |
142 | |
143 | === added file 'views/admin/user_create.html' |
144 | --- views/admin/user_create.html 1970-01-01 00:00:00 +0000 |
145 | +++ views/admin/user_create.html 2010-12-23 21:23:11 +0000 |
146 | @@ -0,0 +1,3 @@ |
147 | +{{extend 'layout.html'}} |
148 | +{{include 'admin/user_create_form.html'}} |
149 | +{{include '_create.html'}} |
150 | \ No newline at end of file |
151 | |
152 | === added file 'views/admin/user_create_form.html' |
153 | --- views/admin/user_create_form.html 1970-01-01 00:00:00 +0000 |
154 | +++ views/admin/user_create_form.html 2010-12-23 21:23:11 +0000 |
155 | @@ -0,0 +1,35 @@ |
156 | +{{form.attributes['_id'] = "regform"}} |
157 | +{{form[0].insert(-8, TR( |
158 | + TD( |
159 | + LABEL(T("Mobile Phone") + ":") |
160 | + , _class="w2p_fl"), |
161 | + TD() |
162 | +))}} |
163 | +{{form[0].insert(-8, TR( |
164 | + TD( |
165 | + INPUT(_name="mobile", _id="mobile", _class="string") |
166 | + , _class="w2p_fw"), |
167 | + TD(_class="w2p_fc") |
168 | +))}} |
169 | +{{form[0].insert(-4, TR( |
170 | + TD( |
171 | + LABEL(T("Verify password") + ":") |
172 | + , _class="w2p_fl"), |
173 | + TD() |
174 | +))}} |
175 | +{{form[0].insert(-4, TR( |
176 | + TD( |
177 | + INPUT(_name="password_two", _id="password_two", _type="password") |
178 | + , _class="w2p_fw"), |
179 | + TD(_class="w2p_fc") |
180 | +))}} |
181 | +<script src="/{{=request.application}}/static/scripts/S3/jquery.validate.pack.js" type="text/javascript"></script> |
182 | +<script type="text/javascript"> |
183 | +{{include "auth/validation.js"}} |
184 | +</script> |
185 | +<script src="/{{=request.application}}/static/scripts/S3/jquery.pstrength-min.1.2.js" type="text/javascript"></script> |
186 | +<script type="text/javascript"> |
187 | + $(function() { |
188 | + $('.password:last').pstrength(); |
189 | + }); |
190 | +</script> |
191 | \ No newline at end of file |
192 | |
193 | === added file 'views/admin/user_list_create.html' |
194 | --- views/admin/user_list_create.html 1970-01-01 00:00:00 +0000 |
195 | +++ views/admin/user_list_create.html 2010-12-23 21:23:11 +0000 |
196 | @@ -0,0 +1,3 @@ |
197 | +{{extend 'layout.html'}} |
198 | +{{include 'admin/user_create_form.html'}} |
199 | +{{include '_list_create.html'}} |
200 | \ No newline at end of file |
201 | |
202 | === modified file 'views/admin/user_update.html' |
203 | --- views/admin/user_update.html 2010-06-04 23:50:19 +0000 |
204 | +++ views/admin/user_update.html 2010-12-23 21:23:11 +0000 |
205 | @@ -1,4 +1,5 @@ |
206 | {{extend "layout.html"}} |
207 | +{{include 'admin/user_create_form.html'}} |
208 | {{include "_update.html"}} |
209 | <p> </p> |
210 | {{try:}} |
211 | @@ -6,4 +7,4 @@ |
212 | {{except ValueError:}} |
213 | {{id = int(request.args(1))}} |
214 | {{pass}} |
215 | -<a class="action-btn" href="{{=URL(r=request, f="groups", args=id)}}">{{=T("Roles")}}</a> |
216 | +<a class="action-btn" href="{{=URL(r=request, f="groups", args=id)}}">{{=T("Roles")}}</a> |
217 | \ No newline at end of file |
218 | |
219 | === added file 'views/admin/user_update_form.html' |
220 | --- views/admin/user_update_form.html 1970-01-01 00:00:00 +0000 |
221 | +++ views/admin/user_update_form.html 2010-12-23 21:23:11 +0000 |
222 | @@ -0,0 +1,36 @@ |
223 | +{{form.attributes['_id'] = "regform"}} |
224 | +{{form[0].insert(-8, TR( |
225 | + TD( |
226 | + LABEL(T("Mobile Phone") + ":") |
227 | + , _class="w2p_fl"), |
228 | + TD() |
229 | +))}} |
230 | +{{form[0].insert(-8, TR( |
231 | + TD( |
232 | + INPUT(_name="mobile", _id="mobile", _class="string") |
233 | + , _class="w2p_fw"), |
234 | + TD(_class="w2p_fc") |
235 | +))}} |
236 | +{{form[0].insert(-4, TR( |
237 | + TD( |
238 | + LABEL(T("Verify password") + ":") |
239 | + , _class="w2p_fl"), |
240 | + TD() |
241 | +))}} |
242 | +{{form[0].insert(-4, TR( |
243 | + TD( |
244 | + INPUT(_name="password_two", _id="password_two", _type="password") |
245 | + , _class="w2p_fw"), |
246 | + TD(_class="w2p_fc") |
247 | +))}} |
248 | +<script src="/{{=request.application}}/static/scripts/S3/jquery.validate.pack.js" type="text/javascript"></script> |
249 | +<script type="text/javascript"> |
250 | +{{include "auth/validation.js"}} |
251 | +</script> |
252 | +<script src="/{{=request.application}}/static/scripts/S3/jquery.pstrength-min.1.2.js" type="text/javascript"></script> |
253 | +<script type="text/javascript"> |
254 | + $(function() { |
255 | + $('.password:last').pstrength(); |
256 | + }); |
257 | + $("#") |
258 | +</script> |
259 | |
260 | === modified file 'views/auth/_register.html' |
261 | --- views/auth/_register.html 2010-10-26 09:31:42 +0000 |
262 | +++ views/auth/_register.html 2010-12-23 21:23:11 +0000 |
263 | @@ -8,51 +8,7 @@ |
264 | $(function() { |
265 | $('.password:last').pstrength(); |
266 | }); |
267 | -// Client-side validation (needed to check for passwords being same) |
268 | -$(document).ready(function() { |
269 | - // validate signup form on keyup and submit |
270 | - //HACK |
271 | - var validator = $('#regform').validate({ |
272 | - errorClass: 'req', |
273 | - rules: { |
274 | - first_name: { |
275 | - required: true |
276 | - }, |
277 | - email: { |
278 | - required: true, |
279 | - email: true |
280 | - //remote: 'emailsurl' // TODO |
281 | - }, |
282 | - password: { |
283 | - required: true |
284 | - }, |
285 | - password_two: { |
286 | - required: true, |
287 | - equalTo: '.password:last' |
288 | - } |
289 | - }, |
290 | - messages: { |
291 | - firstname: ' {{=T("Enter your firstname")}}', |
292 | - password: { |
293 | - required: ' {{=T("Provide a password")}}' |
294 | - }, |
295 | - password_two: { |
296 | - required: ' {{=T("Repeat your password")}}', |
297 | - equalTo: ' {{=T("Enter the same password as above")}}' |
298 | - }, |
299 | - email: { |
300 | - required: ' {{=T("Please enter a valid email address")}}', |
301 | - minlength: ' {{=T("Please enter a valid email address")}}' |
302 | - } |
303 | - }, |
304 | - errorPlacement: function(error, element) { |
305 | - error.appendTo( element.parent().next() ); |
306 | - }, |
307 | - submitHandler: function(form) { |
308 | - form.submit(); |
309 | - } |
310 | - }); |
311 | -}); |
312 | +{{include "auth/validation.js"}} |
313 | </script> |
314 | |
315 | {{if self_registration:}} |
316 | |
317 | === added file 'views/auth/validation.js' |
318 | --- views/auth/validation.js 1970-01-01 00:00:00 +0000 |
319 | +++ views/auth/validation.js 2010-12-23 21:23:11 +0000 |
320 | @@ -0,0 +1,45 @@ |
321 | +// Client-side validation (needed to check for passwords being same) |
322 | +$(document).ready(function() { |
323 | + // validate signup form on keyup and submit |
324 | + //HACK |
325 | + var validator = $('#regform').validate({ |
326 | + errorClass: 'req', |
327 | + rules: { |
328 | + first_name: { |
329 | + required: true |
330 | + }, |
331 | + email: { |
332 | + required: true, |
333 | + email: true |
334 | + //remote: 'emailsurl' // TODO |
335 | + }, |
336 | + password: { |
337 | + required: true |
338 | + }, |
339 | + password_two: { |
340 | + required: true, |
341 | + equalTo: '.password:last' |
342 | + } |
343 | + }, |
344 | + messages: { |
345 | + firstname: ' {{=T("Enter your firstname")}}', |
346 | + password: { |
347 | + required: ' {{=T("Provide a password")}}' |
348 | + }, |
349 | + password_two: { |
350 | + required: ' {{=T("Repeat your password")}}', |
351 | + equalTo: ' {{=T("Enter the same password as above")}}' |
352 | + }, |
353 | + email: { |
354 | + required: ' {{=T("Please enter a valid email address")}}', |
355 | + minlength: ' {{=T("Please enter a valid email address")}}' |
356 | + } |
357 | + }, |
358 | + errorPlacement: function(error, element) { |
359 | + error.appendTo( element.parent().next() ); |
360 | + }, |
361 | + submitHandler: function(form) { |
362 | + form.submit(); |
363 | + } |
364 | + }); |
365 | +}); |
366 | \ No newline at end of file |
Some good stuff here.
Main issue is in the Update form:
Admin has to reset the password if making any other changes which is bad.
I fixed this & did a little refactoring including having the default language be pulled from the existing deployment_setting (which I can see hadn't been done before!)
Worth takign a look at my mods to see if helpful :)
Many thanks!
F