Changeset 13996
- Timestamp:
- 08/26/2024 11:10:57 PM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/rejection.php
r12970 r13996 814 814 815 815 $selected = self::get_rejection_reason( $post ); 816 $is_disabled = in_array( get_post_status( $post ), [ ' trash', self::get_post_status() ] );816 $is_disabled = in_array( get_post_status( $post ), [ 'publish', 'trash', self::get_post_status() ] ); 817 817 818 818 echo "<style> … … 826 826 .reject-action.post-is-rejected input[type=submit] { background-color: #2271b1; border-color: #2271b1; } 827 827 .reject-action input[type=submit]:hover { background-color: #8f2424; border-color: #8f2424; color: white; } 828 829 .reject-warn-if-published { border:1px solid #856404; background-color: #fff3cd; color: #856404; padding: 8px; margin-bottom: 0.5rem; } 830 .reject-warn-if-about-to-reject-published { border: 1px solid #721c24; background-color: #f8d7da; color: #721c24; padding: 8px 12px; margin-bottom: 0.5rem; } 828 831 </style>\n"; 829 832 … … 838 841 // Bind changing of value of rejection reason dropdown to toggle whether reject or publish button is enabled. 839 842 const rejectSelect = document.querySelector('#rejected_reason'); 840 rejectSelect .addEventListener('change', (event) => {843 rejectSelect?.addEventListener('change', (event) => { 841 844 const hasRejectReason = Boolean(event.target.value); 842 845 // Publish button should be disabled if a rejection reason is selected. … … 844 847 // Reject button should be disabled if no rejection reason is selected. 845 848 document.querySelector('#reject-post').disabled = !hasRejectReason; 849 // Notice of rejection of published post should be shown if post is published. 850 const rejectPublishWarn = document.querySelector('.reject-warn-if-about-to-reject-published'); 851 if ( rejectPublishWarn ) { 852 rejectPublishWarn.style.display = ( hasRejectReason ? 'block' : 'none' ); 853 } 854 }); 855 856 // Bind checkbox for enabling rejection of published photo. 857 const cbRejectPublished = document.querySelector('#reject-warn-if-reject-published'); 858 cbRejectPublished?.addEventListener('change', (event) => { 859 if (rejectSelect) { 860 rejectSelect.disabled = !event.target.checked; 861 } 846 862 }); 847 863 … … 852 868 </script> 853 869 JS; 870 871 // Show a notice if the post is already published and a checkbox for enabling rejection field. 872 if ( 'publish' === get_post_status( $post ) ) { 873 echo '<div class="reject-warn-if-published">'; 874 echo '<label class="warn-if-reject-published-container"><input id="reject-warn-if-reject-published" type="checkbox" name="reject_warn_if_reject_published" />'; 875 esc_html_e( 'Allow rejection of published photo?', 'wporg-photos' ); 876 echo "</label></div>\n"; 877 } 854 878 855 879 echo '<label for="rejected_reason">' . __( 'Reject due to:', 'wporg-photos' ) . '<br>'; … … 886 910 887 911 echo "</div></div>\n"; 912 913 // Output a notice adjacent to reject button for use if about to reject a published post. 914 if ( 'publish' === get_post_status( $post ) ) { 915 echo '<div class="reject-warn-if-about-to-reject-published" style="display:none;" >'; 916 esc_html_e( 'Warning: You are about to reject a published photo!', 'wporg-photos' ); 917 echo "</div>\n"; 918 } 888 919 889 920 $is_rejected = self::is_post_rejected( $post );
Note: See TracChangeset
for help on using the changeset viewer.