From e2e7765600a0da1fad808e1cd9fad9d85345c624 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Thu, 30 Mar 2023 14:10:31 +0300 Subject: [PATCH] - remove wrong code --- .../assets/js/um-admin-blocks-shortcode.js | 128 ------------------ includes/blocks/um-forms/src/index.js | 14 -- 2 files changed, 142 deletions(-) delete mode 100644 includes/admin/assets/js/um-admin-blocks-shortcode.js diff --git a/includes/admin/assets/js/um-admin-blocks-shortcode.js b/includes/admin/assets/js/um-admin-blocks-shortcode.js deleted file mode 100644 index 08b90fc4..00000000 --- a/includes/admin/assets/js/um-admin-blocks-shortcode.js +++ /dev/null @@ -1,128 +0,0 @@ -//-------------------------------------\\ -//--------- Um Forms shortcode --------\\ -//-------------------------------------\\ - -wp.blocks.registerBlockType( 'um-block/um-forms', { - title: wp.i18n.__( 'Form', 'ultimate-member' ), - description: wp.i18n.__( 'Choose display form', 'ultimate-member' ), - icon: 'forms', - category: 'um-blocks', - attributes: { - content: { - source: 'html', - selector: 'p' - }, - form_id: { - type: 'select' - } - }, - - edit: wp.data.withSelect( function( select ) { - return { - posts: select( 'core' ).getEntityRecords( 'postType', 'um_form', { - per_page: -1 - }) - }; - } )( function( props ) { - var posts = props.posts, - className = props.className, - attributes = props.attributes, - setAttributes = props.setAttributes, - form_id = props.attributes.form_id, - content = props.attributes.content; - - function get_option( posts ) { - - var option = []; - - posts.map( function( post ) { - option.push( - { - label: post.title.rendered, - value: post.id - } - ); - }); - - return option; - } - - function umShortcode( value ) { - - var shortcode = ''; - - if ( value !== undefined ) { - shortcode = '[ultimatemember form_id="' + value + '"]'; - } - - return shortcode; - } - - - if ( ! posts ) { - return wp.element.createElement( - 'p', - { - className: className - }, - wp.element.createElement( - wp.components.Spinner, - null - ), - wp.i18n.__( 'Loading Forms', 'ultimate-member' ) - ); - } - - if ( 0 === posts.length ) { - return wp.element.createElement( - 'p', - null, - wp.i18n.__( 'No Posts', 'ultimate-member' ) - ); - } - - if ( form_id === undefined ) { - props.setAttributes({ form_id: posts[0]['id'] }); - var shortcode = umShortcode( posts[0]['id'] ); - props.setAttributes( { content: shortcode } ); - } - - var get_post = get_option( posts ); - - return wp.element.createElement( - 'div', - { - className: className - }, - wp.element.createElement( - wp.components.SelectControl, - { - label: wp.i18n.__( 'Select Forms', 'ultimate-member' ), - className: 'um_select_forms', - type: 'number', - value: form_id, - options: get_post, - onChange: function onChange( value ) { - props.setAttributes({ form_id: value }); - var shortcode = umShortcode( value ); - props.setAttributes( { content: shortcode } ); - } - } - ) - ); - } // end withSelect - ), // end edit - - save: function save( props ) { - - return wp.element.createElement( - wp.editor.RichText.Content, - { - tagName: 'p', - className: props.className, - value: props.attributes.content - } - ); - } - -}); diff --git a/includes/blocks/um-forms/src/index.js b/includes/blocks/um-forms/src/index.js index 227d98ea..27cc2418 100644 --- a/includes/blocks/um-forms/src/index.js +++ b/includes/blocks/um-forms/src/index.js @@ -89,17 +89,3 @@ registerBlockType('um-block/um-forms', { return null; } }); - -// jQuery(window).on( 'load', function($) { -// var observer = new MutationObserver(function(mutations) { -// mutations.forEach(function(mutation) { -// -// jQuery(mutation.addedNodes).find('.um.um-directory').each(function() { -// var directory = jQuery(this); -// um_ajax_get_members( directory ); -// }); -// }); -// }); -// -// observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true}); -// });