Theme: Single pledge view (#43)

* Theme: Create template part for single pledge

* Plugin: Add functions for handling xprofile data

* Plugin: Add helper function for getting contributor user objects

* Theme: Display aggregated contributor data on single pledge view

* Theme: Add functions, markup, and styles to show team badges

* Theme: Add badge for Test team

* Theme: Add tentative URL for report a pledge link

* Theme: Add support for post thumbnails

* Theme: Add org logo to single pledge view

* Theme: Update `$content_width` to 960

This matches the width of the content in the global header and
the About page.

* Move pledge template to a file used by the template heirarchy

* Clean up some PHPCS errors

* Move pledge structure out to just the list items

* Create file for single pledge styles

* style badge grid into a grid.

* Add a custom image size for the logo

* Update styles

* Un-hide pledges with no confirmed contributors

* Fix content width
This commit is contained in:
Corey McKrill 2019-10-28 10:38:49 -07:00 committed by Kelly Dwan
parent 2ec665bcbb
commit dbdcf26bd9
17 changed files with 683 additions and 53 deletions

View file

@ -37,6 +37,10 @@ function setup() {
add_theme_support( 'wp-block-styles' );
add_theme_support( 'editor-styles' );
add_theme_support( 'post-thumbnails' );
add_image_size( 'pledge-logo', 660, 200 );
add_editor_style( 'css/style-editor.css' );
add_theme_support(
@ -111,7 +115,7 @@ add_action( 'after_setup_theme', __NAMESPACE__ . '\setup' );
* @global int $content_width
*/
function content_width() {
$GLOBALS['content_width'] = apply_filters( 'wporg_plugins_content_width', 640 );
$GLOBALS['content_width'] = 640;
}
add_action( 'after_setup_theme', __NAMESPACE__ . '\content_width', 0 );
@ -204,3 +208,98 @@ function loader_src( $src, $handle ) {
}
add_filter( 'style_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 );
add_filter( 'script_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 );
/**
* Determines the CSS classes for a given team badge.
*
* Based on the `wporg_profiles_get_association_classes` function in the profiles.wordpress.org theme.
*
* @param string $team
*
* @return array
*/
function get_badge_classes( $team ) {
switch ( strtolower( $team ) ) {
case 'accessibility':
$classes = array( 'badge-accessibility', 'dashicons-universal-access' );
break;
case 'cli':
$classes = array( 'badge-wp-cli', 'dashicons-arrow-right-alt2' );
break;
case 'community':
$classes = array( 'badge-community', 'dashicons-groups' );
break;
case 'core':
$classes = array( 'badge-code-committer', 'dashicons-editor-code' );
break;
case 'design':
$classes = array( 'badge-design', 'dashicons-art' );
break;
case 'documentation':
$classes = array( 'badge-documentation', 'dashicons-admin-page' );
break;
case 'hosting':
$classes = array( 'badge-hosting', 'dashicons-cloud' );
break;
case 'marketing':
$classes = array( 'badge-marketing', 'dashicons-format-status' );
break;
case 'meta':
$classes = array( 'badge-meta', 'dashicons-networking' );
break;
case 'mobile':
$classes = array( 'badge-mobile', 'dashicons-smartphone' );
break;
case 'plugins':
$classes = array( 'badge-plugins-reviewer ', 'dashicons-admin-plugins' );
break;
case 'polyglots':
$classes = array( 'badge-translation-editor', 'dashicons-translation' );
break;
case 'security':
$classes = array( 'badge-security-team', 'dashicons-lock' );
break;
case 'support':
$classes = array( 'badge-support', 'dashicons-format-chat' );
break;
case 'test':
$classes = array( 'badge-test-team', 'dashicons-desktop' );
break;
case 'themes':
$classes = array( 'badge-themes-reviewer', 'dashicons-admin-appearance' );
break;
case 'tide':
$classes = array( 'badge-tide', 'dashicons-tide' );
break;
case 'training':
$classes = array( 'badge-training', 'dashicons-welcome-learn-more' );
break;
case 'tv':
$classes = array( 'badge-wordpress-tv', 'dashicons-video-alt2' );
break;
default:
$classes = array();
break;
}
return $classes;
}