PluginProbe
GetResponse Forms by Optin Cat / trunk
GetResponse Forms by Optin Cat vtrunk
1.3.4 1.3.5 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 2.0.0 All 36 releases
getresponse / assets / admin / block.js

block.js in GetResponse Forms by Optin Cat trunk, at assets/admin/block.js

141 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 ( function( blocks, editor, element ) {
3
4 var el = element.createElement
5
6 var optins = fca_eoi_gutenblock_script_data.optins
7 var twostep_optins = fca_eoi_gutenblock_script_data.twostep_optins
8
9 blocks.registerBlockType( 'optin-cat/gutenblock', {
10 title: 'Optin Cat Form',
11 icon: 'email',
12 category: 'widgets',
13 keywords: ['email', 'optin', 'form' ],
14 edit: function( props ) {
15 return [
16 el(
17 wp.blockEditor.InspectorControls,
18 {
19 key: 'eoi-controls'
20 },
21 el( wp.components.PanelBody, { },
22 el( wp.components.SelectControl,
23 {
24
25 label: 'Select an Optin',
26 value: props.attributes.post_id,
27 options: optins,
28 onChange: function( newValue ){ props.setAttributes({ post_id: newValue }) }
29 }
30 )
31 ),
32 el( wp.components.PanelBody, { },
33 el( wp.components.ButtonGroup, {},
34 props.attributes.post_id == 0 ? '' :
35 el(
36 wp.components.Button,
37 {
38 href: fca_eoi_gutenblock_script_data.editurl + '?post=' + props.attributes.post_id + '&action=edit',
39 target: '_blank',
40 variant: "secondary",
41 style: {
42 margin: '0 6px 0 0'
43 }
44 },
45 'Edit Optin'
46 ),
47 el(
48 wp.components.Button,
49 {
50 href: fca_eoi_gutenblock_script_data.newurl,
51 target: '_blank',
52 variant: "primary"
53
54 },
55 'New Optin'
56 )
57 )
58 )
59 ),
60 el( wp.serverSideRender, {
61 block: 'optin-cat/gutenblock',
62 attributes: props.attributes,
63 })
64 ]
65 },
66
67 save: function( props ) {
68 return null
69 },
70 } )
71
72
73
74 blocks.registerBlockType( 'optin-cat/gutenblock-twostep', {
75 title: 'Optin Cat Two-Step Optin',
76 icon: 'email',
77 category: 'widgets',
78 keywords: ['email', 'optin', 'form' ],
79 edit: function( props ) {
80 return [
81 el(
82 wp.blockEditor.InspectorControls,
83 {
84 key: 'eoi-controls-2'
85 },
86 el( wp.components.PanelBody, { },
87 el( wp.components.SelectControl,
88 {
89
90 label: 'Select an Optin',
91 value: props.attributes.post_id,
92 options: twostep_optins,
93 onChange: function( newValue ){ props.setAttributes({ post_id: newValue }) }
94 }
95 )
96 ),
97 el( wp.components.PanelBody, { },
98 el( wp.components.ButtonGroup, {},
99 props.attributes.post_id == 0 ? '' :
100 el(
101 wp.components.Button,
102 {
103 href: fca_eoi_gutenblock_script_data.editurl + '?post=' + props.attributes.post_id + '&action=edit',
104 target: '_blank',
105 variant: "secondary",
106 style: {
107 margin: '0 6px 0 0'
108 }
109 },
110 'Edit Optin'
111 ),
112 el(
113 wp.components.Button,
114 {
115 href: fca_eoi_gutenblock_script_data.newurl,
116 target: '_blank',
117 variant: "primary"
118
119 },
120 'New Optin'
121 )
122 )
123 )
124 ),
125 el( wp.serverSideRender, {
126 block: 'optin-cat/gutenblock-twostep',
127 attributes: props.attributes,
128 })
129 ]
130 },
131
132 save: function( props ) {
133 return null
134 },
135 } )
136
137 }(
138 window.wp.blocks,
139 window.wp.editor,
140 window.wp.element
141 ))