Making WordPress.org

Changeset 7475


Ignore:
Timestamp:
07/18/2018 07:39:47 PM (7 years ago)
Author:
vedjain
Message:

Adds meta fields for contributor days.

Fixes https://meta.trac.wordpress.org/ticket/1183
WordCamps that are organizing contributor days can now be marked as such, allowing this information to be pulled and used to determine when contributor days are happening
.

props hlashbrooke

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/javascript/wcpt-wordcamp/admin.js

    r7260 r7475  
    1111    self.initialize = function() {
    1212        var createSiteCheckbox = $( '#wcpt_create-site-in-network' ),
    13             $mentorUserName = $( '#wcpt_mentor_wordpress_org_user_name' );
     13            $mentorUserName = $( '#wcpt_mentor_wordpress_org_user_name' ),
     14            hasContributor = $( '#wcpt_contributor_day' );
    1415
    1516        // Sponsor region
    1617        createSiteCheckbox.change( self.toggleSponsorRegionRequired );
    1718        createSiteCheckbox.trigger( 'change' );
     19
     20        // Contributor day info
     21        hasContributor.change( self.toggleContributorInfo );
     22        hasContributor.trigger( 'change' );
    1823
    1924        // Date fields
     
    95100    };
    96101
     102    /**
     103     * Toggle the display of the Contributor Day Info fields
     104     *
     105     * @param {object} event
     106     */
     107    self.toggleContributorInfo = function( event ) {
     108
     109        // Selects all the div enclosing input elements for contributing info,
     110        // except for the one which has the checkbox with ID wcpt_contributor_day
     111        var contributorInputElements = $( "#wcpt_contributor_info .inside .inside:not( :has( #wcpt_contributor_day ) )" );
     112
     113        if ( $( '#wcpt_contributor_day' ).is( ':checked' ) ) {
     114            contributorInputElements.slideDown();
     115        } else {
     116            contributorInputElements.slideUp();
     117        }
     118
     119    };
     120
    97121    /**
    98122     * Update the Mentor fields with the data for the mentor chosen in the picker.
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php

    r7260 r7475  
    8888            __( 'Venue Information', 'wcpt' ),
    8989            'wcpt_venue_metabox',
     90            WCPT_POST_TYPE_ID,
     91            'advanced',
     92            'high'
     93        );
     94
     95        add_meta_box(
     96            'wcpt_contributor_info',
     97            __( 'Contributor Day Information', 'wcpt' ),
     98            'wcpt_contributor_metabox',
    9099            WCPT_POST_TYPE_ID,
    91100            'advanced',
     
    442451                break;
    443452
     453            case 'contributor':
     454                // These fields names need to be unique, hence the 'Contributor' prefix on each one
     455                $retval = array (
     456                    'Contributor Day'                   => 'checkbox',
     457                    'Contributor Day Date (YYYY-mm-dd)' => 'date',
     458                    'Contributor Venue Name'            => 'text',
     459                    'Contributor Venue Address'         => 'textarea',
     460                    'Contributor Venue Capacity'        => 'text',
     461                    'Contributor Venue Website URL'     => 'text',
     462                    'Contributor Venue Contact Info'    => 'textarea',
     463                );
     464                break;
     465
    444466            case 'wordcamp':
    445467                $retval = array (
     
    522544                    'Contact Information'             => 'textarea',
    523545                    'Exhibition Space Available'      => 'checkbox',
     546
     547                    'Contributor Day'                   => 'checkbox',
     548                    'Contributor Day Date (YYYY-mm-dd)' => 'date',
     549                    'Contributor Venue Name'            => 'text',
     550                    'Contributor Venue Address'         => 'textarea',
     551                    'Contributor Venue Capacity'        => 'text',
     552                    'Contributor Venue Website URL'     => 'text',
     553                    'Contributor Venue Contact Info'    => 'textarea',
    524554                );
    525555                break;
     
    11551185function wcpt_venue_metabox() {
    11561186    $meta_keys = $GLOBALS['wordcamp_admin']->meta_keys( 'venue' );
     1187    wcpt_metabox( $meta_keys );
     1188}
     1189
     1190function wcpt_contributor_metabox() {
     1191    $meta_keys = $GLOBALS['wordcamp_admin']->meta_keys( 'contributor' );
    11571192    wcpt_metabox( $meta_keys );
    11581193}
Note: See TracChangeset for help on using the changeset viewer.