gutenberg_blocks.js
7 years ago
mce-button.js
7 years ago
tutor-admin.js
7 years ago
tutor-front.js
7 years ago
gutenberg_blocks.js
95 lines
| 1 | var el = wp.element.createElement, |
| 2 | registerBlockType = wp.blocks.registerBlockType, |
| 3 | withSelect = wp.data.withSelect; |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | /** |
| 9 | * Block for student registration |
| 10 | * |
| 11 | */ |
| 12 | registerBlockType( 'tutor-gutenberg/student-registration', { |
| 13 | title: 'Tutor Student Registration', |
| 14 | icon: 'welcome-learn-more', |
| 15 | category: 'tutor', |
| 16 | edit: function( props ) { |
| 17 | var dataHtml; |
| 18 | jQuery.ajax({ |
| 19 | url : ajaxurl, |
| 20 | type : 'POST', |
| 21 | async: false, |
| 22 | data : {shortcode: 'tutor_student_registration_form', action : 'render_block_tutor'}, |
| 23 | success: function (response) { |
| 24 | dataHtml = response.data; |
| 25 | }, |
| 26 | }); |
| 27 | |
| 28 | return el('div', { |
| 29 | dangerouslySetInnerHTML: { |
| 30 | __html: dataHtml |
| 31 | } |
| 32 | }) |
| 33 | }, |
| 34 | |
| 35 | save: function() { |
| 36 | return null; |
| 37 | //return el( 'div', { }, '[tutor_student_registration_form]' ); |
| 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_student_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 | //tutor_instructor_registration_form |
| 69 | |
| 70 | registerBlockType( 'tutor-gutenberg/instructor-registration', { |
| 71 | title: 'Instructor Registration Form', |
| 72 | icon: 'welcome-learn-more', |
| 73 | category: 'tutor', |
| 74 | edit: function( props ) { |
| 75 | var dataHtml; |
| 76 | jQuery.ajax({ |
| 77 | url : ajaxurl, |
| 78 | type : 'POST', |
| 79 | async: false, |
| 80 | data : {shortcode: 'tutor_instructor_registration_form', action : 'render_block_tutor'}, |
| 81 | success: function (response) { |
| 82 | dataHtml = response.data; |
| 83 | }, |
| 84 | }); |
| 85 | return el('div', { |
| 86 | dangerouslySetInnerHTML: { |
| 87 | __html: dataHtml |
| 88 | } |
| 89 | }) |
| 90 | }, |
| 91 | save: function() { |
| 92 | return null; |
| 93 | }, |
| 94 | } ); |
| 95 |