From f60c6c5452b49d15410d7b899e1acbdfd53a6e37 Mon Sep 17 00:00:00 2001 From: roshniahuja Date: Fri, 17 Mar 2023 20:43:35 +0530 Subject: [PATCH 01/17] Update pulled content management --- assets/js/gutenberg-plugin.js | 49 +++++++++++++++++++++++++++------ includes/syndicated-post-ui.php | 4 +-- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index dd5255f29..ae6b845a7 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -132,13 +132,44 @@ const RenderDistributedTo = () => { */ const RenderDistributedFrom = () => { return ( - - { sprintf( - /* translators: 1: Syndication date and time. */ - __( 'Distributed on: %1$s', 'distributor' ), - dtGutenberg.syndicationTime - ) } - +
+ + { sprintf( + /* translators: 1: Syndication date and time. */ + __( 'Pulled & linked on %1$s from %2$s', 'distributor' ), + dtGutenberg.syndicationTime, + dtGutenberg.originalLocationName + ) } + +
+ + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Updating the ', 'distributor' ), + ) + } + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Original Content', 'distributor' ), + ) + }, + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'will update this post automatically.', 'distributor' ), + ) + } + +
+ + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Unlink from Original', 'distributor' ), + ) } + +
); }; @@ -186,7 +217,7 @@ const DistributorPlugin = () => { ) { return ( @@ -198,7 +229,7 @@ const DistributorPlugin = () => { return ( diff --git a/includes/syndicated-post-ui.php b/includes/syndicated-post-ui.php index e970abf56..def460d6a 100644 --- a/includes/syndicated-post-ui.php +++ b/includes/syndicated-post-ui.php @@ -89,7 +89,7 @@ function output_distributor_column( $column_name, $post_id ) { if ( $unlinked ) { echo '' . esc_attr__( 'Unlinked', 'distributor' ) . ''; } else { - echo '' . esc_attr__( 'Linked', 'distributor' ) . ''; + echo '' . esc_attr__( 'Linked', 'distributor' ) . ''; } } } @@ -672,7 +672,7 @@ function enqueue_gutenberg_edit_scripts() { 'postTypeSingular' => sanitize_text_field( $post_type_singular ), 'postUrl' => sanitize_text_field( $post_url ), 'originalSiteName' => sanitize_text_field( $original_site_name ), - 'syndicationTime' => ( ! empty( $syndication_time ) ) ? esc_html( gmdate( 'M j, Y @ h:i', ( $syndication_time + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) ) : 0, + 'syndicationTime' => ( ! empty( $syndication_time ) ) ? esc_html( gmdate( 'M j, Y h:i', ( $syndication_time + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) ) : 0, 'syndicationCount' => $total_connections, 'originalLocationName' => sanitize_text_field( $original_location_name ), 'unlinkNonceUrl' => wp_nonce_url( add_query_arg( 'action', 'unlink', admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) ), "unlink-post_{$post->ID}" ), From abbb8cfcd3b7a78fc5ee3c419e8b8d2a65d298bd Mon Sep 17 00:00:00 2001 From: roshniahuja Date: Tue, 21 Mar 2023 00:18:56 +0530 Subject: [PATCH 02/17] Modal for unlink and relink --- assets/js/gutenberg-plugin.js | 206 +++++++++++++++++++++++++++------- 1 file changed, 168 insertions(+), 38 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index ae6b845a7..62d78d163 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -1,10 +1,12 @@ import { pluginIcon } from './components/plugin-icon'; -import { Icon } from '@wordpress/components'; +import { Icon, Modal, Button } from '@wordpress/components'; import { select, useSelect } from '@wordpress/data'; import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; import { __, _n, _x, sprintf } from '@wordpress/i18n'; import { registerPlugin } from '@wordpress/plugins'; +import { useState } from '@wordpress/element'; + const { document, dtGutenberg, MouseEvent } = window; @@ -127,50 +129,178 @@ const RenderDistributedTo = () => { ); }; + /** * Render the distributed from component */ const RenderDistributedFrom = () => { - return ( -
- - { sprintf( - /* translators: 1: Syndication date and time. */ - __( 'Pulled & linked on %1$s from %2$s', 'distributor' ), - dtGutenberg.syndicationTime, - dtGutenberg.originalLocationName - ) } - -
- - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Updating the ', 'distributor' ), - ) - } - - { sprintf( + + const [ isOpen, setOpen ] = useState( false ); + const openModal = () => setOpen( true ); + const closeModal = () => setOpen( false ); + + if ( ! parseInt( dtGutenberg.unlinked ) ) { + return ( +
+ + { sprintf( + /* translators: 1: Syndication date and time. */ + __( 'Pulled & linked on %1$s from %2$s', 'distributor' ), + dtGutenberg.syndicationTime, + dtGutenberg.originalLocationName + ) } + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Updating the ', 'distributor' ), + ) + } + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Original Content', 'distributor' ), + ) + }, + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'will update this post automatically.', 'distributor' ), + ) + } + + + + { sprintf( /* translators: %s is the URL to Original Content */ - __( 'Original Content', 'distributor' ), - ) - }, + __( 'Unlink from Original', 'distributor' ), + ) } + + { isOpen && ( + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Unlinking from the ', 'distributor' ), + ) + } + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Original Content ', 'distributor' ), + ) + } - - { sprintf( + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'will stop updating this post automatically.', 'distributor' ), + ) + } + +
+
+ + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Unlink', 'distributor' ), + ) + } + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Cancel', 'distributor' ), + ) + } + +
+
+ ) } +
+ ); + } else { + return ( +
+ + { sprintf( + /* translators: 1: Syndication date and time. */ + __( 'Pulled on %1$s from %2$s', 'distributor' ), + dtGutenberg.syndicationTime, + dtGutenberg.originalLocationName + ) } + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'This post has been unlinked from the ', 'distributor' ), + ) + } + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Original Content', 'distributor' ), + ) + } + + + + + { sprintf( /* translators: %s is the URL to Original Content */ - __( 'will update this post automatically.', 'distributor' ), - ) - } - -
- - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Unlink from Original', 'distributor' ), - ) } - -
- ); + __( 'Restore link to Original', 'distributor' ), + ) } +
+ { isOpen && ( + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Restoring the link to the ', 'distributor' ), + ) + } + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Original Content. ', 'distributor' ), + ) + } + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'will start updating this post automatically from the Original, overwriting current content.', 'distributor' ), + ) + } + +
+ + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Restore link', 'distributor' ), + ) + } + + + { sprintf( + /* translators: %s is the URL to Original Content */ + __( 'Cancel', 'distributor' ), + ) + } + +
+
+ ) } +
+ ); + } }; /** From 88761bed134235ead796ed9b9fa0e651c4182edb Mon Sep 17 00:00:00 2001 From: roshniahuja Date: Tue, 21 Mar 2023 17:30:17 +0530 Subject: [PATCH 03/17] Changed Sidebar title and Added linked and unlinked dashicons for distributor column --- assets/js/gutenberg-plugin.js | 17 +++++++++++++++-- includes/syndicated-post-ui.php | 6 +++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 62d78d163..3c4205cbe 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -310,6 +310,19 @@ const DistributorIcon = () => ( ); +/** + * Create the Distributor title + */ +const DistributorTitle = () => { + if ( ! parseInt( dtGutenberg.unlinked ) ) { + return __( 'Pulled Content', 'distributor' ); + } else { + return __( 'Unlinked Content', 'distributor' ); + } + + return null; +}; + /** * Add the Distributor panel to Gutenberg */ @@ -347,7 +360,7 @@ const DistributorPlugin = () => { ) { return ( @@ -359,7 +372,7 @@ const DistributorPlugin = () => { return ( diff --git a/includes/syndicated-post-ui.php b/includes/syndicated-post-ui.php index def460d6a..70c6b28d0 100644 --- a/includes/syndicated-post-ui.php +++ b/includes/syndicated-post-ui.php @@ -80,16 +80,16 @@ function output_distributor_column( $column_name, $post_id ) { $original_deleted = (bool) get_post_meta( $post_id, 'dt_original_post_deleted', true ); if ( ( empty( $original_blog_id ) && empty( $original_source_id ) ) || $original_deleted ) { - echo '—'; + echo ''; } else { $unlinked = (bool) get_post_meta( $post_id, 'dt_unlinked', true ); $post_type_object = get_post_type_object( get_post_type( $post_id ) ); $post_url = get_post_meta( $post_id, 'dt_original_post_url', true ); if ( $unlinked ) { - echo '' . esc_attr__( 'Unlinked', 'distributor' ) . ''; + echo ''; } else { - echo '' . esc_attr__( 'Linked', 'distributor' ) . ''; + echo ''; } } } From 292a9eab49701a16524c3c3c36c50c19285f7388 Mon Sep 17 00:00:00 2001 From: roshniahuja Date: Tue, 21 Mar 2023 22:31:11 +0530 Subject: [PATCH 04/17] Resolved PluginDocumentSettingPanel title issue --- assets/js/gutenberg-plugin.js | 271 +++++++++++++++++----------------- 1 file changed, 133 insertions(+), 138 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 3c4205cbe..a53f661f2 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -7,7 +7,6 @@ import { __, _n, _x, sprintf } from '@wordpress/i18n'; import { registerPlugin } from '@wordpress/plugins'; import { useState } from '@wordpress/element'; - const { document, dtGutenberg, MouseEvent } = window; /** @@ -129,15 +128,13 @@ const RenderDistributedTo = () => { ); }; - /** * Render the distributed from component */ const RenderDistributedFrom = () => { - const [ isOpen, setOpen ] = useState( false ); - const openModal = () => setOpen( true ); - const closeModal = () => setOpen( false ); + const openModal = () => setOpen( true ); + const closeModal = () => setOpen( false ); if ( ! parseInt( dtGutenberg.unlinked ) ) { return ( @@ -145,162 +142,162 @@ const RenderDistributedFrom = () => { { sprintf( /* translators: 1: Syndication date and time. */ - __( 'Pulled & linked on %1$s from %2$s', 'distributor' ), + __( + 'Pulled & linked on %1$s from %2$s', + 'distributor' + ), dtGutenberg.syndicationTime, dtGutenberg.originalLocationName ) } { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Updating the ', 'distributor' ), - ) - } - - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Original Content', 'distributor' ), - ) - }, - - + /* translators: 1: Pulled Message. */ + __( 'Updating the ', 'distributor' ) + ) } + + { sprintf( + /* translators: 1: URL to Original Content */ + __( 'Original Content', 'distributor' ) + ) } + , + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'will update this post automatically.', 'distributor' ), + /* translators: 1: Pulled Message. */ + __( + 'will update this post automatically.', + 'distributor' ) - } + ) } - - + + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Unlink from Original', 'distributor' ), + /* translators: 1: URL to Unlink Original Content */ + __( 'Unlink from Original', 'distributor' ) ) } { isOpen && ( - - - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Unlinking from the ', 'distributor' ), - ) - } - + + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Original Content ', 'distributor' ), - ) - } - - + /* translators: 1: Unlinked Message for Modal.*/ + __( 'Unlinking from the ', 'distributor' ) + ) } + + { sprintf( + /* translators: 1: Unlinked Message for Modal. */ + __( 'Original Content ', 'distributor' ) + ) } + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'will stop updating this post automatically.', 'distributor' ), + /* translators: 1: Unlinked Message for Modal. */ + __( + 'will stop updating this post automatically.', + 'distributor' ) - } + ) }
-
- - +
+ + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Unlink', 'distributor' ), - ) - } - + /* translators: 1: Action link for Unlinked Modal. */ + __( 'Unlink', 'distributor' ) + ) } + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Cancel', 'distributor' ), - ) - } + /* translators: 1: Action link for Unlinked Modal. */ + __( 'Cancel', 'distributor' ) + ) }
- - ) } + + ) }
); - } else { - return ( -
- + } + return ( +
+ + { sprintf( + /* translators: 1: Syndication date and time. */ + __( 'Pulled on %1$s from %2$s', 'distributor' ), + dtGutenberg.syndicationTime, + dtGutenberg.originalLocationName + ) } + + + { sprintf( + /* translators: 1: Unlinked Message. */ + __( 'This post has been unlinked from the ', 'distributor' ) + ) } + { sprintf( - /* translators: 1: Syndication date and time. */ - __( 'Pulled on %1$s from %2$s', 'distributor' ), - dtGutenberg.syndicationTime, - dtGutenberg.originalLocationName + /* translators: 1: URL to Original Content */ + __( 'Original Content', 'distributor' ) ) } - - - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'This post has been unlinked from the ', 'distributor' ), - ) - } - - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Original Content', 'distributor' ), - ) - } - - - + + + + { sprintf( + /* translators: 1: Restore Link Message for Modal.*/ + __( 'Restore link to Original', 'distributor' ) + ) } + + { isOpen && ( + - - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Restore link to Original', 'distributor' ), - ) } - - { isOpen && ( - - + + { sprintf( + /* translators: 1: Restore Link Message for Modal.*/ + __( 'Restoring the link to the ', 'distributor' ) + ) } + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Restoring the link to the ', 'distributor' ), - ) - } - + /* translators: 1: Restore Link Message for Modal.*/ + __( 'Original Content. ', 'distributor' ) + ) } + + { sprintf( + /* translators: 1: Restore Link Message for Modal.*/ + __( + 'will start updating this post automatically from the Original, overwriting current content.', + 'distributor' + ) + ) } + +
+ + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Original Content. ', 'distributor' ), - ) - } - - + /* translators: 1: Action link for Unlinked Modal. */ + __( 'Restore link', 'distributor' ) + ) } + + { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'will start updating this post automatically from the Original, overwriting current content.', 'distributor' ), - ) - } + /* translators: 1: Action link for Unlinked Modal. */ + __( 'Cancel', 'distributor' ) + ) } -
- - - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Restore link', 'distributor' ), - ) - } - - - { sprintf( - /* translators: %s is the URL to Original Content */ - __( 'Cancel', 'distributor' ), - ) - } - -
- - ) } -
- ); - } +
+ + ) } +
+ ); }; /** @@ -313,14 +310,12 @@ const DistributorIcon = () => ( /** * Create the Distributor title */ -const DistributorTitle = () => { - if ( ! parseInt( dtGutenberg.unlinked ) ) { - return __( 'Pulled Content', 'distributor' ); - } else { - return __( 'Unlinked Content', 'distributor' ); - } +const isUnlinkedContent = parseInt( dtGutenberg.unlinked ) !== 0; - return null; +const DistributorTitle = () => { + return isUnlinkedContent + ? __( 'Unlinked Content', 'distributor' ) + : __( 'Pulled Content', 'distributor' ); }; /** @@ -360,7 +355,7 @@ const DistributorPlugin = () => { ) { return ( } icon={ DistributorIcon } className="distributor-panel" > @@ -372,7 +367,7 @@ const DistributorPlugin = () => { return ( } icon={ DistributorIcon } className="distributor-panel" > From 213550ff6c85a8efe13200904920c69b6a23b3d2 Mon Sep 17 00:00:00 2001 From: roshniahuja Date: Wed, 22 Mar 2023 15:36:25 +0530 Subject: [PATCH 05/17] CS: Fix prettier issues. --- assets/js/gutenberg-plugin.js | 101 +++++++++------------------------- 1 file changed, 25 insertions(+), 76 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 69cd3ee92..2648374d2 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -1,6 +1,6 @@ import { pluginIcon } from './components/plugin-icon'; -import { Icon, Modal, Button } from '@wordpress/components'; +import { Icon, Modal } from '@wordpress/components'; import { select, useSelect } from '@wordpress/data'; import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; import { __, _n, _x, sprintf } from '@wordpress/i18n'; @@ -151,31 +151,19 @@ const RenderDistributedFrom = () => { ) }
- { sprintf( - /* translators: 1: Pulled Message. */ - __( 'Updating the ', 'distributor' ) - ) } + { __( 'Updating the ', 'distributor' ) } - { sprintf( - /* translators: 1: URL to Original Content */ - __( 'Original Content', 'distributor' ) - ) } - , + { __( 'Original Content', 'distributor' ) }, - { sprintf( - /* translators: 1: Pulled Message. */ - __( - 'will update this post automatically.', - 'distributor' - ) + { __( + 'will update this post automatically.', + 'distributor' ) } + , - { sprintf( - /* translators: 1: URL to Unlink Original Content */ - __( 'Unlink from Original', 'distributor' ) - ) } + { __( 'Unlink from Original', 'distributor' ) } { isOpen && ( { onRequestClose={ closeModal } > - { sprintf( - /* translators: 1: Unlinked Message for Modal.*/ - __( 'Unlinking from the ', 'distributor' ) - ) } + { __( 'Unlinking from the ', 'distributor' ) } - { sprintf( - /* translators: 1: Unlinked Message for Modal. */ - __( 'Original Content ', 'distributor' ) - ) } + { __( 'Original Content ', 'distributor' ) } - { sprintf( - /* translators: 1: Unlinked Message for Modal. */ - __( - 'will stop updating this post automatically.', - 'distributor' - ) + { __( + 'will stop updating this post automatically.', + 'distributor' ) }
- { sprintf( - /* translators: 1: Action link for Unlinked Modal. */ - __( 'Unlink', 'distributor' ) - ) } + { __( 'Unlink', 'distributor' ) } - { sprintf( - /* translators: 1: Action link for Unlinked Modal. */ - __( 'Cancel', 'distributor' ) - ) } + { __( 'Cancel', 'distributor' ) }
@@ -235,23 +208,14 @@ const RenderDistributedFrom = () => { ) } - { sprintf( - /* translators: 1: Unlinked Message. */ - __( 'This post has been unlinked from the ', 'distributor' ) - ) } + { __( 'This post has been unlinked from the ', 'distributor' ) } - { sprintf( - /* translators: 1: URL to Original Content */ - __( 'Original Content', 'distributor' ) - ) } + { __( 'Original Content', 'distributor' ) } - { sprintf( - /* translators: 1: Restore Link Message for Modal.*/ - __( 'Restore link to Original', 'distributor' ) - ) } + { __( 'Restore link to Original', 'distributor' ) } { isOpen && ( { onRequestClose={ closeModal } > - { sprintf( - /* translators: 1: Restore Link Message for Modal.*/ - __( 'Restoring the link to the ', 'distributor' ) - ) } + { __( 'Restoring the link to the ', 'distributor' ) } - { sprintf( - /* translators: 1: Restore Link Message for Modal.*/ - __( 'Original Content. ', 'distributor' ) - ) } + { __( 'Original Content. ', 'distributor' ) } - { sprintf( - /* translators: 1: Restore Link Message for Modal.*/ - __( - 'will start updating this post automatically from the Original, overwriting current content.', - 'distributor' - ) + { __( + 'will start updating this post automatically from the Original, overwriting current content.', + 'distributor' ) }
- { sprintf( - /* translators: 1: Action link for Unlinked Modal. */ - __( 'Restore link', 'distributor' ) - ) } + { __( 'Restore link', 'distributor' ) } - { sprintf( - /* translators: 1: Action link for Unlinked Modal. */ - __( 'Cancel', 'distributor' ) - ) } + { __( 'Cancel', 'distributor' ) }
From ef3275282b324e6c55dba402cea6060da032a4f3 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Thu, 4 Jul 2024 23:59:52 +0530 Subject: [PATCH 06/17] update designs as per request --- assets/css/admin.css | 61 +++++++++++++++++++++++++++++++++++ assets/js/gutenberg-plugin.js | 39 ++++++++++++++-------- 2 files changed, 87 insertions(+), 13 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index 0dc1bcfb7..fa55cec52 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -30,6 +30,67 @@ width: 20px; } +.distributor-panel span { + display: inline-block; + margin-bottom: 15px; +} + +#distributed-unlink { + margin: 0; +} + +#distributed-unlink .dashicons-editor-unlink { + color: #b50909; + margin-right: 7px; + text-decoration: none; +} + +.distributed-modal-popup .components-modal__icon-container svg { + width: 25px; +} + +.distributed-modal-popup h1 { + margin-left: 8px; + margin-top: -3px; +} + +.distributed-modal-popup span {display: inline-block;} + +.distributed-modal-popup .actions { + margin-top: 20px; +} + +body .distributed-modal-popup button, +body .distributed-modal-popup .button { + opacity: 1; + pointer-events: initial; + cursor: pointer; +} + +.distributed-modal-popup .actions a.button { + display: inline-block; + margin-right: 20px; +} + +.distributed-modal-popup .actions a span { + display: inline-block; + margin-top: 5px; + margin-right: 5px; + color: #b50909; +} + +.distributed-modal-popup .actions a span.dashicons-admin-links { + color: #046e04; +} + +.distributed-modal-popup .actions #close { + margin-top: 5px; +} + +.distributed-modal-popup { + max-width: 380px; +} + .distributor-toggle { margin-bottom: 8px; } diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 2648374d2..d27ed5307 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -162,8 +162,10 @@ const RenderDistributedFrom = () => { , - - { __( 'Unlink from Original', 'distributor' ) } + {/* eslint-disable-line */} + + { __( 'Unlink from Original', 'distributor' ) } + { isOpen && ( { icon={ pluginIcon } size={ 50 } onRequestClose={ closeModal } + className="distributed-modal-popup" + overlayClassName="distributed-modal-overlay" > { __( 'Unlinking from the ', 'distributor' ) } - { __( 'Original Content ', 'distributor' ) } + { __( 'Original Content', 'distributor' ) } { __( - 'will stop updating this post automatically.', + ' will stop updating this post automatically.', 'distributor' ) }
@@ -212,10 +218,13 @@ const RenderDistributedFrom = () => { { __( 'Original Content', 'distributor' ) } + { '.' } - - { __( 'Restore link to Original', 'distributor' ) } + + {/* eslint-disable-line */} + { __( 'Restore link to Original', 'distributor' ) } + { isOpen && ( { icon={ pluginIcon } size={ 50 } onRequestClose={ closeModal } + className="distributed-modal-popup" + overlayClassName="distributed-modal-overlay" > { __( 'Restoring the link to the ', 'distributor' ) } - { __( 'Original Content. ', 'distributor' ) } + { __( 'Original Content', 'distributor' ) } { __( - 'will start updating this post automatically from the Original, overwriting current content.', + ' will start updating this post automatically from the Original, overwriting current content.', 'distributor' ) } From fab7f9c0e2266f8a10ad8aa8603918a742fa96e2 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Fri, 5 Jul 2024 21:50:22 +0530 Subject: [PATCH 07/17] different status icons --- includes/syndicated-post-ui.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/includes/syndicated-post-ui.php b/includes/syndicated-post-ui.php index 67fccde44..f261df60f 100644 --- a/includes/syndicated-post-ui.php +++ b/includes/syndicated-post-ui.php @@ -79,18 +79,23 @@ function output_distributor_column( $column_name, $post_id ) { $original_blog_id = get_post_meta( $post_id, 'dt_original_blog_id', true ); $original_source_id = get_post_meta( $post_id, 'dt_original_source_id', true ); $original_deleted = (bool) get_post_meta( $post_id, 'dt_original_post_deleted', true ); + $connection_map = get_post_meta( $post_id, 'dt_connection_map', true ); - if ( ( empty( $original_blog_id ) && empty( $original_source_id ) ) || $original_deleted ) { + if ( ( ( empty( $original_blog_id ) && empty( $original_source_id ) ) || $original_deleted ) && ! $connection_map ) { echo ''; } else { - $unlinked = (bool) get_post_meta( $post_id, 'dt_unlinked', true ); - $post_type_object = get_post_type_object( get_post_type( $post_id ) ); - $post_url = get_post_meta( $post_id, 'dt_original_post_url', true ); - - if ( $unlinked ) { - echo ''; + if ( $connection_map ) { + // When a post is pushed from current site or pulled by other sites. + echo ''; } else { - echo ''; + $unlinked = (bool) get_post_meta( $post_id, 'dt_unlinked', true ); + $post_url = get_post_meta( $post_id, 'dt_original_post_url', true ); + + if ( $unlinked ) { + echo ''; + } else { + echo ''; + } } } } From 2e5bcff2b686caf3845819b9628b51aa47618e03 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Fri, 5 Jul 2024 21:59:26 +0530 Subject: [PATCH 08/17] fix minor phpcs warning --- includes/syndicated-post-ui.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/syndicated-post-ui.php b/includes/syndicated-post-ui.php index f261df60f..cb7930272 100644 --- a/includes/syndicated-post-ui.php +++ b/includes/syndicated-post-ui.php @@ -95,7 +95,7 @@ function output_distributor_column( $column_name, $post_id ) { echo ''; } else { echo ''; - } + } } } } From fcfaa143e1b7e9ad54717658d70f5de36c236e5e Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Fri, 5 Jul 2024 22:06:19 +0530 Subject: [PATCH 09/17] eslint warning --- assets/js/gutenberg-plugin.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 39840244b..0d423b655 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -188,7 +188,10 @@ const RenderDistributedFrom = () => {
- + { __( 'Unlink', 'distributor' ) } @@ -246,11 +249,11 @@ const RenderDistributedFrom = () => { ) }
- + { __( 'Restore link', 'distributor' ) } - + {/* eslint-disable-line */} {/* eslint-disable-line */} { __( 'Cancel', 'distributor' ) } From a4b6c88ae0e6773493a83d8ae4169017225765c7 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Fri, 5 Jul 2024 22:09:36 +0530 Subject: [PATCH 10/17] a few ignorable lines for eslint --- assets/js/gutenberg-plugin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 0d423b655..3c3991453 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -161,7 +161,7 @@ const RenderDistributedFrom = () => { ) } , - + {/* eslint-disable-line */} {/* eslint-disable-line */} { __( 'Unlink from Original', 'distributor' ) } @@ -195,7 +195,7 @@ const RenderDistributedFrom = () => { { __( 'Unlink', 'distributor' ) } - + {/* eslint-disable-line */} {/* eslint-disable-line */} { __( 'Cancel', 'distributor' ) } @@ -223,7 +223,7 @@ const RenderDistributedFrom = () => { { '.' } - + {/* eslint-disable-line */} {/* eslint-disable-line */} { __( 'Restore link to Original', 'distributor' ) } From c53d6da0c1803b4c9e3d611db8f63659f4171437 Mon Sep 17 00:00:00 2001 From: Siddharth Thevaril Date: Sun, 14 Jul 2024 22:24:23 +0530 Subject: [PATCH 11/17] make popup clickable --- assets/css/gutenberg-syndicated-post.scss | 11 ++++++ assets/js/gutenberg-plugin.js | 43 +++++++++++------------ 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/assets/css/gutenberg-syndicated-post.scss b/assets/css/gutenberg-syndicated-post.scss index f22160f00..852348ae9 100644 --- a/assets/css/gutenberg-syndicated-post.scss +++ b/assets/css/gutenberg-syndicated-post.scss @@ -19,6 +19,17 @@ body.dt-linked-post { cursor: default; } + .distributed-modal-popup { + & * { + pointer-events: auto; + opacity: 1; + } + + a, button { + cursor: pointer; + } + } + /* Allow clicks on confirmation dialog buttons */ .components-confirm-dialog button { opacity: 1; diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 3c3991453..1e9bbc5af 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -1,6 +1,6 @@ import { pluginIcon } from './components/plugin-icon'; -import { Icon, Modal } from '@wordpress/components'; +import { Icon, Modal, Button, Flex } from '@wordpress/components'; import { select, useSelect } from '@wordpress/data'; import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; import { __, _n, _x, sprintf } from '@wordpress/i18n'; @@ -176,31 +176,28 @@ const RenderDistributedFrom = () => { className="distributed-modal-popup" overlayClassName="distributed-modal-overlay" > - - { __( 'Unlinking from the ', 'distributor' ) } - - { __( 'Original Content', 'distributor' ) } - - { __( - ' will stop updating this post automatically.', - 'distributor' - ) } - -
-
- ', + '' + ) + } } /> + +
+ + + ) }
From 29e8f4c15edd30806abdf34b4706e61172f7d724 Mon Sep 17 00:00:00 2001 From: Faisal Alvi Date: Mon, 22 Jul 2024 19:28:47 +0530 Subject: [PATCH 12/17] Update assets/js/gutenberg-plugin.js Co-authored-by: Dharmesh Patel --- assets/js/gutenberg-plugin.js | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index c070f9a9e..cb4db1b8b 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -159,7 +159,6 @@ const RenderDistributedFrom = () => { 'will update this post automatically.', 'distributor' ) } - , {/* eslint-disable-line */} {/* eslint-disable-line */} From 0542975071fd17d4c23a9c132ef551f750355586 Mon Sep 17 00:00:00 2001 From: Faisal Alvi Date: Mon, 22 Jul 2024 19:28:57 +0530 Subject: [PATCH 13/17] Update assets/js/gutenberg-plugin.js Co-authored-by: Dharmesh Patel --- assets/js/gutenberg-plugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index cb4db1b8b..721686824 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -153,8 +153,9 @@ const RenderDistributedFrom = () => { { __( 'Updating the ', 'distributor' ) } - { __( 'Original Content', 'distributor' ) }, + { __( 'Original Content', 'distributor' ) } + { ', ' } { __( 'will update this post automatically.', 'distributor' From 2e8f1a00b63817042f0de72d43b1a929088a14d8 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Mon, 22 Jul 2024 20:00:38 +0530 Subject: [PATCH 14/17] fix eslint errors --- assets/js/gutenberg-plugin.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 721686824..5ce193264 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -176,25 +176,27 @@ const RenderDistributedFrom = () => { className="distributed-modal-popup" overlayClassName="distributed-modal-overlay" > -

', - '' - ) - } } /> - +

', + '' + ), + } } + /> + - From 7dcf925b01bede2ca39f30da6baa3f6eb8a15b52 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Mon, 22 Jul 2024 20:09:10 +0530 Subject: [PATCH 15/17] fix button alignment --- assets/css/admin.css | 5 ++--- assets/js/gutenberg-plugin.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index fa55cec52..0c008d249 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -67,9 +67,8 @@ body .distributed-modal-popup .button { cursor: pointer; } -.distributed-modal-popup .actions a.button { - display: inline-block; - margin-right: 20px; +.distributed-modal-popup .actions a { + margin-right: 10px; } .distributed-modal-popup .actions a span { diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 5ce193264..0e3527561 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -188,7 +188,7 @@ const RenderDistributedFrom = () => { ), } } /> - +