Browse code

Rewrite ajax functionality for Contao 4 compatibility

Benjamin Roth authored on22/03/2019 20:54:43
Showing1 changed files
... ...
@@ -5,12 +5,12 @@ $GLOBALS['TL_CSS'][] = 'system/modules/legalAgeCheck/assets/css/vex-theme-defaul
5 5
 <script src="system/modules/legalAgeCheck/assets/js/vex.combined.min.js"></script>
6 6
 <script>
7 7
 
8
-	var comPromo = vex.dialog.open({
8
+	var legalAgeCheck = vex.dialog.open({
9 9
 		unsafeMessage: '<h1 class="vex-header"><?php echo $this->title; ?></h1>' +
10 10
 		'<?php echo $this->text; ?>',
11 11
 		overlayClosesOnClick: false,
12 12
 		escapeButtonCloses: false,
13
-		buttons: [{text: '<?php echo $this->btn_over_18; ?>',type: 'button',className: 'vex-dialog-button-primary',click: function(vexContent, event) {
13
+		buttons: [{text: '<?php echo $this->btn_over_18; ?>',type: 'button',className: 'vex-dialog-button-primary',click: function(event) {
14 14
 			$.ajax({
15 15
 				url: '<?php echo $this->commitURL; ?>',
16 16
 				type: 'GET',
... ...
@@ -18,11 +18,11 @@ $GLOBALS['TL_CSS'][] = 'system/modules/legalAgeCheck/assets/css/vex-theme-defaul
18 18
 				success: function (data) {
19 19
 					if (data.status == 'OK')
20 20
 					{
21
-						return vex.close(vexContent.data().vex.id);
21
+            return vex.close(legalAgeCheck);
22 22
 					}
23 23
 				}
24 24
 			});
25
-		}}, {text: '<?php echo $this->btn_under_18; ?>',type: 'button',className: 'vex-dialog-button-secondary',click: function(vexContent, event) { window.location = '<?php echo $this->exitPageURL; ?>'}}]
25
+		}}, {text: '<?php echo $this->btn_under_18; ?>',type: 'button',className: 'vex-dialog-button-secondary',click: function(event) { window.location = '<?php echo $this->exitPageURL; ?>'}}]
26 26
 	});
27 27
 
28 28
 
Browse code

Add customization fields for the displayed text.

Benjamin Roth authored on22/03/2019 16:56:28
Showing1 changed files
... ...
@@ -6,7 +6,7 @@ $GLOBALS['TL_CSS'][] = 'system/modules/legalAgeCheck/assets/css/vex-theme-defaul
6 6
 <script>
7 7
 
8 8
 	var comPromo = vex.dialog.open({
9
-		message: '<h1 class="vex-header"><?php echo $this->title; ?></h1>' +
9
+		unsafeMessage: '<h1 class="vex-header"><?php echo $this->title; ?></h1>' +
10 10
 		'<?php echo $this->text; ?>',
11 11
 		overlayClosesOnClick: false,
12 12
 		escapeButtonCloses: false,
Browse code

Include Vex dialog

Benjamin Roth authored on21/03/2019 09:54:50
Showing1 changed files
... ...
@@ -1,3 +1,8 @@
1
+<?php
2
+$GLOBALS['TL_CSS'][] = 'system/modules/legalAgeCheck/assets/css/vex.css';
3
+$GLOBALS['TL_CSS'][] = 'system/modules/legalAgeCheck/assets/css/vex-theme-default.css';
4
+?>
5
+<script src="system/modules/legalAgeCheck/assets/js/vex.combined.min.js"></script>
1 6
 <script>
2 7
 
3 8
 	var comPromo = vex.dialog.open({
Browse code

Initial commit

Benjamin Roth authored on21/03/2019 09:05:45
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,24 @@
1
+<script>
2
+
3
+	var comPromo = vex.dialog.open({
4
+		message: '<h1 class="vex-header"><?php echo $this->title; ?></h1>' +
5
+		'<?php echo $this->text; ?>',
6
+		overlayClosesOnClick: false,
7
+		escapeButtonCloses: false,
8
+		buttons: [{text: '<?php echo $this->btn_over_18; ?>',type: 'button',className: 'vex-dialog-button-primary',click: function(vexContent, event) {
9
+			$.ajax({
10
+				url: '<?php echo $this->commitURL; ?>',
11
+				type: 'GET',
12
+				dataType: 'json',
13
+				success: function (data) {
14
+					if (data.status == 'OK')
15
+					{
16
+						return vex.close(vexContent.data().vex.id);
17
+					}
18
+				}
19
+			});
20
+		}}, {text: '<?php echo $this->btn_under_18; ?>',type: 'button',className: 'vex-dialog-button-secondary',click: function(vexContent, event) { window.location = '<?php echo $this->exitPageURL; ?>'}}]
21
+	});
22
+
23
+
24
+</script>
0 25
\ No newline at end of file