aboutsummaryrefslogtreecommitdiff
path: root/views/default/js/walled_garden.php
blob: e761e58697d72c610ec932db8cc5ee9792312985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
 * Walled garden JavaScript
 *
 * @todo update for new JS lib
 */

$cancel_button = elgg_view('input/button', array(
	'value' => elgg_echo('cancel'),
	'class' => 'elgg-button-cancel mlm',
));
$cancel_button = trim($cancel_button);

?>

$(document).ready(function() {

	$('.forgot_link').click(function(event) {
		$.get('walled_garden/lost_password', function(data) {
			$('.elgg-walledgarden-double').fadeToggle();
			$('.elgg-body-walledgarden').append(data);
			$(".elgg-form-user-requestnewpassword").find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
			$('.elgg-walledgarden-single').fadeToggle();
		});
		event.preventDefault();
	});

	$('.registration_link').click(function(event) {
		$.get('walled_garden/register', function(data) {
			$('.elgg-walledgarden-double').fadeToggle();
			$('.elgg-body-walledgarden').append(data);
			$('.elgg-form-register').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
			$('.elgg-walledgarden-single').fadeToggle();
		});
		event.preventDefault();
	});

	$('input.elgg-button-cancel').live('click', function(event) {
		if ($('.elgg-walledgarden-single').is(':visible')) {
			$('.elgg-walledgarden-double').fadeToggle();
			$('.elgg-walledgarden-single').fadeToggle();
			$('.elgg-walledgarden-single').remove();
		}
		event.preventDefault();
	});
});