mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-15 14:55:44 +03:00
Build: 7dc7e421ae
This commit is contained in:
parent
7dc7e421ae
commit
5f016b5491
34 changed files with 891 additions and 12 deletions
17
themes/wporg-5ftf-2024/build/my-pledge-list/block.json
Normal file
17
themes/wporg-5ftf-2024/build/my-pledge-list/block.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "wporg/my-pledge-list",
|
||||
"version": "1.0.0-7dc7e42",
|
||||
"title": "My pledges",
|
||||
"category": "design",
|
||||
"icon": "",
|
||||
"description": "List out the pledges for this user.",
|
||||
"textdomain": "wporg",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"editorScript": "file:./index.js",
|
||||
"style": "file:./style-index.css",
|
||||
"render": "file:./render.php"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-server-side-render'), 'version' => '8a66cc955de2db1bbef8');
|
1
themes/wporg-5ftf-2024/build/my-pledge-list/index.js
Normal file
1
themes/wporg-5ftf-2024/build/my-pledge-list/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
(()=>{"use strict";var r,e={620:(r,e,t)=>{const o=window.wp.blocks,n=window.wp.blockEditor,i=window.wp.serverSideRender;var s=t.n(i);const a=JSON.parse('{"UU":"wporg/my-pledge-list"}'),l=window.ReactJSXRuntime;(0,o.registerBlockType)(a.UU,{edit:({attributes:r,name:e})=>{const t=(0,n.useBlockProps)();return(0,l.jsx)("div",{...t,children:(0,l.jsx)(s(),{block:e,attributes:r,skipBlockSupportAttributes:!0})})},save:()=>null})}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}o.m=e,r=[],o.O=(e,t,n,i)=>{if(!t){var s=1/0;for(u=0;u<r.length;u++){t=r[u][0],n=r[u][1],i=r[u][2];for(var a=!0,l=0;l<t.length;l++)(!1&i||s>=i)&&Object.keys(o.O).every((r=>o.O[r](t[l])))?t.splice(l--,1):(a=!1,i<s&&(s=i));if(a){r.splice(u--,1);var p=n();void 0!==p&&(e=p)}}return e}i=i||0;for(var u=r.length;u>0&&r[u-1][2]>i;u--)r[u]=r[u-1];r[u]=[t,n,i]},o.n=r=>{var e=r&&r.__esModule?()=>r.default:()=>r;return o.d(e,{a:e}),e},o.d=(r,e)=>{for(var t in e)o.o(e,t)&&!o.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},o.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={23:0,743:0};o.O.j=e=>0===r[e];var e=(e,t)=>{var n,i,s=t[0],a=t[1],l=t[2],p=0;if(s.some((e=>0!==r[e]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(l)var u=l(o)}for(e&&e(t);p<s.length;p++)i=s[p],o.o(r,i)&&r[i]&&r[i][0](),r[i]=0;return o.O(u)},t=self.webpackChunkwporg_5ftf_2024=self.webpackChunkwporg_5ftf_2024||[];t.forEach(e.bind(null,0)),t.push=e.bind(null,t.push.bind(t))})();var n=o.O(void 0,[743],(()=>o(620)));n=o.O(n)})();
|
103
themes/wporg-5ftf-2024/build/my-pledge-list/render.php
Normal file
103
themes/wporg-5ftf-2024/build/my-pledge-list/render.php
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/**
|
||||
* Render the pledge list for the current user.
|
||||
* Mostly copied from Contributor\render_my_pledges, updated markup to use blocks.
|
||||
*/
|
||||
|
||||
use WordPressDotOrg\FiveForTheFuture\{ Contributor, XProfile };
|
||||
use function WordPressdotorg\Theme\FiveForTheFuture_2024\My_Pledge_List\{render_single_pledge, render_notice};
|
||||
use const WordPressDotOrg\FiveForTheFuture\Contributor\CPT_ID as CONTRIBUTOR_POST_TYPE;
|
||||
|
||||
if ( ! is_user_logged_in() ) {
|
||||
render_notice( 'warning', sprintf(
|
||||
__( 'Please <a href="%s">log in to your WordPress.org account</a> in order to view your pledges.', 'wporg-5ftf' ),
|
||||
esc_url( wp_login_url( get_permalink() ) )
|
||||
) );
|
||||
return;
|
||||
}
|
||||
|
||||
$user = wp_get_current_user();
|
||||
$profile_data = XProfile\get_contributor_user_data( $user->ID );
|
||||
$pledge_url = get_permalink( get_page_by_path( 'for-organizations' ) );
|
||||
$success_message = Contributor\process_my_pledges_form();
|
||||
|
||||
$contributor_pending_posts = get_posts( array(
|
||||
'title' => $user->user_login,
|
||||
'post_type' => CONTRIBUTOR_POST_TYPE,
|
||||
'post_status' => array( 'pending' ),
|
||||
'numberposts' => 100,
|
||||
) );
|
||||
|
||||
$contributor_publish_posts = get_posts( array(
|
||||
'title' => $user->user_login,
|
||||
'post_type' => CONTRIBUTOR_POST_TYPE,
|
||||
'post_status' => array( 'publish' ),
|
||||
'numberposts' => 100,
|
||||
) );
|
||||
|
||||
$has_contributions = $contributor_pending_posts || $contributor_publish_posts;
|
||||
$has_profile_data = $profile_data['hours_per_week'] && $profile_data['team_names'];
|
||||
|
||||
?>
|
||||
<div
|
||||
<?php echo get_block_wrapper_attributes(); // phpcs:ignore ?>
|
||||
>
|
||||
<?php
|
||||
if ( $success_message ) {
|
||||
render_notice( 'success', $success_message );
|
||||
echo '<div style="margin-top:var(--wp--preset--spacing--40);height:0" aria-hidden="true" class="wp-block-spacer"></div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ( $has_contributions ) : ?>
|
||||
|
||||
<?php if ( $contributor_publish_posts ) : ?>
|
||||
<h2 class="screen-reader-text"><?php esc_html_e( 'Pledges', 'wporg-5ftf' ); ?></h2>
|
||||
|
||||
<div class="my-pledges__list">
|
||||
<?php
|
||||
foreach ( $contributor_publish_posts as $contributor_post ) {
|
||||
render_single_pledge( $contributor_post, $has_profile_data );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $contributor_pending_posts ) : ?>
|
||||
|
||||
<h2><?php esc_html_e( 'Pending Pledges', 'wporg-5ftf' ); ?></h2>
|
||||
|
||||
<div class="my-pledges__list is-pending-list">
|
||||
<?php
|
||||
if ( ! $has_profile_data ) {
|
||||
render_notice(
|
||||
'warning',
|
||||
sprintf(
|
||||
__( 'You need to <a href="%s">update your profile</a> before joining an organization.', 'wporg-5ftf' ),
|
||||
'https://profiles.wordpress.org/me/profile/edit/group/5/'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $contributor_pending_posts as $contributor_post ) {
|
||||
render_single_pledge( $contributor_post, $has_profile_data );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses_data( sprintf(
|
||||
__( 'You don’t currently have any sponsorships. If your employer is sponsoring part of your time to contribute to WordPress, please ask them to <a href="%s">submit a pledge</a> and list you as a contributor.', 'wporg-5ftf' ),
|
||||
esc_url( $pledge_url )
|
||||
) );
|
||||
?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
.wp-block-wporg-my-pledge-list>p{max-width:var(--wp--custom--layout--content-size)}.wp-block-wporg-my-pledge-list .my-pledges__list>*+*{margin-top:var(--wp--preset--spacing--60)}.wp-block-wporg-my-pledge-list .my-pledges__list.is-pending-list>.wp-block-wporg-notice{margin-top:var(--wp--preset--spacing--20)}.wp-block-wporg-my-pledge-list>h2{margin-top:80px!important}@media(max-width:600px){.wp-block-wporg-my-pledge-list>h2{margin-top:40px!important}}.wp-block-wporg-my-pledge-list .my-pledges__pledge-actions form{display:flex;flex-wrap:wrap;gap:var(--wp--preset--spacing--20)}.wp-block-wporg-my-pledge-list .my-pledges__pledge-actions .wp-block-button{display:inline-block}.wp-block-wporg-my-pledge-list .my-pledges__pledge-actions .wp-block-button [disabled=disabled]{--wp--custom--button--color--background:var(--wp--preset--color--blueberry-2);pointer-events:none}
|
|
@ -0,0 +1 @@
|
|||
.wp-block-wporg-my-pledge-list>p{max-width:var(--wp--custom--layout--content-size)}.wp-block-wporg-my-pledge-list .my-pledges__list>*+*{margin-top:var(--wp--preset--spacing--60)}.wp-block-wporg-my-pledge-list .my-pledges__list.is-pending-list>.wp-block-wporg-notice{margin-top:var(--wp--preset--spacing--20)}.wp-block-wporg-my-pledge-list>h2{margin-top:80px!important}@media(max-width:600px){.wp-block-wporg-my-pledge-list>h2{margin-top:40px!important}}.wp-block-wporg-my-pledge-list .my-pledges__pledge-actions form{display:flex;flex-wrap:wrap;gap:var(--wp--preset--spacing--20)}.wp-block-wporg-my-pledge-list .my-pledges__pledge-actions .wp-block-button{display:inline-block}.wp-block-wporg-my-pledge-list .my-pledges__pledge-actions .wp-block-button [disabled=disabled]{--wp--custom--button--color--background:var(--wp--preset--color--blueberry-2);pointer-events:none}
|
Loading…
Add table
Add a link
Reference in a new issue