Mercurial > hg > soundsoftware-site
comparison public/javascripts/application.js @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 051f544170fe |
children | 753f1380d6bc 0c939c159af4 |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
36 tr.toggleClassName('open'); | 36 tr.toggleClassName('open'); |
37 while (n != undefined && !n.hasClassName('group')) { | 37 while (n != undefined && !n.hasClassName('group')) { |
38 Element.toggle(n); | 38 Element.toggle(n); |
39 n = Element.next(n); | 39 n = Element.next(n); |
40 } | 40 } |
41 } | |
42 | |
43 function collapseAllRowGroups(el) { | |
44 var tbody = Element.up(el, 'tbody'); | |
45 tbody.childElements('tr').each(function(tr) { | |
46 if (tr.hasClassName('group')) { | |
47 tr.removeClassName('open'); | |
48 } else { | |
49 tr.hide(); | |
50 } | |
51 }) | |
52 } | |
53 | |
54 function expandAllRowGroups(el) { | |
55 var tbody = Element.up(el, 'tbody'); | |
56 tbody.childElements('tr').each(function(tr) { | |
57 if (tr.hasClassName('group')) { | |
58 tr.addClassName('open'); | |
59 } else { | |
60 tr.show(); | |
61 } | |
62 }) | |
63 } | |
64 | |
65 function toggleAllRowGroups(el) { | |
66 var tr = Element.up(el, 'tr'); | |
67 if (tr.hasClassName('open')) { | |
68 collapseAllRowGroups(el); | |
69 } else { | |
70 expandAllRowGroups(el); | |
71 } | |
41 } | 72 } |
42 | 73 |
43 function toggleFieldset(el) { | 74 function toggleFieldset(el) { |
44 var fieldset = Element.up(el, 'fieldset'); | 75 var fieldset = Element.up(el, 'fieldset'); |
45 fieldset.toggleClassName('collapsed'); | 76 fieldset.toggleClassName('collapsed'); |
297 submitAction: function(element){ | 328 submitAction: function(element){ |
298 element.observe('submit',this.setUnchanged.bindAsEventListener(this)); | 329 element.observe('submit',this.setUnchanged.bindAsEventListener(this)); |
299 } | 330 } |
300 }); | 331 }); |
301 | 332 |
302 /* shows and hides ajax indicator */ | 333 /* |
334 * 1 - registers a callback which copies the csrf token into the | |
335 * X-CSRF-Token header with each ajax request. Necessary to | |
336 * work with rails applications which have fixed | |
337 * CVE-2011-0447 | |
338 * 2 - shows and hides ajax indicator | |
339 */ | |
303 Ajax.Responders.register({ | 340 Ajax.Responders.register({ |
304 onCreate: function(){ | 341 onCreate: function(request){ |
342 var csrf_meta_tag = $$('meta[name=csrf-token]')[0]; | |
343 | |
344 if (csrf_meta_tag) { | |
345 var header = 'X-CSRF-Token', | |
346 token = csrf_meta_tag.readAttribute('content'); | |
347 | |
348 if (!request.options.requestHeaders) { | |
349 request.options.requestHeaders = {}; | |
350 } | |
351 request.options.requestHeaders[header] = token; | |
352 } | |
353 | |
305 if ($('ajax-indicator') && Ajax.activeRequestCount > 0) { | 354 if ($('ajax-indicator') && Ajax.activeRequestCount > 0) { |
306 Element.show('ajax-indicator'); | 355 Element.show('ajax-indicator'); |
307 } | 356 } |
308 }, | 357 }, |
309 onComplete: function(){ | 358 onComplete: function(){ |