gutenberg_blocks.js
96 lines
| 1 | var el = wp.element.createElement, |
| 2 | registerBlockType = wp.blocks.registerBlockType, |
| 3 | withSelect = wp.data.withSelect; |
| 4 | |
| 5 | /** |
| 6 | * Block for student registration |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | |
| 11 | registerBlockType('tutor-gutenberg/student-registration', { |
| 12 | title: 'Student Registration', |
| 13 | icon: 'welcome-learn-more', |
| 14 | category: 'tutor', |
| 15 | edit: function (props) { |
| 16 | var dataHtml; |
| 17 | jQuery.ajax({ |
| 18 | url: ajaxurl, |
| 19 | type: 'POST', |
| 20 | async: false, |
| 21 | data: { shortcode: 'tutor_student_registration_form', action: 'render_block_tutor' }, |
| 22 | success: function (response) { |
| 23 | dataHtml = response.data; |
| 24 | }, |
| 25 | }); |
| 26 | |
| 27 | return el('div', { |
| 28 | dangerouslySetInnerHTML: { |
| 29 | __html: dataHtml |
| 30 | } |
| 31 | }) |
| 32 | }, |
| 33 | |
| 34 | save: function () { |
| 35 | return null; |
| 36 | //return el( 'div', { }, '[tutor_student_registration_form]' ); |
| 37 | }, |
| 38 | }); |
| 39 | |
| 40 | /* |
| 41 | registerBlockType( 'tutor-gutenberg/student-dashboard', { |
| 42 | title: 'Tutor Student Dashboard', |
| 43 | icon: 'welcome-learn-more', |
| 44 | category: 'tutor', |
| 45 | edit: function( props ) { |
| 46 | var dataHtml; |
| 47 | jQuery.ajax({ |
| 48 | url : ajaxurl, |
| 49 | type : 'POST', |
| 50 | async: false, |
| 51 | data : {shortcode: 'tutor_dashboard', action : 'render_block_tutor'}, |
| 52 | success: function (response) { |
| 53 | dataHtml = response.data; |
| 54 | }, |
| 55 | }); |
| 56 | return el('div', { |
| 57 | dangerouslySetInnerHTML: { |
| 58 | __html: dataHtml |
| 59 | } |
| 60 | }) |
| 61 | }, |
| 62 | save: function() { |
| 63 | return null; |
| 64 | }, |
| 65 | } ); |
| 66 | */ |
| 67 | |
| 68 | |
| 69 | //tutor_instructor_registration_form |
| 70 | |
| 71 | registerBlockType('tutor-gutenberg/instructor-registration', { |
| 72 | title: 'Instructor Registration', |
| 73 | icon: 'welcome-learn-more', |
| 74 | category: 'tutor', |
| 75 | edit: function (props) { |
| 76 | var dataHtml; |
| 77 | jQuery.ajax({ |
| 78 | url: ajaxurl, |
| 79 | type: 'POST', |
| 80 | async: false, |
| 81 | data: { shortcode: 'tutor_instructor_registration_form', action: 'render_block_tutor' }, |
| 82 | success: function (response) { |
| 83 | dataHtml = response.data; |
| 84 | }, |
| 85 | }); |
| 86 | return el('div', { |
| 87 | dangerouslySetInnerHTML: { |
| 88 | __html: dataHtml |
| 89 | } |
| 90 | }) |
| 91 | }, |
| 92 | save: function () { |
| 93 | return null; |
| 94 | }, |
| 95 | }); |
| 96 |